Cannot access empty property
If you see something like this:
Fatal error: Cannot access empty property in /home/user/public_html/dev/sites/default/modules
/newsletter/newsletter.module on line 163
It probably means you are using $node->field syntax on a variable that doesn't exist, or has a zero value– in other words, an empty property.
And the error is probably being thrown in line 174 or something, because the server doesn't always count lines the same as your text editor.
As for where to fix the error, look in your module's implementation of hook_form to make sure you are naming your form field the same as the $node->field variable you were trying to save.
That will fix future problems. To fix your current node, edit the database directly or delete that node and create it so all the information saves this time.
Please note – especially if you're a client, or considering becoming one – that all of this is based on abstract thought and theorizing, and could not possibly be related to us making the same mistake ourselves.
If you see something like this:
Fatal error: Cannot access empty property in /home/user/public_html/dev/sites/default/modules
/newsletter/newsletter.module on line 163
It probably means you are using $node->field syntax on a variable that doesn't exist, or has a zero value– in other words, an empty property.
And the error is probably being thrown in line 174 or something, because the server doesn't always count lines the same as your text editor.
As for where to fix the error, look in your module's implementation of hook_form to make sure you are naming your form field the same as the $node->field variable you were trying to save.
That will fix future problems. To fix your current node, edit the database directly or delete that node and create it so all the information saves this time.
Please note – especially if you're a client, or considering becoming one – that all of this is based on abstract thought and theorizing, and could not possibly be related to us making the same mistake ourselves.
Comments
One more thing...
Make sure you don't do something really stupid, like throw in an inappropriate dollar sign:
$node->$field
instead of$node->field
This must be why the programmers at other firms drink coffee.
Thanks - dollar sign was it!
Thanks - dollar sign was it!
:))
Me to: dollar sign was it! Thanks for post :)
Thanks: Cannot access empty property is fixed now.
Thanks Benjamin Melançon!
i search this on alot of sites but no one give the answer you provide. it was a small mistake of $ sign. Thanks
Damn dollar sign
Yup, that was it here too! Very surprising - the site worked for years with the $node->$field syntax mistake in PHP 4 before I switched it to PHP 5.
Post new comment