Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/259.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP可捕获致命错误:类ClassDefinition的对象无法转换为字符串Concrete.PHP_Php_Pimcore - Fatal编程技术网

PHP可捕获致命错误:类ClassDefinition的对象无法转换为字符串Concrete.PHP

PHP可捕获致命错误:类ClassDefinition的对象无法转换为字符串Concrete.PHP,php,pimcore,Php,Pimcore,在pimcore版本:3.1.1(Build:3543)中,我在php.log中得到以下错误,但在pimcore debug.log中没有错误 [29-Jan-2016 16:28:13 Europe/Berlin] PHP Catchable fatal error: Object of class Pimcore\Model\Object\ClassDefinition could not be converted to string in /opt/bitnami/apps/pimcor

在pimcore版本:3.1.1(Build:3543)中,我在php.log中得到以下错误,但在pimcore debug.log中没有错误

[29-Jan-2016 16:28:13 Europe/Berlin] PHP Catchable fatal error:  Object of class Pimcore\Model\Object\ClassDefinition could not be converted to string in /opt/bitnami/apps/pimcore/htdocs/pimcore/models/Webservice/Data/Object/Concrete.php on line 104
我从一个自定义Web服务获得HTTP 500内部服务器错误响应

我如何调查它?这个错误已经有解决方案了吗

生成错误的pimcore源代码行(Concrete.php)如下所示:

throw new \Exception("No element [ " . $element->name . " ] of type [ " . $element->type . " ] found in class definition " . $class);
这似乎是由于错误处理造成的。

该错误()现已解决,并计划在Pimcore 4.0.0中发布

为了进行调查,我使用了
error\u log
get\u class
gettype
PHP函数:

error_log(" found in class definition [ " . get_class($class));
error_log("variable 'class' type = " . gettype($class));
error_log("'class->name' = " . $class->name);

感谢@fusion3k帮助我们识别错误代码行的正确部分以及语法
get\u class($class)

我们需要一些代码来帮助…您尝试什么时出错?需要一些代码请解决此问题的方法是不要尝试将对象用作字符串。我的问题不仅涉及如何解决此错误(这似乎是Pimcore产品在处理某些错误数据/配置时遇到的问题),还涉及如何对其进行调查。此错误与将对象转换为字符串有关(可能是一个没有方法的对象,
\u toString()
),因此,在错误处理中,
$class
是什么?您使用
$class
作为字符串,但它可能是一个对象。在这种情况下,您可以尝试使用
get\u class($class)