php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33785 pdo-pgsql crashes by PDO_FETCH_LAZY attribute
Submitted: 2005-07-20 12:50 UTC Modified: 2005-07-22 03:36 UTC
From: bs@php.net Assigned:
Status: Closed Package: PDO related
PHP Version: 5.1.0b3 OS: gentoo linux
Private report: No CVE-ID: None
 [2005-07-20 12:50 UTC] bs@php.net
Description:
------------
the code is self-explaining,
i am running mod_php 5.1.0b3 with apache 1.3.33 and postgresql 8.0.1

Reproduce code:
---------------
<pre><?php

$db = new PDO("pgsql:host=localhost dbname=foo user=bar password=''");

// need to select at least 2 rows to make it crash
$query = 'SELECT pcontact_id FROM pcontacts LIMIT 2';

// works fine
$s = $db->query($query);
$s->setFetchMode(PDO_FETCH_ASSOC);
foreach($s AS $row)
	var_dump($s);

// segfaults
foreach($db->query($query, PDO_FETCH_LAZY) AS $row)
	var_dump($row);
	exit;
?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-20 12:51 UTC] bs@php.net
the "exit;" was just for debugging, that's not what makes the script halt ;) sorry for that
 [2005-07-20 21:34 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

Seems to work fine in CVS and valgrind does not reveal any hidden memory corruption problems.
 [2005-07-21 12:57 UTC] bs@php.net
the cvs snapshot segfaults, too
here is a backtrace:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 28066)]
0xb6aecbcf in row_get_properties (object=0x0) at /home/bs/workspace/src/php5-200507210630/ext/pd
o/pdo_stmt.c:2211
2211            for (i = 0; i < stmt->column_count; i++) {
(gdb) 
(gdb) 
(gdb) 
(gdb) bt
#0  0xb6aecbcf in row_get_properties (object=0x0) at /home/bs/workspace/src/php5-200507210630/ex
t/pdo/pdo_stmt.c:2211
#1  0xb6bd8bc6 in php_var_dump (struc=0x81a8ea8, level=1) at /home/bs/workspace/src/php5-2005072
10630/ext/standard/var.c:139
#2  0xb6bd8fc5 in zif_var_dump (ht=1, return_value=0x81b91ac, return_value_ptr=0x0, this_ptr=0x0
, return_value_used=0) at /home/bs/workspace/src/php5-200507210630/ext/standard/var.c:192
#3  0xb6c60a75 in zend_do_fcall_common_helper_SPEC (execute_data=0xbfba47e0) at zend_vm_execute.
h:184
#4  0xb6c60488 in execute (op_array=0x81b28e4) at zend_vm_execute.h:87
#5  0xb6c3c6c0 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/bs/workspace/
src/php5-200507210630/Zend/zend.c:1087
#6  0xb6c012bd in php_execute_script (primary_file=0xbfba6b50) at /home/bs/workspace/src/php5-20
0507210630/main/main.c:1672
#7  0xb6cc85b7 in apache_php_module_main (r=0x819bc70, display_source_mode=0) at /home/bs/worksp
ace/src/php5-200507210630/sapi/apache/sapi_apache.c:53
#8  0xb6cc9038 in send_php (r=0x819bc70, display_source_mode=0, filename=0x0) at /home/bs/worksp
ace/src/php5-200507210630/sapi/apache/mod_php5.c:643
#9  0x080545f9 in ap_invoke_handler ()
#10 0x08067eae in ap_die ()
#11 0x0806803b in ap_process_request ()
#12 0x0805ee6c in ap_child_terminate ()
#13 0x0805f1bc in ap_child_terminate ()
#14 0x0805f2d3 in ap_child_terminate ()
#15 0x080604bc in ap_child_terminate ()
#16 0x080616fc in main ()
 [2005-07-22 03:36 UTC] wez@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 13:01:29 2024 UTC