ID:               31525
 Updated by:       [EMAIL PROTECTED]
 Reported By:      yml at yml dot com
-Status:           Open
+Status:           Feedback
-Bug Type:         Scripting Engine problem
+Bug Type:         Zend Engine 2 problem
 Operating System: Linux (redhat 9)
 PHP Version:      5.0.3
 New Comment:

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 possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.




Previous Comments:
------------------------------------------------------------------------

[2005-01-13 00:49:01] yml at yml dot com

Description:
------------
PHP 5.0.3 using the recommended php.ini with all warnings and errors
turned on. RedHat 9. Apache 1.3.33. Config:

./configure  --with-apxs=/usr/local/apache/bin/apxs
--with-mysql=/usr/local/mysql --prefix=/usr/local/php_5.0.3
--with-mcrypt=/usr/local/lib --with-gd --with-jpeg-dir=/usr/lib
--with-zlib-dir=/usr/lib --with-png-dir=/usr/lib --enable-debug
--enable-dmalloc --disable-inline-optimization

This may be related to bug http://bugs.php.net/31508. Under PHP 4.3.10
the section of code in question causes a busy loop. Under PHP 5 it
causes an object to be dropped. 

More info, sample code and a sample run can be found at:

http://www.yml.com/homepage.html?COMP=clog_list&cmd=detail&cs_clog_entries_ref=149

I have a test case that is a radically reduced version of a large body
of code. fv_baseComponent extends fv_baseWidget which extends fvTree. I
create a minimal fv_baseComponent. 

It calls a method in the fv_baseWidget base class called
getAttributeValue(). 

getAttributeValue calls getParentControl() which is present in both
fv_baseWidget and fv_baseComponent. 

In fv_baseComponent getParentControl just returns "$this".

The returned value is then used to call a method in the
fv_baseComponent class.

All this happens in the constructor for fv_baseComponent (which I
suspect is the cause of the problem).

Once the getAttributeValue() is called in the fv_baseComponent
constructor, '$this' is no longer a valid object. 

If I turn on PHP 4 compatibility mode it seems to work. The code works
under PHP 4. (however in the full application the same code seems to
have problems under PHP 4.3.10 causing a busy loop).

If you need to contact me from an email address other than [EMAIL PROTECTED]
please use the form at

http://www.yml.com/Contact_Yermo.html 

otherwise I will miss your email in all the spam I get.


Reproduce code:
---------------
See the download available at:

http://www.yml.com/homepage.html?COMP=clog_list&cmd=detail&cs_clog_entries_ref=149

It contains base_widget.php, base_component.php, fvTree.php and
test.php.

The relevant snippet from test.php contains:

$currentComponent =& new fv_baseComponent( $nullVar, $nullVar,
$nullVar, "static", $nullVar );

ddt( "After creating fv_baseComponent - currentComponent type is '" .
gettype( $currentComponent ) . "'");

$currentComponent->getAttributeValue( "hello" );

// at this point $this is destroyed. Is "unknown type".

ddt( "after getAttributeValue() call - currentComponent type is '" .
gettype( $currentComponent ) . "'" );


// this method call will fail.

$currentComponent->setName( "test" );

ddt( "The end - currentComponent type is '" . gettype(
$currentComponent ) . "'");


Expected result:
----------------
PHP should not produce any errors when the above is run.

Actual result:
--------------
test.php:30 - before class includes

test.php:30 - Creating fv_staticCtrl instance

test.php:30 - fv_baseComponent Constructor: Before getAttributeValue()
call. Type of 'this' is 'object'

test.php:30 - fv_basewidget::getAttributeValue() - Object id #1 is
'object'

test.php:30 - fv_baseWidget::getAttributeValue() - value 'Hello from
varLookupATTRS' - type of parentComponent object is 'object'

test.php:30 - fv_baseComponent Constructor: after getAttributeValue()
call. Type of 'this' is 'object'
Warning: Attempt to assign property of non-object in
/usr/local2/WWW/mobie.yml.com/mobie/admin_ui/tests/php_5_test/base_component.php
on line 125

test.php:30 - After creating fv_baseComponent - currentComponent type
is 'object'

test.php:30 - fv_basewidget::getAttributeValue() - Object id #1 is
'object'

test.php:30 - fv_baseWidget::getAttributeValue() - value 'Hello from
varLookupATTRS' - type of parentComponent object is 'object'

test.php:30 - after getAttributeValue() call - currentComponent type is
'unknown type'
Fatal error: Call to a member function setName() on a non-object in
/usr/local2/WWW/mobie.yml.com/mobie/admin_ui/tests/php_5_test/test.php
on line 59


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=31525&edit=1

Reply via email to