php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52083 Fatal Error "Call to a member function * on a non-object" occurring randomly
Submitted: 2010-06-15 02:01 UTC Modified: 2011-01-30 06:02 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: darylp at qualtrics dot com Assigned: stas
Status: Closed Package: *General Issues
PHP Version: 5.3.2 OS: CentOS 5.4
Private report: No CVE-ID:
 [2010-06-15 02:01 UTC] darylp at qualtrics dot com
Description:
------------
We have several servers running PHP 5.3.2 on CentOS 5.4 and a few on PHP 5.2.9 
on FreeBSD. Reviewing our error logs, I have noticed a pattern of fatal errors: 
"Call to a member function * on a non-object". This occurs usually daily, and 
sometimes several times a day. When it occurs, it occurs on a single server, 
several times over a 2-3 minute span, and across different PHP sessions and 
occurs in different functions in different classes. This issue does not seem to 
coincide with high traffic or with time of day. This issue has occurred on each 
of the webservers running CentOS, although I have noticed it occurring over 
several releases of PHP. There are no other fatal PHP errors that occur 
concurrently, nor are there any other external processes that are occurring 
concurrently. 

The only thing I can suspect is PHP garbage collection improperly deleting 
objects, although debug_zval_dump() shows the object correctly constructed and 
never destructed prior to calling a member function.

After seeing this error occur on several functions in various classes, I picked 
one and added code to check is_object() and email me the results of 
debug_zval_dump() when false. Although is_object() returns false, the dump of 
the object shows the following:

if (!is_object($this->flow_info))
{
debug_zval_dump($this);
}

output:

object(SEFlow)#13 (10) refcount(5){
...
["flow_info"]=>
  object(FlowInfo)#14 (4) refcount(1){
...

Calling a function:
$this->flow_info->getElementsUnderBranch(__MAIN_BRANCH, false);

results in the fatal error: 
Call to a member function getElementsUnderBranch() on a non-object in 
/var/www/Qualtrics/Qualtrics/SurveyEngine/Flow/Flow.php on line 186


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-15 16:04 UTC] pierrick@php.net
-Status: Open +Status: Feedback
 [2010-06-15 16:04 UTC] pierrick@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2010-06-22 23:27 UTC] darylp at qualtrics dot com
-Status: Feedback +Status: Open
 [2010-06-22 23:27 UTC] darylp at qualtrics dot com
Unfortunately, this issue is occurring only in our production environment and is 
occurring sporadically. It is happening in 2-5 minute bursts on a single server 
and across different functions. For most of the other 24 hours those scripts are 
running, there are no problems. We have not been able to correlate the times the 
error occurs with any events on our servers or traffic load. We will continue to 
attempt to reliably reproduce this issue and submit code when available. Are there 
any other suggestions on testing to be able to reproduce this?
 [2010-09-11 18:04 UTC] felipe@php.net
-Status: Open +Status: Feedback
 [2010-09-11 18:04 UTC] felipe@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2010-09-13 20:06 UTC] darylp at qualtrics dot com
We attempted downgrading one of our production webservers to PHP 5.2.14 3-4 weeks 
ago and haven't seen these errors since on that server. We continue to see the 
issue with our other webservers running PHP 5.3.2. I think that's a good 
indication that the problem stems from the version upgrade. We will be trying the 
latest version on one of our servers as suggested.
 [2010-10-07 22:54 UTC] darylp at qualtrics dot com
-Status: Feedback +Status: Open
 [2010-10-07 22:54 UTC] darylp at qualtrics dot com
The development snapshot provided has been in place for two weeks on one of our 
production servers and we have not seen these errors since. We are hesitant to put 
a development snapshot on all of our production machines however. Is there a 
release schedule for PHP 5.3.4, and will the changes that fixed this bug in the 
development snapshot be released with it?
 [2011-01-30 06:02 UTC] stas@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: stas
 [2011-01-30 06:02 UTC] stas@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

So marking as fixed then.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 17 21:01:56 2014 UTC