If you are looking for the epic motorcycle journey blog that I've written, please see the Miles By Motorcycle site I put together. 
  • (for PHP developers)PHP 5 Bug - losing $this var.
    01/12/2005 6:34PM
    This is additional info intended for the PHP developers.

    This has been submitted as bug: http://bugs.php.net/31525

    This may be related to the PHP 4.3.10 bug as it's occurring in the same general area as this bug. I've focused on this bug in PHP 5 because it's easily reproduced. The demonstrator file is located at:

    http://www.yml.com/uploaded_files/php_5_bug.tar

    Redhat 9, Apache 1.3.33, PHP 5.0.3 with the recommended php.ini with all warnings and messages turned on, using Apache 1.3.33 and running without PHP4 compatibility mode turned on will cause an object reference to get dropped after the object is constructed by calling a method that returns a reference to '$this'.

    Debug messages are included and the code is commented. Search for "PHP 5 BUG" in the code. See getAttributeValue() in fv_baseWidget, varLookupsATTRS() in fv_baseComponent.

    If you have any questions please use the Contact_Yermo form on the left.

    Output from test.php is:

    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