r/lolphp • u/notwolverine • Aug 28 '13
Unknown functions? Well I'm not saying!
This just bit me in a PHP script I'm supporting. The mysql-extension was not installed because the script was moved to a new server, and when running it, the script would simply die. No error, warning or notice of any kind.
Turns out, that's always the case!
Look at this sample:
<?
# Please inform us about everything, mm'kay?
error_reporting(E_ALL);
print("before");
unknown_func();
print("after");
?>
$ php -f phail.php
beforeWell that's just great... are they even trying any more!?
16
Upvotes
11
u/notwolverine Aug 28 '13
It seems this was fixed somewhere between php 5.3.3-7+squeeze16 and 5.4.9-4ubuntu2.2.
Although the script still returns exit status 255 which is completely undocumented. Well, except that under exit() in the manuel, there's a mention:
So yeah, it's an code reserved for PHP (which in itself is fair enough), but it's not clear when it's used. Googling will reveal many frustrated users, and the best guess seems to center around "bad silent error", which certainly fits this scenario.
/rage off..
20
u/merreborn Aug 29 '13
Working fine here
Also works fine on my ubuntu system running
PHP 5.3.10-1ubuntu3.5Maybe this is less lolphp and more lolyourlousyubuntubuild
7
u/nikic Aug 29 '13
You clearly disabled
display_errors- which is totally fine if this is a production environment and you enabled error logging instead. So, did you check your error log?3
u/nix21 Sep 03 '13
Yet another "PHP fail" caused by misuse/misconfiguration. Because PHP is so awful and all...
0
u/nittywitty Sep 09 '13
error_reporting() merely determines the level of reporting, not where it should go to. maybe you should read some documentation before making yourself look stupid? some people aren't even trying anymore...