Bug #17343 Updated: Resource encapsulation can break some functions

From: Date: Mon, 17 Jun 2002 20:24:16 +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-10939@lists.php.net to get a copy of this message
ID: 17343 Updated by: sniper@php.net Reported By: chris@thumbtack.org -Status: Feedback +Status: Bogus Bug Type: Unknown/Other Function Operating System: Linux PHP Version: 4.2.1 New Comment: Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.php.net/how-to-report.php If you can provide more information, feel free to add it to this bug and change the status back to "Open". Thank you for your interest in PHP. Previous Comments: ------------------------------------------------------------------------ [2002-06-17 15:10:33] hholzgra@php.net resources are just numbers used to lookup the actual resource data internaly, so passing by value or reference should make no differecne ... ------------------------------------------------------------------------ [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

« previous php.bugs (#10939) next »