Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exit code corruption #2

Closed
remicollet opened this issue Apr 3, 2014 · 5 comments
Closed

exit code corruption #2

remicollet opened this issue Apr 3, 2014 · 5 comments

Comments

@remicollet
Copy link
Collaborator

Noticed running "phpunit" on Horde_Service_Weather library.

 + phpunit --include-path=/builddir/build/BUILD/php-horde-Horde-Service-Weather-2.1.0/Horde_Service_Weather-2.1.0/lib -d date.timezone=UTC .
 PHPUnit 3.7.32 by Sebastian Bergmann.
 Configuration read from /builddir/build/BUILD/php-horde-Horde-Service-Weather-2.1.0/Horde_Service_Weather-2.1.0/test/Horde/Service/Weather/phpunit.xml
 FF....
 Time: 34 ms, Memory: 5.75Mb
 There were 2 failures:
 1) Horde_Service_Weather_WundergroundTest::testCurrentConditions
 Failed asserting that two strings are equal.
 --- Expected
 +++ Actual
 @@ @@
 -'2011-11-27 23:10:25'
 +'2011-11-28 04:10:25'
 /builddir/build/BUILD/php-horde-Horde-Service-Weather-2.1.0/Horde_Service_Weather-2.1.0/test/Horde/Service/Weather/WundergroundTest.php:51
 2) Horde_Service_Weather_WundergroundTest::testGetStation
 Failed asserting that two strings are equal.
 --- Expected
 +++ Actual
 @@ @@
 -'2011-11-27 06:48:00'
 +'2011-11-28 06:48:00'
 /builddir/build/BUILD/php-horde-Horde-Service-Weather-2.1.0/Horde_Service_Weather-2.1.0/test/Horde/Service/Weather/WundergroundTest.php:60
 FAILURES!
 Tests: 6, Assertions: 78, Failures: 2.
 + exit 0

PHP exit code should not 0
Without uopz, exit code is correct (reports failure)

Reproduced with php 5.4, 5.5 and 5.6, with uopz 2.0.2 and 2.0.3

Trivial test return 2 as expected.

 $ php -r 'exit(2);' ; echo $?
 2
@krakjoe
Copy link
Owner

krakjoe commented Apr 3, 2014

overloading should be disabled where it is not used, uopz.overloads config option was introduced, should we set 0 by default ?

@remicollet
Copy link
Collaborator Author

Yes 0 seems a safer value, as this really change php behavior.

Perhaps even an option for "exit" (or 1 for each opcode...)

BTW, I don't find any documentation about the ini options.
What about a uopz.ini in the package, with comment about each one (as the php.ini, in php-src) ?

@krakjoe
Copy link
Owner

krakjoe commented Apr 3, 2014

I'll be updating manual ... hard time keeping up ... it will appear ...

Will distribute ini with package too, good call ;)

@krakjoe
Copy link
Owner

krakjoe commented Apr 5, 2014

fixed in last releae, default now uopz.overloads=0, ta ;)

@alexjay
Copy link

alexjay commented Feb 11, 2015

I expiriencing the same trouble with uopz 2.0.6. Exit code spicified in exit() is missing.

How to reproduce:

  1. enable uopz
    zend_extension=uopz.so
  2. create test.php file with exit
  3. run it
    php test.php; echo $?

expected is 42
actual is 0

Exit code will be 0 regardless the value that was specified in the script.
I've tried to remove php_uopz_overload_exit at zend extension initialization and recomplie the uopz extension... and it helped. It seems that the default exit() uopz handler misses its exit code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants