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.
If you try to instantiate a EntityDrupalWrapper object without pass the $info array an Unsupported operand types error occurred.
Steps to repeat:
$wrapper = new EntityDrupalWrapper('node');
Expected Results:
Instantiate the object
Actual Results:
PHP Fatal error: Unsupported operand types in .../sites/all/modules/entity/includes/entity.wrapper.inc on line 33
In attachment a patch.
Comment | File | Size | Author |
---|---|---|---|
entity.wrapper.inc_.patch | 1.02 KB | lucor | |
Comments
Comment #1
fagothanks, the references are indeed left-over and not needed any more - that did not fix the problem though. The problem was wrong default for $info being NULL instead of array(). I fixed both by aligning all constructors to the function signature of entity_metadata_wrapper(). Anyway, using the factory function entity_metadata_wrapper() is the preferred way to instantiating wrapper objects.