php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37889 Segfault using IteratorIterator on PDO statements
Submitted: 2006-06-22 16:18 UTC Modified: 2006-06-23 08:35 UTC
From: kevin at littletrader dot net Assigned: helly (profile)
Status: Not a bug Package: SPL related
PHP Version: 5.2.0-dev OS: *
Private report: No CVE-ID: None
 [2006-06-22 16:18 UTC] kevin at littletrader dot net
Description:
------------
Segfault:
[Thu Jun 22 18:34:02 2006] [notice] child pid 6222 exit signal Segmentation fault (11)

Reproduce code:
---------------
<?php
$sql = "SELECT * FROM news ORDER BY nid DESC LIMIT 1";
try{
        $dbh = new PDO("mysql:host=$dbhost;dbname=$dbname", $username, $password);
        $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        $stmt = $dbh->prepare($sql);
        $stmt->execute();
        $result = $stmt->setFetchMode(PDO::FETCH_ASSOC);
        $it = new IteratorIterator($stmt);
        foreach($it as $resultSet)
        {
                echo $resultSet->key();
        }
        }
catch(PDOException $e)
        {
        echo 'Unable to select latest record'.$e->getMessage();
        }

?>


Actual result:
--------------
[Thu Jun 22 18:34:02 2006] [notice] child pid 6222 exit signal Segmentation fault (11)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-23 07:49 UTC] iliaa@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.


 [2006-06-23 08:25 UTC] kevin at littletrader dot net
[New Thread -151095616 (LWP 12720)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -151095616 (LWP 12720)]
0xf626b618 in mysql_more_results () from /usr/local/apache/libexec/libphp5.so
 [2006-06-23 08:30 UTC] kevin at littletrader dot net
[New Thread -151095616 (LWP 12747)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -151095616 (LWP 12747)]
0xf626b618 in mysql_more_results () from /usr/local/apache/libexec/libphp5.so
(gdb) bt
#0  0xf626b618 in mysql_more_results () from /usr/local/apache/libexec/libphp5.so
#1  0xf606155d in pdo_mysql_stmt_dtor (stmt=0x834d3c4)
    at /home/kevin/html/php/dev/php5.2-200606221430/ext/pdo_mysql/mysql_statement.c:71
#2  0xf605dc99 in free_statement (stmt=0x834d3c4) at /home/kevin/html/php/dev/php5.2-200606221430/ext/pdo/pdo_stmt.c:2225
#3  0xf605df5e in pdo_stmt_iter_dtor (iter=0x834e3c4) at /home/kevin/html/php/dev/php5.2-200606221430/ext/pdo/pdo_stmt.c:2308
#4  0xf60c8d6d in spl_dual_it_free_storage (_object=0x836768c)
    at /home/kevin/html/php/dev/php5.2-200606221430/ext/spl/spl_iterators.c:1447
#5  0xf621cdd8 in zend_objects_store_free_object_storage (objects=0xf64a4a18)
    at /home/kevin/html/php/dev/php5.2-200606221430/Zend/zend_objects_API.c:86
#6  0xf61f3a91 in shutdown_executor () at /home/kevin/html/php/dev/php5.2-200606221430/Zend/zend_execute_API.c:281
#7  0xf6200c99 in zend_deactivate () at /home/kevin/html/php/dev/php5.2-200606221430/Zend/zend.c:854
#8  0xf61bd0bc in php_request_shutdown (dummy=0x0) at /home/kevin/html/php/dev/php5.2-200606221430/main/main.c:1300
#9  0xf62639c7 in apache_php_module_main (r=0x833c6c4, display_source_mode=0)
    at /home/kevin/html/php/dev/php5.2-200606221430/sapi/apache/sapi_apache.c:59
#10 0xf62646d3 in send_php (r=0x833c6c4, display_source_mode=0, filename=0x833d264 "/home/kevin/html/news/index.php")
    at /home/kevin/html/php/dev/php5.2-200606221430/sapi/apache/mod_php5.c:665
#11 0xf626471b in send_parsed_php (r=0x833c6c4) at /home/kevin/html/php/dev/php5.2-200606221430/sapi/apache/mod_php5.c:680
#12 0x08069f94 in ap_invoke_handler ()
#13 0x0807f1ac in process_request_internal ()
#14 0x0807f20b in ap_process_request ()
#15 0x080760aa in child_main ()
#16 0x080762ad in make_child ()
#17 0x08076411 in startup_children ()
#18 0x08076aa7 in standalone_main ()
#19 0x080772bf in main ()
 [2006-06-23 08:35 UTC] tony2001@php.net
Duplicate of bug #37445.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC