ID: 23619
User updated by: ldemailly at qualys dot com
Reported By: ldemailly at qualys dot com
Status: Verified
Bug Type: Scripting Engine problem
Operating System: Linux 2.4.20
PHP Version: 4CVS-2003-05-13 (stable)
New Comment:
Ah, Thanks !
yes, I have a larger script, doing basically
the same which "works" even in a fully configured
php (and also I think even the small one might work
when using the apache module instead of the cli),
while looking at the code it shouldn't ever work
(the only way it would is that there is
another bug which corrupts somehow the structure
to make the string length of the array be != 0
or something else very weird... (as again, changing
unrelated code elsewhere would change the output...))
so I suggest that :
a) we fix the error handler for the next release
(by removing the whole if, assuming that wouldn't
cause regressions for people expecting set_error_handler ""
to unset handlers (they should use restore_handler ?))
we should also have a return at the end of the function
instead of falling through (the doc I think claims
it returns the previous handler, I don't think it does?)
b) keep the broken version around to get to the root
cause / find the other bug, probably nasty, which
make it work with some other config/script lengths,...
my 2 cents
thx
Previous Comments:
------------------------------------------------------------------------
[2003-05-15 20:10:26] sniper@php.net
Okay, I'm getting the same output now as you do,
when I configured a plain PHP (with only --disable-all).
And it seems your last patch is not bogus after all. :)
Now I need to figure out why it DID work for me even
without your patch..
------------------------------------------------------------------------
[2003-05-15 19:30:06] ldemailly at qualys dot com
Did you actually TRY ? I did (again) :
[dl@dl-pc php-4.3.2RC3]$ ./configure && make && sapi/cli/php ~/foo.php
...build output...
Build complete.
(It is safe to ignore warnings about tmpnam).
set_error_handler done retcode=1
Notice: Undefined variable: foo in /home/dl/foo.php on line 12
which is NOT WORKING
(given that the code hasn't changed and still remove
the handler when the string length is 0, it is not
surprising it does not work... did you actually even
glanced at the code and patch ??)
PLEASE actually TRY the command line above (after saving
the repro script above into foo.php)
PLEASE try to explain (to yourself and to me) what
happens in that if (Z_STRLEN_PP(error_handler)==0)
when error_handler is an array like in the test script...
(for bonus points: find what other bug/corruption cause
that code to actually work in some cases...)
If it works for you, you have the lucky other corruption/
bug that make it work *sometimes*;
What OS/configuration exactly do you use if you
do see "ERROR HANDLER CALLED (EXPECTED)" ?
I use redhat linux 9.0 (same on 7.2 actually)
------------------------------------------------------------------------
[2003-05-15 19:02:45] waboring at qualys dot com
The patch is NOT bogus. As I clearly explained earlier in the most
plain english I can say, that test tests for a STRING. It is NOT a
string. it is an ARRAY. It will fall through 100% of the time. This
has to be fixed. The code is totally broken.
------------------------------------------------------------------------
[2003-05-15 18:41:36] sniper@php.net
You should try this package:
http://downloads.php.net/jani/php-4.3.2RC3.tar.gz
And DO NOT run buildconf for it!!
------------------------------------------------------------------------
[2003-05-15 18:32:30] sniper@php.net
That patch is also bogus.
And as I said already: It works fine with latest _stable_ CVS. check
what php -v outputs, it's propably not the same version I'm trying this
with.
------------------------------------------------------------------------
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/23619--
Edit this bug report at http://bugs.php.net/?id=23619&edit=1