Bug #17343 Updated: Resource encapsulation can break some functions
| From: | hholzgra@php.net | Date: | Mon, 17 Jun 2002 19:10:34 +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-10921@lists.php.net to get a copy of this message | ||
ID: 17343
Updated by: hholzgra@php.net
Reported By: chris@thumbtack.org
-Status: Open
+Status: Feedback
Bug Type: Unknown/Other Function
Operating System: Linux
PHP Version: 4.2.1
New Comment:
resources are just numbers used to lookup
the actual resource data internaly, so
passing by value or reference should make no differecne ...
Previous Comments:
------------------------------------------------------------------------
[2002-05-21 17:56:04] szii@sziisoft.com
This used to work (calling against a copy of the link) in PHP 4.0pl1.
-Szii
------------------------------------------------------------------------
[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