Noticed this while working on https://drupal.org/project/hookalyzer -

Exception: Drupal\Core\Template\TwigReference::serialize() must return a string or NULL in serialize()

If we're gonna extend ArrayObject in the way we do, bypassing the parent constructor, we need to implement serialize() ourselves. The same arguably goes for count(), and possibly some of those other interfaces...

Really, Just briefly looking through this code, it's not immediately apparent to me WHY we're extending ArrayObject - is it just to save on the number of methods we had to implement ourselves? if so, frown frown.

Comments

sdboyer’s picture

Title: TwigReference fails to implement serialize() » TwigReference fails to reimplement Serializable

better title...

Fabianx’s picture

Status: Active » Postponed (maintainer needs more info)

I can't reproduce this on PHP 5.3.

It might be that passing an empty constructor is making this fail on PHP 5.5.

See:

http://privatepaste.com/3e5efcc3ee

The reason why ArrayObject is extended is speed as all calls are native C methods - like isset, which is _MILES_ faster than PHP.

So no, I was not too lazy to implement all methods ;-).

star-szr’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Closed (duplicate)