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


PHP Catchable fatal error: Object of class ClassDefinition could not be converted to string Concrete.php

在 pimcore 版本: 3.1.1 (内部版本: 3543) 我在 php 中收到以下错误.log但在 pimcore 调试中没有错误.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);

所以这似乎是由于错误的错误处理。

该错误 (https://github.com/pimcore/pimcore/issues/422) 现已解决,并计划在 Pimcore 4.0.0 中发布

为了研究,我使用了error_logget_classgettype 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_class($class)