ID: 27836
User updated by: Robin at RHarmsen dot nl
Reported By: Robin at RHarmsen dot nl
-Status: Feedback
+Status: Open
Bug Type: Zend Engine 2 problem
Operating System: Windows XP
PHP Version: 5.0.0RC1
New Comment:
I made a version withoud a DB...
It seems that when I set a property of a class in the constructor it
suddenly disappears
with this code I get the following error:
Fatal error: Call to a member function query() on a non-object in
bugcode.php on line 24
<?php
class A
{
var $queryCount;
function A() {
$this->queryCount = 0;
}
function query() {
$this->queryCount = $this->queryCount + 1;
}
}
class B
{
var $a;
var $pageID;
function B(&$a,$pageID = 1) {
$this->a =& $a;
$this->pageID = $pageID;
}
function showB() {
$result = $this->a->query();
if(is_null($this->a))
echo "a = NULL<br/>";
else
echo "a = $this->a;<br/>";
echo "pageID = $this->pageID<br?>";
}
}
$a = new A();
$b = new B($a);
$b->showB();
?>
Previous Comments:
------------------------------------------------------------------------
[2004-04-02 08:35:37] [EMAIL PROTECTED]
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 avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2004-04-02 08:06:31] Robin at RHarmsen dot nl
Description:
------------
When I turn on zend Engine1 Compatibility mode my code stops working
(It worked perfect on PHP4 and PHP5 withoud the compatibility mode)
PHP.ini diffreances:
zend.ze1_compatibility_mode = On (off when error doesn't occure)
allow_call_time_pass_reference = Off
error_reporting = E_ALL
register_long_arrays = Off
register_argc_argv = Off
extension=php_mysql.dll
configure line (according to phpinfo())
Configure Command cscript /nologo configure.js
"--enable-snapshot-build" "--with-gd=shared"
I think it is realy strange that an error occures when the mode is
activated. though it works on PHP4 and PHP5 withoud the mode
activated.
It looks like $db in the Menu class is'nt set
Reproduce code:
---------------
I got the source files located here to reproduce the bug
http://www.rharmsen.nl/bugfiles/main.phps
http://www.rharmsen.nl/bugfiles/clsDB.phps
http://www.rharmsen.nl/bugfiles/clsMenu.phps
Expected result:
----------------
I expected that the menu was displayed
Actual result:
--------------
What I got was:
Fatal error: Call to a member function query() on a non-object in
clsMenu.php on line 36
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27836&edit=1