-
-
Save jmikola/200cb049598ce9f9b766 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Executed as: php -n -d extension=mongodb.so segfault.php | |
Output: | |
Fatal error: Uncaught exception 'MongoDB\Driver\Exception\InvalidArgumentException' with message 'Expected sort to be array or object, null given' in /home/jmikola/workspace/mongodb/phpc/segfault/index2.php:13 | |
Stack trace: | |
#0 /home/jmikola/workspace/mongodb/phpc/segfault/index2.php(13): MongoDB\Driver\Query->__construct(Object(stdClass), Array) | |
#1 /home/jmikola/workspace/mongodb/phpc/segfault/index2.php(30): findOne(Object(MongoDB\Driver\Manager)) | |
#2 {main} | |
thrown in /home/jmikola/workspace/mongodb/phpc/segfault/index2.php on line 13 | |
*/ | |
use MongoDB\Driver\Cursor; | |
use MongoDB\Driver\Manager; | |
use MongoDB\Driver\Query; | |
function findOne($manager) | |
{ | |
$options = ['sort' => array(), 'connectTimeoutMS' => 1, 'socketTimeoutMS' => 1, 'wTimeoutMS' => 1]; | |
$filter = []; | |
$query = _buildQuery($filter, $options); | |
$options["cursorFlags"] = 0; | |
$query = new Query($filter, $options); | |
$manager->executeQuery('JOPA', $query); | |
} | |
function _buildQuery($filter, $options) | |
{ | |
$options["cursorFlags"] = 0; | |
$query = new Query($filter, $options); | |
return $query; | |
} | |
$host = 'mongodb://aux.srv.loc:27018'; | |
$options = ['w' => 1, 'journal' => 0, 'connectTimeoutMS' => 1, 'socketTimeoutMS' => 1, 'wTimeoutMS' => 1]; | |
$manager = new Manager($host, $options); | |
findOne($manager); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Executed as: php -n -d extension=mongodb.so segfault.php | |
Output: | |
Fatal error: Uncaught exception 'MongoDB\Driver\Exception\InvalidArgumentException' with message 'Invalid namespace provided: JOPA' in /home/jmikola/workspace/mongodb/phpc/segfault/index2.php:15 | |
Stack trace: | |
#0 /home/jmikola/workspace/mongodb/phpc/segfault/index2.php(15): MongoDB\Driver\Manager->executeQuery('JOPA', Object(MongoDB\Driver\Query)) | |
#1 /home/jmikola/workspace/mongodb/phpc/segfault/index2.php(30): findOne(Object(MongoDB\Driver\Manager)) | |
#2 {main} | |
thrown in /home/jmikola/workspace/mongodb/phpc/segfault/index2.php on line 15 | |
*/ | |
use MongoDB\Driver\Cursor; | |
use MongoDB\Driver\Manager; | |
use MongoDB\Driver\Query; | |
function findOne($manager) | |
{ | |
$options = ['sort' => array(), 'connectTimeoutMS' => 1, 'socketTimeoutMS' => 1, 'wTimeoutMS' => 1]; | |
$filter = []; | |
//$query = _buildQuery($filter, $options); | |
$options["cursorFlags"] = 0; | |
$query = new Query($filter, $options); | |
$manager->executeQuery('JOPA', $query); | |
} | |
function _buildQuery($filter, $options) | |
{ | |
$options["cursorFlags"] = 0; | |
$query = new Query($filter, $options); | |
return $query; | |
} | |
$host = 'mongodb://aux.srv.loc:27018'; | |
$options = ['w' => 1, 'journal' => 0, 'connectTimeoutMS' => 1, 'socketTimeoutMS' => 1, 'wTimeoutMS' => 1]; | |
$manager = new Manager($host, $options); | |
findOne($manager); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Executed as: php -n -d extension=mongodb.so segfault.php | |
Backtrace: | |
#0 0x0000000000886d96 in zend_get_class_entry (zobject=0x7fc9b0224b38) at /tmp/build_php-5.6.9.Ifh/php-5.6.9/Zend/zend_API.c:237 | |
#1 0x00000000008acef3 in zend_exception_error (exception=0x7fc9b0224b38, severity=1) at /tmp/build_php-5.6.9.Ifh/php-5.6.9/Zend/zend_exceptions.c:858 | |
#2 0x0000000000885a6c in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /tmp/build_php-5.6.9.Ifh/php-5.6.9/Zend/zend.c:1365 | |
#3 0x00000000007e8c32 in php_execute_script (primary_file=0x7ffc0986b740) at /tmp/build_php-5.6.9.Ifh/php-5.6.9/main/main.c:2597 | |
#4 0x0000000000940cc8 in do_cli (argc=5, argv=0x26a76d0) at /tmp/build_php-5.6.9.Ifh/php-5.6.9/sapi/cli/php_cli.c:994 | |
#5 0x0000000000941ff0 in main (argc=5, argv=0x26a76d0) at /tmp/build_php-5.6.9.Ifh/php-5.6.9/sapi/cli/php_cli.c:1378 | |
*/ | |
use MongoDB\Driver\Cursor; | |
use MongoDB\Driver\Manager; | |
use MongoDB\Driver\Query; | |
function findOne($manager) | |
{ | |
$options = ['sort' => array(), 'connectTimeoutMS' => 1, 'socketTimeoutMS' => 1, 'wTimeoutMS' => 1]; | |
$filter = []; | |
$query = _buildQuery($filter, $options); | |
//$options["cursorFlags"] = 0; | |
//$query = new Query($filter, $options); | |
$manager->executeQuery('JOPA', $query); | |
} | |
function _buildQuery($filter, $options) | |
{ | |
$options["cursorFlags"] = 0; | |
$query = new Query($filter, $options); | |
return $query; | |
} | |
$host = 'mongodb://aux.srv.loc:27018'; | |
$options = ['w' => 1, 'journal' => 0, 'connectTimeoutMS' => 1, 'socketTimeoutMS' => 1, 'wTimeoutMS' => 1]; | |
$manager = new Manager($host, $options); | |
findOne($manager); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment