Bug #17343 Updated: Resource encapsulation can break some functions
| From: | szii at sziisoft dot com | Date: | Tue, 21 May 2002 21:56:05 +0000 |
| Subject: | Bug #17343 Updated: Resource encapsulation can break some functions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-8128@lists.php.net to get a copy of this message | ||
ID: 17343
Updated by: szii@sziisoft.com
Reported By: chris@thumbtack.org
Status: Open
Bug Type: Unknown/Other Function
Operating System: Linux
PHP Version: 4.2.1
New Comment:
This used to work (calling against a copy of the link) in PHP 4.0pl1.
-Szii
Previous Comments:
------------------------------------------------------------------------
[2002-05-21 17:54:26] chris@thumbtack.org
When using mysql_insert_id() if you've made a call using a wrapped
function (ie, my_database_query($query) wrapping mysql_query()) the
database resource may not be "set" to allow using the last connection.
Ex.
1) Call my_database_connect() and store the returned mysql Link as
$res. Note that it's a copy...
2) call my_database_query($query, $res) and insert something with an
auto_increment field.
3) call mysql_insert_id() and it'll fail.
4) call mysql_insert_id($res) and it'll work.
It appears that mysql_insert_id() looks for the last used connection,
but if that connection resource is "wrapped/copied" then the
ZEND_GET_RESOURCE-type method can't find it.
Storing a REFERENCE to the mysql link in (1) will allow proper usage,
but storing a copy does not.
This was exposed using mysql, but it may have deeper meaning to other
modules - hence the "Unknown/Other Function" category
chris@thumbtack.org
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=17343&edit=1