By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 697 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

Seg fault in PHP 5.0.3

P: n/a

The following code causes a segmentation fault in PHP 5.0.3 debian package

public static function allreadyInDatabase( $location ) {
$sql = "SELECT COUNT(*) FROM prefix_search WHERE location = :1";
$db = DB_Mysql_Singleton::getInstance();
$stm = $db->prepare( $sql );
$res = $stm->execute( $location );
return ( $res->getOne() == 1 );

log output:
[Tue Dec 28 09:54:26 2004] [notice] child pid 6895 exit signal Segmentation
fault (11)

I have located the error, it should be the last line. I can do an echo
$res->getOne() and it will print 0. I can do $num = $res->getOne(); and it
will work.
Even this will work:

if( $res->getOne() == 1 ) {
die( "yes" );
} else {
die( "no" );

will print "no". But if I change it to

if( $res->getOne() == 1 ) {
return true;
} else {
return false;

it breaks. I've checked the location where the function is called.

It doesn't change a thing if I use the function in any way:
$bool = search_SearchSink::allreadyInDatabase( $location );

search_SearchSink::allreadyInDatabase( $location );

return search_SearchSink::allreadyInDatabase( $location );

if( search_SearchSink::allreadyInDatabase( $location ) ) {

It allways breaks... Is there any way to find the exact error, Get more log
info. Is this a known bug? Should I report it? If so, do I send all my

Thanks in advance,
Rutger Claes
Rutger Claes rg*@rgc.tld
Replace tld with top level domain of belgium to contact me pgp:0x3B7D6BD6
The reason computer chips are so small is computers don't eat much.

Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.