From:             
Operating system: FreeBSD 7.3
PHP version:      5.3.5
Package:          MySQLi related
Bug Type:         Bug
Bug description:mysqli->insert_id will return zero after mysqli->get_warnings()

Description:
------------
mysqli->insert_id will return zero after mysqli->get_warnings()

(In PHP 5.3.3, it is ok)

Test script:
---------------
$link = new mysqli('localhost', '', '', 'test');



$link->query("DROP TABLE `abcde`");

$link->query("CREATE TABLE abcde (`id` int(11) NOT NULL AUTO_INCREMENT,
`value` VARCHAR(255) NOT NULL, PRIMARY KEY (`id`));");

$link->query("INSERT INTO abcde SET `id` = 0");



print_r($link->get_warnings());

echo $link->insert_id . "\n";

echo $link->query("SELECT LAST_INSERT_ID() AS `id`")->fetch_object()->id .
"\n";

Expected result:
----------------
mysqli_warning Object

(

    [message] => Field 'value' doesn't have a default value

    [sqlstate] => HY000

    [errno] => 1364

)

1

1

Actual result:
--------------
mysqli_warning Object

(

    [message] => Field 'value' doesn't have a default value

    [sqlstate] => HY000

    [errno] => 1364

)

0

1



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

Reply via email to