From:             nlhowell at cableone dot net
Operating system: WinXP Pro 2600 SP1
PHP version:      5CVS-2004-06-23 (dev)
PHP Bug Type:     Unknown/Other Function
Bug description:  ReflectionClass::isAbstract always returns false

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 bug report at http://bugs.php.net/?id=28895&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28895&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28895&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28895&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28895&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28895&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28895&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28895&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28895&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28895&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28895&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28895&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28895&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28895&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28895&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28895&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28895&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28895&r=float

Reply via email to