From:             lodeclaassen at gmail dot com
Operating system: Debian Linux
PHP version:      5.2.12
PHP Bug Type:     Reproducible crash
Bug description:  Accesing mysqli->affected_rows on no connection causes 
segfault

Description:
------------
I open a mysqli connection that failes (in the tested case wrong
password). After that when I try to get the affected rows
(mysqli->affected_rows) PHP exits and I only get a blank screen.

The configure command from phpinfo:
'./configure' '--with-apxs2' '--with-curl=/usr/local/lib' '--with-gd'
'--enable-gd-native-ttf' '--with-ttf' '--with-gettext'
'--with-jpeg-dir=/usr/local/lib' '--with-freetype-dir=/usr/local/lib'
'--with-kerberos' '--with-openssl' '--with-mcrypt' '--with-mhash'
'--with-mysql=/usr/local/mysql'
'--with-mysqli=/usr/local/mysql/bin/mysql_config'
'--with-pdo-mysql=/usr/local/mysql' '--with-pear'
'--with-png-dir=/usr/local/lib' '--with-zlib'
'--with-zlib-dir=/usr/local/lib' '--enable-zip' '--with-iconv=/usr/local'
'--enable-bcmath' '--enable-calendar' '--enable-ftp'
'--enable-magic-quotes' '--enable-sockets' '--enable-mbstring'

Other settings I don't know, I don't operate the host.

Reproduce code:
---------------
<?php
echo 'startup<br />';

if (isset($_GET['try']) && $_GET['try'] == 1) {
        $connection = new mysqli('localhost', 'user', 'wrong password',
'SomeExistingTable');
        $connection->query("SELECT `id` FROM `SomeExistingTable` LIMIT 1");
        echo 'affected rows: '.$connection->affected_rows.'<br />';
}

echo 'ending<br />';
?>

Expected result:
----------------
If I request the file with ?try=0 I expect:

startup
ending

When I request ?try=1 I get nothing, a blank screen.

Actual result:
--------------
With ?try=1 I expect to see:

startup
affected rows: 
ending

-- 
Edit bug report at http://bugs.php.net/?id=50727&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=50727&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=50727&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=50727&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=50727&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=50727&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=50727&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=50727&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=50727&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=50727&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=50727&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=50727&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=50727&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=50727&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=50727&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=50727&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=50727&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=50727&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=50727&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=50727&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=50727&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=50727&r=mysqlcfg

Reply via email to