Edit report at https://bugs.php.net/bug.php?id=60978&edit=1
ID: 60978 Comment by: php-dev at zerocue dot com Reported by: the...@php.net Summary: exit code incorrect Status: Open Type: Bug Package: Scripting Engine problem Operating System: Windows PHP Version: 5.4.0RC7 Block user comment: N Private report: N New Comment: Alright, in 5.3.10@php_cli:1023 the call to zend_eval_string_ex() never returned after a zend_bailout(), if it had this bug would have been present there because zend_bailout always returns FAILURE even in non-failure cases. In 5.4 and trunk, the zend_eval_string_ex() does return and hits the exit_status=254 line. The proper fix would be to have zend_bailout not return FAILURE unless it did fail but this is a much larger change. In this case the patch simply ignores the return state of the zend_eval_string_ex() and always returns the EG(exit_status) value. Previous Comments: ------------------------------------------------------------------------ [2012-02-04 20:00:43] php-dev at zerocue dot com This does not occur when executing a script file, only through -r. ------------------------------------------------------------------------ [2012-02-04 19:59:37] php-dev at zerocue dot com Actually my last post has nothing to do with it, mis-read the code. I don't see where the problem is, the executor_globals.exit_status is being set to two properly and the LONGJMP(bailout) still has the right exit_status value in the executor. I did confirm that this was fine in 5.3.10 but not in 5.4 or trunk. ------------------------------------------------------------------------ [2012-02-04 19:44:24] php-dev at zerocue dot com Looks like this (on my system) is related to ZEND_VM_SPEC not being defined. zend_vm_def.h: 4567 #if !defined(ZEND_VM_SPEC) || (OP1_TYPE != IS_UNUSED) Results in all variants of ZEND_EXIT to become: #if 0 || ... There are only two references to ZEND_VM_SPEC in the code base, neither are defines. What does this control, where should it be defined? ------------------------------------------------------------------------ [2012-02-04 17:56:08] the...@php.net Same goes for die(). ------------------------------------------------------------------------ [2012-02-04 17:54:03] the...@php.net Description: ------------ Calling exit with an int arg will not lead to PHP exiting with this exitcode. Test script: --------------- $ php -r 'exit(2);' ; echo $? Expected result: ---------------- 2 Actual result: -------------- 254 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60978&edit=1