php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55120 MongoDB PHP driver, segfault if you dont rewind cursor first
Submitted: 2011-07-03 13:38 UTC Modified: 2011-07-03 19:12 UTC
From: tl at jiujitsuforums dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.3.6 OS: Linux version 2.6.18-194.3.1.el5
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tl at jiujitsuforums dot com
New email:
PHP Version: OS:

 

 [2011-07-03 13:38 UTC] tl at jiujitsuforums dot com
Description:
------------
PHP version is actually 5.3.2 <-- did not show up in the list

While querying MongoDB using php driver, 
simply iterating over a collection will sometimes cause a segfault in the php 
process if you dont first rewind the cursor.


MongoDB version: 1.8
Mongo DB php driver version: 1.1.4-31
PHP version: 5.3.2


Test script:
---------------
$collection=$mongodb->blanks;

$cursor = $collection->find();

$cursor->rewind();   // REMOVE this and segfaults occur much of the time

foreach ($cursor as $obj) {
        $blankId=$obj['blankId'];
}

Expected result:
----------------
Iterate over collection fine

Actual result:
--------------
segfault in php processi


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-03 13:42 UTC] felipe@php.net
-Status: Open +Status: Bogus
 [2011-07-03 13:42 UTC] felipe@php.net
For Mongo PHP driver, report bug at https://jira.mongodb.org/browse/PHP
 [2011-07-03 19:12 UTC] tl at jiujitsuforums dot com
PLEASE DISREGARD.  Tracked down the issue.
May be related to a lot of others peoples issues when it comes to segfaults.

I had TWO php installations.
When running configure, it picked up the default php installation which is NOT used 
for my website.

People need to be careful and call configure correctly using the path to their php 
install like this:

./configure --with-php-config=/blah/blah/php/bin/php-config

Effectively was building the driver against one version of php and installing it to 
the extensions directory of a different php install.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 10:01:30 2025 UTC