|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-07-02 01:20 UTC] miguel222 at mindless dot com
The following code snippet is used in an abstract db class in an application I am writing:
~~~~~
$query=sybase_query("<SQL QUERY HERE>");
while($row=sybase_fetch_array($query)) {
while(list($key,$val)=each($row))
if(is_int($key)) unset($row[$key]);
$result[]=$row;
}
return $result;
~~~~~
The code is used to get rid of [via unset()] the numeric keys in the array that syabse_fetch_array() returns. When executed, the Apache server dies from a seg fault.
gdb reports different error messages spuriously:
segfault - 0x40082501 in __kill () from /lib/libc.so.6
segfault - 0x???????? in ?????? () from /opt/sybase-11.9.2/libsybc.so
If the line containing "unset()" is removed, the crash does not occur (sometimes there is no crash, only garbled data).
If PHP is compiled with the Sybase-CT library instead, then the code works fine (unchanged), but this is unoptimal since then warnings are generated by selecting the database with sybase_connect() or sybase_select_db().
Please e-mail me if there is a solution to that problem. Also, I couldn't find any documentation on the advantages or disadvantages of DB vs CT...
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 20:00:01 2025 UTC |
There have been some changes to the DB-Lib in recent CVS. DB-Lib has been very unreliable since 4.0 beta 1, but Zeev is trying to fix it. Can you try the CVS and see if it works? Reason(s) to use CT-Lib instead of DB-Lib: 1) DB-Lib is no longer supported by Sybase and will eventually go away. 2) DB-Lib does not have, for example, sybase_num_rows(). You have to do a second query ("select count(*)") to get this information. 3) The error messages in CT-Lib are more configurable. You can turn down the min_severity_level with sybase.min_message_severity and friends in your php.ini. This will make the warnings go away, while still letting you see the stuff that you need to.I've switched to CT-Lib; data corruption is gone, BUT... the call to ct_con_alloc() fails frequently... in ext/php_sybase_ct.c, the line that reads: if(ct_con_alloc(...) != CS_SUCCEED) { phperror(E_WARNING, "Unable to allocate connection record..."); } ~(not a verbatim description)~ Is getting executed. I can't get php, sybase, or linux to give me any more information... Perhaps CT-Lib has verbose error reporting that I could build in right here?