ID: 22403
Updated by: thekid@php.net
Reported By: cesararnold at yahoo dot com dot br
-Status: Open
+Status: Assigned
Bug Type: Sybase-ct (ctlib) related
Operating System: Win2000
PHP Version: 4.3.2-dev
-Assigned To:
+Assigned To: thekid
New Comment:
Can you show me the output of this script:
<?php
/* Test script for http://bugs.php.net/bug.php?id=22403
*
* SQL needed
* ==========
* use tempdb
* go
* create proc test (@param int)
* as
* begin
* select @param
* select @param + 1
* return @param
* end
* go
*/
header('Content-type: text/plain');
error_reporting(E_ALL);
function sybase_message($msgnumber, $severity, $state, $line, $text)
{
printf(
"*** Caught Sybase Server Message #%d [Severity %d, state %d] at
line %d\n '%s'\n",
$msgnumber,
$severity,
$state,
$line,
chop($text)
);
}
function sybase_exec() {
echo str_repeat('-', 72)."\n";
$args= func_get_args();
$query= array_shift($args);
foreach ($args as $arg) {
$query.= ' '.((NULL === $arg) ? 'NULL' : $arg);
}
printf(">>> Query: %s\n", $query);
flush();
$h= sybase_query($query);
printf("<<< Return: %s\n", var_export(is_resource($h), 1));
flush();
if (!$h) return;
while ($data= sybase_fetch_assoc($h)) {
var_dump($data);
flush();
}
}
sybase_set_message_handler('sybase_message');
sybase_min_server_severity(11);
sybase_connect('...', '...', '...'); // FILL IN PLEASE:)
printf(
"PHP Version: %s\n".
"OS : %s\n".
"SAPI : %s\n".
"Sybase : %s\n",
phpversion(),
php_uname(),
PHP_SAPI,
array_shift(sybase_fetch_row(sybase_query('select @@version')))
);
sybase_exec('exec tempdb..test');
sybase_exec('exec tempdb..test', NULL);
sybase_exec('exec tempdb..test', 1);
sybase_exec('exec tempdb..test', 'foo');
printf("\n===> Done\n");
?>
Previous Comments:
------------------------------------------------------------------------
[2003-03-28 14:54:50] cesararnold at yahoo dot com dot br
Hi,
first of all, thanks for your tests...
I'm sorry but I forgot to say that it's happening on IIS 5.0, not on
Apache.
Thanks again.
------------------------------------------------------------------------
[2003-03-25 17:56:29] thekid@php.net
Could not reproduce here:
<?php
$db= sybase_connect('sybase', 'username', '******');
$q= sybase_query('exec csc_getAddressByCId '.$argv[1]);
var_dump($q, sybase_fetch_assoc($q));
?>
### Testing with empty parameter:
thekid@thekid:~ > php sybase_segfault.php ''
PHP Warning: sybase_query()
[http://www.php.net/function.sybase-query]: Sybase: Server message:
Procedure csc_getAddressByCId expects parameter @cid, which was not
supplied.
(severity 16, procedure csc_getAddressByCId) in
/usr/home/thekid/sybase_segfault.php on line 3
Warning: sybase_query() [http://www.php.net/function.sybase-query]:
Sybase: Server message: Procedure csc_getAddressByCId expects
parameter @cid, which was not supplied.
(severity 16, procedure csc_getAddressByCId) in
/usr/home/thekid/sybase_segfault.php on line 3
PHP Warning: sybase_fetch_assoc(): supplied argument is not a valid
Sybase result resource in /usr/home/thekid/sybase_segfault.php on line
4
Warning: sybase_fetch_assoc(): supplied argument is not a valid Sybase
result resource in /usr/home/thekid/sybase_segfault.php on line 4
bool(false)
NULL
### Testing with parameter, but sp returning failure:
thekid@thekid:~ > php sybase_segfault.php 182
resource(5) of type (sybase-ct result)
bool(false)
### Testing with parameter and sp returning data:
thekid@thekid:~ > php sybase_segfault.php 1861822
resource(5) of type (sybase-ct result)
array(1) {
["computed"]=>
string(16) "devnull@thekid.de"
}
Does this only happen within Apache or does this occur on cli scripts,
too?
------------------------------------------------------------------------
[2003-02-26 07:22:54] cesararnold at yahoo dot com dot br
Hi, thanks for your reply.
sybase did not stop. If I ran the query with null parameter (as
mentioned) directly into the database, nothing wrong happens. Also,
using differente interfaces to run that query using null, everything
goes well. the db returns a error message saying that that the query
does not accept null values and returns, something like:
Server Message: Number 201, Severity 16
Procedure 'procedure_name', Line 0:
Procedure procedure_name expects parameter @ID, which was not supplied.
(return status = -6)
So, the problem, on my oppinion, is not on the db.
Could it be on php or on the native dll, on this case :
php_sybase_ct.dll, when receiving the error message from the database
?
I hope this can help.
Thanks again.
------------------------------------------------------------------------
[2003-02-25 15:34:09] iliaa@php.net
What crashes in particular PHP or Sybase? Given the nature of your
error I could see how the query would fail, which could trigger a crash
in sybase if this particular condition is not handled. However, if that
is the case there is nothing PHP could do to prevent such a thing from
happening.
------------------------------------------------------------------------
[2003-02-25 02:13:02] sniper@php.net
Assuming this is sybase related..plus correct PHP version.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/22403
--
Edit this bug report at http://bugs.php.net/?id=22403&edit=1