Bug #41046

Debugger crashes when coming upon Closure variable

Added by Adrian Föder almost 3 years ago. Updated almost 3 years ago.

Status:Resolved Start date:2012-09-18
Priority:Must have Due date:
Assigned To:Adrian Föder % Done:

100%

Category:Error
Target version:TYPO3 Flow Base Distribution - 2.0 beta 1
PHP Version:5.4 Complexity:easy
Has patch:Yes Affected Flow version:Git 1.2 (master)

Description

consider just

1\TYPO3\FLOW3\var_dump(function(){});
2
3// or 
4
5TYPO3\FLOW3\Error\Debugger::renderDump(function(){}, 0);

This gives the error

Closure object cannot have properties

because of this line:

1if ($object instanceof \TYPO3\FLOW3\Object\Proxy\ProxyInterface || (isset($object->__IS_PROXY__) && $object->__IS_PROXY__ === TRUE)) {

in Debugger.php on line 220 ($object is the closure in this case, and even trying to access the IS_PROXY thing leads to the exception.

I'm already working on a patch.

Associated revisions

Revision 15d38605
Added by Adrian Föder almost 3 years ago

[BUGFIX] Debugger now respects possible occurence of Closures

A trial isset() call for a property of a Closure resulted in a PHP
error saying "Closure objects cannot have properties". To avoid this,
the isset() statement has been replaced with a property_exists().

This is considered slower than isset(), like claimed in a User Contributed
Note [1], but obviously the only workaround for these cases [2]. And speed
is not an issue when the debugger is used…

[1] http://www.php.net/manual/en/function.property-exists.php#97538
[2] https://bugs.php.net/bug.php?id=50146

Change-Id: I6796c92f535bc877187eb10a830e294119362a62
Fixes: #41046
Releases: 1.2

History

#1 Updated by Gerrit Code Review almost 3 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/14708

#2 Updated by Gerrit Code Review almost 3 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/14708

#3 Updated by Adrian Föder almost 3 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF