php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5705 Sybase link resource type gets changed from IS_RESOURCE to IS_LONG
Submitted: 2000-07-20 18:46 UTC Modified: 2000-07-20 19:15 UTC
From: dean dot bennett at home dot com Assigned:
Status: Closed Package: Sybase-ct (ctlib) related
PHP Version: 4.0 Latest CVS (20/07/2000) OS: Digital Unix
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dean dot bennett at home dot com
New email:
PHP Version: OS:

 

 [2000-07-20 18:46 UTC] dean dot bennett at home dot com
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 {

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-20 19:15 UTC] sterling at cvs dot php dot net
Fixed in CVS, thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 10 16:01:27 2024 UTC