Re: [PHP4BETA] lates libzend update did bad things
| From: | Zeev Suraski | Date: | Fri, 03 Sep 1999 12:14:26 +0000 |
| Subject: | Re: [PHP4BETA] lates libzend update did bad things | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-4023@lists.php.net to get a copy of this message | ||
At 10:45 03/09/99 , Thies C. Arntzen wrote:
zeev, the lates update broke something...
<?
$conn=mysql_connect("127.0.0.1");
for ($inx = 0; $inx < 10; $inx++) {
$r = mysql_db_query("test", "select * from phptest");
$array = mysql_fetch_array(&$r);
// mysql_free_result($r);
}
echo "-----------------------end--------------\n";flush();
?>
used to work - now says:
PHP Warning: 2 is not a MySQL result index in mysql.php3 on line 6
Well, why are you sending the result handle by reference? My API patch doesn't make miracles, it keeps the existing C code in a way it would work nicely, but not with weirdo stuff like that :) To avoid these errors, you would have to actually modify the C code to be PHP 4.0 style (which I will today, but I'll only do the MySQL module).
Basically, mysql_fetch_array() expects to receive a copy of the result handle, and it destroys it when it's done with it (transparently, mysql_fetch_array() was never designed to do it). Since you now send it the actual handle itself and not a copy - the handle that's destroyed is the only handle, and the object is dead by the time PHP wants to use it.
Zeev
--
Zeev Suraski <zeev@zend.com> http://www.zend.com/
For a PGP public key, finger bourbon@netvision.net.il