Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
sdboyer CreditAttribution: sdboyer commentedbetter title...
Comment #2
Fabianx CreditAttribution: Fabianx commentedI 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 ;-).
Comment #3
star-szrThis is no longer relevant now that #2114563: Remove TwigReference with the help of 'without' filter replacing 'show'/'hide' functions. is in.