# Intermittent problem: can't write to properties of $this

- Thread: https://externals.io/message/49954
- Original archive: https://news-web.php.net/php.internals/49954
- Started by Tim Steiner on 2010-10-21T23:04:21+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #49954 — Tim Steiner — 2010-10-21T23:04:21+00:00

URL: https://externals.io/message/49954#49954

Greetings,

I'm currently trying to troubleshoot an intermittent problem on one of 
our servers.  After some time of running just fine (usually a couple of 
hours),  scripts will start throwing the warning "Attempt to assign 
property of non-object" when writing to a property of the $this object. 
  Once it starts, it seems to keep happening every few requests (with 
other requests running as expected).  The poster at 
http://www.zfforums.com/zend-framework-components-13/core-infrastructure-19/warning-attempt-assign-property-non-object-zend_config-5469.html 
seems to be having the same issue.

I've traced the warning output to line 576 of Zend/zend_execute.c, which 
means that something is happening to the write_property of the object. 
At this point, I don't have enough knowledge of the internals to 
continue tracking this bug down.  Any help would be appreciated.

Thanks!
Tim Steiner <tsteiner2@unl.edu>


Relevant Server Specs:
Red Hat Enterprise Linux 4
Apache 2.0.52
PHP 5.3.3 compiled from source with configure line at 
http://pastebin.unl.edu/1487

---

## #49957 — Nathan Nobbe — 2010-10-22T16:25:25+00:00

URL: https://externals.io/message/49954#49957 · In reply to: #49954

> Greetings,
>
> I'm currently trying to troubleshoot an intermittent problem on one of our
> servers.  After some time of running just fine (usually a couple of hours),
>  scripts will start throwing the warning "Attempt to assign property of
> non-object" when writing to a property of the $this object.  Once it starts,
> it seems to keep happening every few requests (with other requests running
> as expected).  The poster at
> http://www.zfforums.com/zend-framework-components-13/core-infrastructure-19/warning-attempt-assign-property-non-object-zend_config-5469.htmlseems to be having the same issue.
>
> I've traced the warning output to line 576 of Zend/zend_execute.c, which
> means that something is happening to the write_property of the object. At
> this point, I don't have enough knowledge of the internals to continue
> tracking this bug down.  Any help would be appreciated.
>

Tim,

this sounds much more like a typical userspace issue than an internals one.
 You might have better luck getting help if you start out on the php-general
list.

-nathan

---

## #49962 — Richard Lynch — 2010-10-23T10:31:31+00:00

URL: https://externals.io/message/49954#49962 · In reply to: #49954

> Greetings,
>
> I'm currently trying to troubleshoot an intermittent problem on one of
> our servers.  After some time of running just fine (usually a couple
> of
> hours),  scripts will start throwing the warning "Attempt to assign
> property of non-object" when writing to a property of the $this
> object.
>   Once it starts, it seems to keep happening every few requests (with
> other requests running as expected).  The poster at
> http://www.zfforums.com/zend-framework-components-13/core-infrastructure-19/warning-attempt-assign-property-non-object-zend_config-5469.html
> seems to be having the same issue.
>
> I've traced the warning output to line 576 of Zend/zend_execute.c,
> which
> means that something is happening to the write_property of the object.
> At this point, I don't have enough knowledge of the internals to
> continue tracking this bug down.  Any help would be appreciated.

Try dumping out the value of $this or your variable or the moral
equivalent in C, and see exactly what it *IS* that you are trying to
set a property on...

Once you figure that out, you can often realize how you managed to get
in this state of existence, or at least start backtracking to see how
that value got in there in the first place.

It probably is in Userland code, with something that you think should
"persist" but actually doesn't...

A resource, session data, an object that got destructed and is now
GC-ed, etc are the usual suspects.

In particular, if you have any register_shutdown_function or
destructors on your classes, note that PHP does *NOT* guarantee any
particular order of destruction, nor even consistency of the same from
request to request.

Once your server gets busy, GC may be kicking in more, and objects you
think are still "valid" in a destructor probably aren't -- they're
halfway torn apart by PHP as it shuts down the script.

PS
Don't try to use echo in a destructor nor shutdown function.
http://php.net/error_log is your friend.


-- 
brain cancer update:
http://richardlynch.blogspot.com/search/label/brain%20tumor
Donate:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FS9NLTNEEKWBE
