Project

General

Profile

Actions

Bug #17760

closed

Unserialized objects not debugged properly

Added by Francois Suter about 17 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2007-11-06
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.2
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

This is related to bug #17685 "t3lib_div::view_array() can not show objects". The bug fix proposed by Michael is insufficient with PHP 5.2.x.

In short, when an object is unserialized and its class definition has not been included, PHP makes it into an Incomplete Class object. When such an object is passed to is_object() the result is false rather than true.

So it fails the is_object() test and is cast to string by the t3lib_div::view_array() resulting in a fatal error. Although PHP says that this error is catchable, I couldn't manage to catch it using a try/catch construct. So I added additional tests using gettype(), altghough use of the latter is not recommended.

I also introduced a test to check for the existence of the __toString method, which makes it possible to use the object's proper output if present, rather than just outputting "Object" and the result of get_class().

While I was at it, I replaced the while/each construct by a foreach loop.
(issue imported from #M6663)


Files

bug6663.patch (2.48 KB) bug6663.patch Administrator Admin, 2007-11-06 23:19
bug6663-v2.patch (2.46 KB) bug6663-v2.patch Administrator Admin, 2007-11-07 22:59
Actions

Also available in: Atom PDF