Skip to content

Instantly share code, notes, and snippets.

@clemherreman
Created May 6, 2011 14:30
Show Gist options
  • Save clemherreman/959047 to your computer and use it in GitHub Desktop.
Save clemherreman/959047 to your computer and use it in GitHub Desktop.
PHP WTF of the day #2
<?php
function foo()
{
return bar;
}
echo foo(); // outputs 'bar'. And no error/exception, only a small warning.
@ubermuda
Copy link

ubermuda commented May 6, 2011

php> function foo() { return bar; }

php> foo();
PHP Notice:  Use of undefined constant bar - assumed 'bar' in /usr/local/lib/python2.6/dist-packages/phpsh/phpsh.php(578) : eval()'d code on line 1

@clemherreman
Copy link
Author

Edited. My bad, error_reporting was messed up, as I tested on a stage/prod server.
But still, that you raise a WtfDudeSyntaxeException or a fatal error. Am I the only one to think that ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment