#50558 [Opn->Csd]: Broken object model when extending tidy
| From: | pierrick@php.net | Date: | Fri, 25 Dec 2009 01:36:19 +0000 |
| Subject: | #50558 [Opn->Csd]: Broken object model when extending tidy | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-146102@lists.php.net to get a copy of this message | ||
ID: 50558
Updated by: pierrick@php.net
Reported By: degeberg@php.net
-Status: Open
+Status: Closed
Bug Type: Class/Object related
Operating System: Irrelevant
PHP Version: 5.3.1
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2009-12-25 01:35:58] svn@php.net
Automatic comment from SVN on behalf of pierrick
Revision: http://svn.php.net/viewvc/?view=revision&revision=292620
Log: Fixed bug #50558 (Broken object model when extending tidy)
------------------------------------------------------------------------
[2009-12-23 10:43:41] degeberg@php.net
Description:
------------
When extending the class tidy (http://docs.php.net/class.tidy) with a
subtype MyTidy, the PHP engine fails type checks for MyTidy (probably
easier to explain using code).
This is inconsistent with normal behavior in the object model. is_a($o,
get_class($o)) should always be true if $o is an object, that is an
object should always be an instance of its own class.
Reproduce code:
---------------
<?php
class MyTidy extends tidy
{
// foo
}
function doSomething(MyTidy $o)
{
var_dump($o);
}
$o = new MyTidy();
var_dump(is_a($o, get_class($o)), get_class($o));
doSomething($o);
Expected result:
----------------
bool(true)
string(7) "MyTidy"
object(MyTidy)#1 (2) {
["errorBuffer"]=>
NULL
["value"]=>
NULL
}
Actual result:
--------------
bool(false)
string(6) "MyTidy"
PHP Catchable fatal error: Argument 1 passed to doSomething() must be
an instance of MyTidy, instance of tidy given, called in
/home/daniel/test.php on line 16 and defined in /home/daniel/test.php on
line 7
Catchable fatal error: Argument 1 passed to doSomething() must be an
instance of MyTidy, instance of tidy given, called in
/home/daniel/test.php on line 16 and defined in /home/daniel/test.php on
line 7
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50558&edit=1