From:             [EMAIL PROTECTED]
Operating system: *
PHP version:      5CVS-2005-06-27 (dev)
PHP Bug Type:     MySQLi related
Bug description:  extended mysqli class crashes when result is not object

Description:
------------
(gdb) run tt.php
Starting program: /www/php/bin/php tt.php
[Thread debugging using libthread_db enabled]
[New Thread -1208100640 (LWP 4755)]
PHP Fatal error:  Call to a member function fetch_row() on a non-object in
tt.php on line 8

Fatal error: Call to a member function fetch_row() on a non-object in
tt.php on line 8

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208100640 (LWP 4755)]
0x0818cac4 in instanceof_function_ex (instance_ce=0x8431fac, ce=0x8409f60,
interfaces_only=0 '\0') at /usr/src/php5/Zend/zend_operators.c:1564
1564                    if
(instanceof_function(instance_ce->interfaces[i], ce TSRMLS_CC)) {
(gdb) bt
#0  0x0818cac4 in instanceof_function_ex (instance_ce=0x8431fac,
ce=0x8409f60, interfaces_only=0 '\0') at
/usr/src/php5/Zend/zend_operators.c:1564
#1  0x0818cb2d in instanceof_function (instance_ce=0x8431fac,
ce=0x8409f60) at /usr/src/php5/Zend/zend_operators.c:1582
#2  0x08094fc7 in mysqli_objects_free_storage (object=0x8433cfc) at
/usr/src/php5/ext/mysqli/mysqli.c:132
#3  0x081a8547 in zend_objects_store_free_object_storage
(objects=0x839eeec) at /usr/src/php5/Zend/zend_objects_API.c:82
#4  0x08182b87 in shutdown_executor () at
/usr/src/php5/Zend/zend_execute_API.c:272
#5  0x0818f416 in zend_deactivate () at /usr/src/php5/Zend/zend.c:823
#6  0x0814e5fa in php_request_shutdown (dummy=0x0) at
/usr/src/php5/main/main.c:1237
#7  0x081fa4b9 in main (argc=2, argv=0xbffff414) at
/usr/src/php5/sapi/cli/php_cli.c:1142


Reproduce code:
---------------
<?php

class DB extends mysqli
{
  public function query_single($query) {
    $result = parent::query($query);
    $row = $result->fetch_row(); // <- Here be crash
    return (isset($row[0]) ? $row[0] : '');
  }
}

// Works when using mysqli class directly
/*
$DB = new mysqli('localhost', 'root', '', '');
var_dump($DB->query_single('SELECT DATE()'));
*/

// Segfault when using the DB class which extends mysqli
$DB = new DB('localhost', 'root', '', '');
var_dump($DB->query_single('SELECT DATE()'));



-- 
Edit bug report at http://bugs.php.net/?id=33491&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33491&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33491&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33491&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33491&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33491&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33491&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33491&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33491&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33491&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33491&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33491&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33491&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33491&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33491&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33491&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33491&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33491&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33491&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33491&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33491&r=mysqlcfg

Reply via email to