#50171 [NEW]: Code behaviour different from documentation

From: Date: Fri, 13 Nov 2009 19:03:30 +0000
Subject: #50171 [NEW]: Code behaviour different from documentation
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-3111@lists.php.net to get a copy of this message
From: rapsys at free dot fr Operating system: debian lenny/sid PHP version: 5.2.11 PHP Bug Type: Documentation problem Bug description: Code behaviour different from documentation Description: ------------ This documentation don't work anymore for mysql inserted id function. «The ID generated for an AUTO_INCREMENT column by the previous INSERT query on success, 0 if the previous query does not generate an AUTO_INCREMENT value, or FALSE if no MySQL connection was established.» Right now the behaviour has changed, the mysql_inserted_id return alway 0 if last query on the connexion was an update, delete, select or a failed query. Tested on php 5.2.4 and the code behaviour is documented in mysqli function, so the documentation should be wrong since few versions Reproduce code: --------------- --- From manual page: function.mysql-insert-id#Notes --- Code : connect to db query with a working insert see x as inserted id query a update see 0 as inserted id query a failed insert see 0 as inserted id Expected result: ---------------- The value of the AUTO_INCREMENT field that was updated by the previous query. Returns zero if there was no previous query on the connection or if the query did not update an AUTO_INCREMENT value. Behaviour changed in php version X.Y.Z Actual result: -------------- The ID generated for an AUTO_INCREMENT column by the previous INSERT query on success, 0 if the previous query does not generate an AUTO_INCREMENT value, or FALSE if no MySQL connection was established. -- Edit bug report at http://bugs.php.net/?id=50171&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50171&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50171&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50171&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50171&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50171&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50171&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50171&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50171&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50171&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50171&r=support Expected behavior: http://bugs.php.net/fix.php?id=50171&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50171&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50171&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50171&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50171&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=50171&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50171&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50171&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50171&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50171&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50171&r=mysqlcfg

« previous php.doc.bugs (#3111) next »