Created
October 29, 2013 14:22
-
-
Save hashar/7215603 to your computer and use it in GitHub Desktop.
are function args in exceptions traced passed by reference?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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