Skip to content

Instantly share code, notes, and snippets.

@hashar
Created October 29, 2013 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hashar/7215603 to your computer and use it in GitHub Desktop.
Save hashar/7215603 to your computer and use it in GitHub Desktop.
are function args in exceptions traced passed by reference?
<?php
# Example for https://gerrit.wikimedia.org/r/#/c/92334/
function blame($a) {
throw new Exception();
}
try {
blame( array('foobar') );
} catch (Exception $e) {
var_dump( $e->getTrace() );
}
__HALT_COMPILER(); ?>
Above script yield:
$ php foo.php
array(1) {
[0]=>
array(4) {
["file"]=>
string(54) "/Users/amusso/projects/mediawiki/core/includes/foo.php"
["line"]=>
int(7)
["function"]=>
string(5) "blame"
["args"]=>
array(1) {
[0]=>
array(1) {
[0]=>
string(6) "foobar"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment