|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-02-24 15:38 UTC] cesararnold at yahoo dot com dot br
Hi,
we are using PHP 4.3.2 (latest STABLE version) and found a possible bug when trying to execute a sql command (a procedure). the procedure needs 1 (one) argument and does not accept null values when is called.
On our case, the variable $varID was infortunatelly = NULL. after ran the code we got two strange behaviors:
1) using pear object
$cmd_sql = "exec procedure_name " . $varID;
if (DB::isError($query_proc = $db_conn->query($cmd_sql)))
{
// get the native backend error
// and the last query
exit($query_proc->getMessage());
}
the system crashes and stops the web server! restarting the web server, evething restarts to work.
2) using native functions
like @sybase_query( $cmd_sql, $db_conn );
the system crashes but does NOT stop the web server.
for both cases php gives the message:
"PHP has encountered an Access Violation at 01E436B9"
I know that this can be fixed just sending a non-null value to the procedure, but PHP could not crash, on my single oppinion.
Is there some fix to this case?
Thanks a lot.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 09:00:01 2025 UTC |
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?Bingo ! The output is below: PHP Version: 4.3.2-dev OS : Windows NT SAO-IRINEU 5.0 build 2195 SAPI : isapi Sybase : Adaptive Server Enterprise/11.9.2/1075/P/Linux Intel/Linux 2.2.5 i586/OPT/Mon Jul 12 09:51:46 1999 ------------------------------------------------------------------------ >>> Query: exec tempdb..test *** Caught Sybase Server Message #201 [Severity 16, state 2] at line 0 'Procedure test expects parameter @param, which was not supplied.' PHP has encountered an Access Violation at 01EB36C9 At this point the PHP stopped and IIS too, exactly as we have posted. It was necessary to stop and restart the www service manually. Thanks again for your great help.Have been able to reproduce with sybase libraries. As these are not available on FreeBSD, I use FreeTDS, which does not produce a status result in this situation ("return status = -6") but rather issues a "CS_CMD_FAIL" instantly. I know where the problem is (php_sybase_finish_results), fixing it is not trivial though (I've already given it a first shot but gave up after the supposed fix caused a segfault in another place:)). I'll do my best and see if I can include the fix in 4.3.2.Congratulations! It seems to be working now, but not for all cases. Instead of a php crash and the web server stopped, a "HTTP 500 - Internal server error" page appears and "The page cannot be displayed". That's fine. But if I put a "echo " command before the query like the following example, the php crashes. If the "echo" is removed, the "HTTP 500 ..." error appears. ... line 098) echo "Testing ..."; line 099) line 101) // select data line 102) $cmd_sql = "exec sp_procedure"; line 103) line 104) if (DB::isError($query = $db_conn->query($cmd_sql))) line 105) { line 106) // get the native backend error line 107) // and the last query line 108) exit($query->getMessage()); line 109) } ... I have two more questions to do about the last update: - on the last stable version downloaded exists a new folder called "ext", that seems to be similat to "extensions". Now we have 2 folders on php directory, with similar dlls. Is that correct ? - why it does not execute the "exit" command at line 108, because (in my oppinion) a error is occuring at the sql command ? is that error code returned or not ? It seems that you are almost arriving to solve the case. Anything alse we can do to help, please advise. Thanks for all your help.