Skip to content

Instantly share code, notes, and snippets.

@webprogramozo
Created December 1, 2018 14:03
Show Gist options
  • Save webprogramozo/a9637f28e63101c8acdda94de1c18f5c to your computer and use it in GitHub Desktop.
Save webprogramozo/a9637f28e63101c8acdda94de1c18f5c to your computer and use it in GitHub Desktop.
Modifying array items within debug backtrace
<?php
set_error_handler(function(){
$backtrace = debug_backtrace(0);
$backtrace[2]["args"][0][0] = 7;
$backtrace[2]["args"][0][1] = 5;
$backtrace[2]["args"][0][2] = 3;
});
$test = [4,3,2];
var_dump($test);
pbr($test);
var_dump($test);
function pbr(array &$test){
//do something with error
array_merge([], "");
$test[] = 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment