- Notifications
You must be signed in to change notification settings - Fork116
Open
Labels
Milestone
Description
Strange behavior ofdebug_backtrace() detected, seems that it was changed inPHP 7 >, so thatadd_action() will not work in the same way. The counter$shift is now one level less. An example to reproduce it:
<?phpregister_plugin('add_action_test','add_action_test','0.1','J. Ehret','http://ehret-studio.com','Testing strange behavior of add_action()','','');add_action('index-post-dataindex','add_action_test');functionadd_action_test() {include__DIR__.'/A.php';$a =newA;$a->fireFoo();}
A.php looks as follows:
<?phpclass A {functionfireFoo() {add_action('theme-header',function() {echo'here in foo() ...'; }); }}
Addingversion_compare() intoadd_action() could solve that issue:
...$shift=count($bt) -4;if(version_compare(PHP_VERSION,'7.0.0','>=')) {$shift--;}...