ID: 28895
User updated by: nlhowell at cableone dot net
Reported By: nlhowell at cableone dot net
-Status: Open
+Status: Closed
Bug Type: Unknown/Other Function
Operating System: WinXP Pro 2600 SP1
PHP Version: 5CVS-2004-06-23 (dev)
New Comment:
Latest CVS (200407041430) has this bug listed as fixed.
Previous Comments:
------------------------------------------------------------------------
[2004-06-23 17:05:37] nlhowell at cableone dot net
Note that the first two lines are the important ones in the expected
and actual results.
------------------------------------------------------------------------
[2004-06-23 17:03:35] nlhowell at cableone dot net
Description:
------------
If you define an abstract class, ReflectionClass says it is not
abstract and is instantiable.
Reproduce code:
---------------
<?php
abstract class X { private $y = 5; }
$class = new ReflectionClass("X");
print "Class X:<br>";
print "Abstract: ";
var_dump($class->isAbstract());
print "<br>Instantiable: ";
var_dump($class->isInstantiable());
print "<br><br>Reflection Export:<pre>";
Reflection::Export($class);
print "</pre><br>var_dump of X:<pre>";
var_dump(new X());
print "</pre><br>";
?>
Expected result:
----------------
Class X:<br>Abstract: bool(true)
<br>Instantiable: bool(false)
<br><br>Reflection Export:<pre>Class [ <user> abstract class X ] {
@@ c:\Inetpub\wwwroot\php5lib2\test.php5 4-4
- Constants [0] {
}
- Static properties [0] {
}
- Static methods [0] {
}
- Properties [1] {
Property [ <default> private $y ]
}
- Methods [0] {
}
}
</pre><br>var_dump of X:<pre><br />
<b>Fatal error</b>: Cannot instantiate abstract class X in
<b>c:\Inetpub\wwwroot\php5lib2\test.php5</b> on line <b>15</b><br />
Actual result:
--------------
Class X:<br>Abstract: bool(false)
<br>Instantiable: bool(true)
<br><br>Reflection Export:<pre>Class [ <user> abstract class X ] {
@@ c:\Inetpub\wwwroot\php5lib2\test.php5 4-4
- Constants [0] {
}
- Static properties [0] {
}
- Static methods [0] {
}
- Properties [1] {
Property [ <default> private $y ]
}
- Methods [0] {
}
}
</pre><br>var_dump of X:<pre><br />
<b>Fatal error</b>: Cannot instantiate abstract class X in
<b>c:\Inetpub\wwwroot\php5lib2\test.php5</b> on line <b>15</b><br />
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28895&edit=1