There is a bug in the PHP sybase_ct module. Bug #11489
The following script produces the following error the second time
getAppName/sybase_fetch_row is called.
Error (warning):
/users/pmoosman/test_data/test1.php(26) : Warning - 3 is not a valid
Sybase result
resource
Script:
<?php
function getConnect()
{
$db = sybase_connect('xxxx','yyy','zzz');
return $db;
}
function getAppName($app_id)
{
// static $db;
$sql = "select name from web_apps where application_id=$app_id";
$db = getconnect();
$result = sybase_query($sql, $db);
$row = sybase_fetch_row($result);
return $row[0];
}
getAppName(23);
getAppName(23);
?>
Note: If I uncomment the "static $db" line, the error (warning) goes away.
I ran this script through the debugger and it looks like the db resource
handle is getting incorrectly cleaned up.
I compared php_sybase_ct.c to php_mysql.c and I noticed that php_mysql.c ups
the reference count on db resource link and php_sybase_ct.c does not. So,
my guess is that that is the problem. However, I'm new to PHP and I'm not
very familiar with the Zend code, so I would appreciate someone with some Zend
knowledge to look over my proposed fix.
In my copy of php_sybase_ct.c version 1.43 I added the following two lines:
Line #599: zend_list_addref(link);
Line #638: zend_list_addref(SybCtG(default_link));
--
Paul Moosman
[EMAIL PROTECTED]
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]