From: waboring at 3gstech dot com
Operating system: Redhat 9
PHP version: 5CVS-2004-02-11 (dev)
PHP Bug Type: Zend Engine 2 problem
Bug description: Mixed case class names causes Fatal Error in Constructor call
Description:
------------
I have 3 classes a, b extends a, c extends b.
b doesn't have constructor.
c class contructor calls b's constructor in an effort
to cascade constructor calls up the class heirarchy.
This works great until class 'a' is renamed to 'A'.
<?php
/* This script works as one would expect.
The foo class constructor gets called.
*/
class a {
function a() {
echo __CLASS__."::".__FUNCTION__." called!<br>\n";
}
}
class b extends a {
function blah() {
echo __CLASS__."::".__FUNCTION__."() called<br>\n";
}
}
class c extends b {
function c() {
echo __CLASS__."::".__FUNCTION__."() called!!<br>\n";
$this->b();
}
}
$obj = new c();
$obj->blah();
/* Output is
c::c() called!!
a::a called!
b::blah() called
*/
?>
Reproduce code:
---------------
<?php
/*
Notice that the only thing that is different here is the
case of the 'a' class changed to 'A' in all the appropriate places. Now
I get a Fatal error saying
c::b() doesn't exist?
*/
class A {
function A() {
echo __CLASS__."::".__FUNCTION__." called!<br>\n";
}
}
class b extends A {
function blah() {
echo __CLASS__."::".__FUNCTION__."() called<br>\n";
}
}
class c extends b {
function c() {
echo __CLASS__."::".__FUNCTION__."() called!!<br>\n";
$this->b();
//ERROR IN LINE ABOVE
}
}
$obj = new c();
$obj->blah();
/* Output is
c::c() called!!
Fatal error: Call to undefined method c::b() in
/home/waboring/devel/php/oop.php on line 18
*/
?>
Expected result:
----------------
I expect that both of the scripts would work the same way. I have many
classes that have Mixed case
Actual result:
--------------
Fatal error: Call to undefined method c::b() in
/home/waboring/devel/php/oop.php on line 18
--
Edit bug report at http://bugs.php.net/?id=27227&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27227&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27227&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=27227&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=27227&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=27227&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=27227&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=27227&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=27227&r=support
Expected behavior: http://bugs.php.net/fix.php?id=27227&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=27227&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=27227&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=27227&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27227&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=27227&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=27227&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=27227&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27227&r=float