最近更新的PHP 5.4从5.3崩溃时使用变量等于条件快捷方式

时间:2022-10-06 08:03:42

I am using Apache 2.4 with PHP 5.4.

我正在使用Apache 2.4和PHP 5.4。

I am executing the following:

我正在执行以下操作:

# retrieve caller name
$calledby = debug_backtrace(); print_r($calledby);
$caller = (strlen($calledby[1]['class'])) ? $calledby[1]['class'] : $calledby[0]['class'];
# arguments are required
if (!func_num_args()) { return; }
# fill variables with argument contents if exists
$variables = (func_num_args() == 0) ? NULL : (is_array(func_get_arg(0)) ? func_get_arg(0) : NULL);

from within a private method of a class.

来自一个类的私有方法。

If I comment out the $caller = and $variables = lines then it works.

如果我注释掉$ caller =和$ variables =行,那么它可以工作。

If I change my code to the following it also works (AS DEFINED)

如果我将我的代码更改为以下代码也可以(AS DEFINED)

if (strlen($calledby[1]['class']))  $caller = $calledby[1]['class'];
else                                $caller = $calledby[0]['class'];

Should I place a bug report or am I doing something wrong with a new 5.4 syntax quirk?

我应该发布错误报告还是我在使用新的5.4语法怪癖时做错了什么?

Thanks In Advance!

提前致谢!

[UPDATE] I executed the file using the CLI and the script produced the desired result.

[更新]我使用CLI执行文件,脚本生成了所需的结果。

1 个解决方案

#1


0  

I have try with php 5.4 config and have no problem You should see the apache / php log

我尝试使用php 5.4配置并没有问题你应该看到apache / php日志

#1


0  

I have try with php 5.4 config and have no problem You should see the apache / php log

我尝试使用php 5.4配置并没有问题你应该看到apache / php日志