PHP 4.0 Bug #5705: Sybase link resource type gets changed from IS_RESOURCE to IS_LONG
| From: | dean dot bennett at home dot com | Date: | Thu, 20 Jul 2000 16:46:37 +0000 |
| Subject: | PHP 4.0 Bug #5705: Sybase link resource type gets changed from IS_RESOURCE to IS_LONG | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-25244@lists.php.net to get a copy of this message | ||
From: dean.bennett@home.com
Operating system: Digital Unix
PHP version: 4.0 Latest CVS (20/07/2000)
PHP Bug Type: Sybase-ct (ctlib) related
Bug description: Sybase link resource type gets changed from IS_RESOURCE to IS_LONG
I saw this problem mentioned in a mailing list before, but couldn't find a bug report, so here
goes.
If you do a second (non-persistent) connect to the same database/user/password combo, the returned
value gets its type set to IS_LONG instead of IS_RESOURCE, so subsequent queries fail with a
'Supplied argument is not a valid Sybase-Link resource'
The return type used to be IS_LONG (and still is in the Sybase dblib code), but the ctlib code was
changed to use ZEND_REGISTER_RESOURCE, which sets the type to IS_RESOURCE. The code that fetches a
previously used link resource sets the return_value type to IS_LONG.
The persistent connect code always calls ZEND_REGISTER_RESOURCE, the non-persistent code only calls
it for a new connection.
The patch below is in php_sybase_do_connect in php_sybase_ct.c.
*** php_sybase_ct.c.orig Thu Jul 20 10:36:22 2000
--- php_sybase_ct.c Thu Jul 20 10:38:16 2000
***************
*** 559,565 ****
ptr = zend_list_find(link,&type); /* check if the link is still there */
if (ptr && (type==sybase_globals.le_link || type==sybase_globals.le_plink)) {
return_value->value.lval = sybase_globals.default_link = link;
! return_value->type = IS_LONG;
efree(hashed_details);
return;
} else {
--- 559,565 ----
ptr = zend_list_find(link,&type); /* check if the link is still there */
if (ptr && (type==sybase_globals.le_link || type==sybase_globals.le_plink)) {
return_value->value.lval = sybase_globals.default_link = link;
! return_value->type = IS_RESOURCE;
efree(hashed_details);
return;
} else {