ID:               29114
 Updated by:       [EMAIL PROTECTED]
 Reported By:      john dot wellesz at firstream dot net
-Status:           Open
+Status:           Assigned
 Bug Type:         Reproducible crash
 Operating System: w2k/FreeBSD
 PHP Version:      4.3.7
 Assigned To:      pollita
 New Comment:

Don't worry, it'll get fixed in PHP4 (in all liklihood will show up in
4.3.9).  I just wanted to be sure it was what I thought it was.  I'll
have a fix applied by this weekend time permitting.


Previous Comments:
------------------------------------------------------------------------

[2004-07-14 20:40:01] john dot wellesz at firstream dot net

The problem doesn't appear with PHP 5.

Will you fix this bug in PHP 4 or must I switch to PHP 5?

------------------------------------------------------------------------

[2004-07-13 17:57:58] [EMAIL PROTECTED]

Can you try this on PHP5?  The filestat code got some heavy
reorganizing and the bug may be resolved there, but I think I can see
what's happening in the PHP4 branch.


------------------------------------------------------------------------

[2004-07-13 03:21:49] john dot wellesz at firstream dot net

Description:
------------
The bug I'm about to describe exists since at least PHP 4.1.2 and
happens on w2k and freeBSD 4.9 STABLE and probably other platforms (I'm
currently using PHP 4.3.7 and 4.3.4).

My 2 php (w2k and FreeBSD) runs as CGI, the crashes also happens if I
execute my script on command line.

Modules used is probably irrelevant, I use 2 PHP one on FreeBSD and the
other on w2k compiled on totally different way with not the same
modules... (tell me if you cant reproduce the crash, i'll provide more
info)

----------------
BUG REQUIREMENTS:

--> you must be using an error handler
--> Inside your PHP script you must call a stat() function (filemtime,
stat() etc...) over a file that DOESN'T EXIST.
--> In your error handling function*(see note 1) you must either:
   - make another stat() over a file that doesn't exist
   - or call the unlink() function on a file that DOES EXIST

(1): inside your error handling function means:
  - direcly in the error handling function 
  - in a function that is called by your error handling function

RESULT:

Once the content of the error handler has been properly executed PHP
crashes on SIGNAL 10 (BUS ERROR)

NOTE that calling other specific functions than stat() functions family
and unlink() may cause the same issue, I didn't test.



Reproduce code:
---------------
<?php
$dumyfile="foo.txt";
touch($dumyfile);

function userErrorHandler ($errno, $errmsg)
{
    global  $dumyfile;

    unlink($dumyfile); // can be replaced by stat("MUHUHAHAHA"); (same
effect)
    
    echo("<br>\n$errmsg<br>\n");
}

$old_error_handler = set_error_handler("userErrorHandler");

echo "<b>test start</b><br>\n";
stat("nonexistentfileHAHAHA");
echo "<br><b>test end</b>\n";
?>


Expected result:
----------------
---->should prints:

---------
test start

stat(): Stat failed for nonexistentfileHAHAHA (errno=2 - No such file
or directory)

test end
---------

Actual result:
--------------
---->actually prints

---------
test start

stat(): Stat failed for nonexistentfileHAHAHA (errno=2 - No such file
or directory)
---------


Under w2k a litle window appear to say that php.exe has generated
errors etc...

Under FreeBSD I can see in server logs:

pid 33566 (php), uid 27173: exited on signal 10


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=29114&edit=1

Reply via email to