ID:               39127
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Bogus
+Status:           Open
 Bug Type:         Scripting Engine problem
-Operating System: *
+Operating System: Irrelevant
-PHP Version:      *
+PHP Version:      5.2.0RC5
 New Comment:

>From what I see, the following happens:
1) class_entry of "A" uses method a() as constructor;
2) class "B" doesn't have a constructor; 
3) do_inherit_parent_constructor() looks for "__construct" in "A"; 
4) there is no "__construct" in "A"; 
5) named constructor a() is added to "B" as b().

5) seems to be wrong to me, here is the patch:
http://tony2001.phpclub.net/dev/tmp/bug39127.diff

With the patch method a() is still callable and used as constructor in
"B", but there would be no method b().


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

[2006-10-11 18:59:29] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

see above

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

[2006-10-11 18:59:09] [EMAIL PROTECTED]

expected behavior, b inherits a's constuctor and a::__construct
obviously does not exist

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

[2006-10-11 18:05:10] [EMAIL PROTECTED]

Description:
------------
In php's OOP implementation, the "class-name method" fallback used when
a __construct() method fails seems to have strange effects. Non-existant
methods seems to be callable. It only happens if no constructor is
defined in class b.

This can be reproduced in php4.4, 5.1, 5.2-cvs, 6-cvs :



Reproduce code:
---------------
class a { function a($arg='') { echo $arg; } } 
class b extends a {} 

$b = new b; 
$b->b('foo');
$b->__construct('foo');

Expected result:
----------------
Fatal error: Call to undefined method b::b() in ...
Fatal error: Call to undefined method b::__construct() in ...

Actual result:
--------------
foo
Fatal error: Call to undefined method b::__construct() 


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


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

Reply via email to