From: thomas at stauntons dot org
Operating system: OS X
PHP version: 5.0.0b4 (beta4)
PHP Bug Type: *Compile Issues
Bug description: php_check_syntax behavior
Description:
------------
I am writing a class that will include another file
containing a class that needs to implement a specific
interface. When calling php_check_syntax on the file its
behavious differs depending on whether or not the class
implements my interface. If the file implements my
interface the class will not show up in
get_declared_classes() and an include() of the file will
work, but if the class doesn't implement my interface the
class will be in get_declared_classes() and the include
will fail with 'cannot redeclareclass'
Reproduce code:
---------------
in Main.php
<?php
interface MustImplement {}
if (!php_check_syntax('includeme.php'))
die('Bad Syntax\n');
else include('includeme.php');
?>
in includeme.php (Case 1)
<?php
class AClass implements MustImplement
{}
?>
in includeme.php (Case 2)
<?php
class AClass
{}
?>
Expected result:
----------------
Case 1 of includeme.php will work OK, php_syntax_check will
succeed and include will load the file OK, AClass will be
available.
Case 2 will fail, php_syntax_check will work but include
will fail with 'cannot redeclare class' & Illegal
Instruction
Actual result:
--------------
Just as Above.
--
Edit bug report at http://bugs.php.net/?id=27406&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27406&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27406&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=27406&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=27406&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=27406&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=27406&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=27406&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=27406&r=support
Expected behavior: http://bugs.php.net/fix.php?id=27406&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=27406&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=27406&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=27406&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27406&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=27406&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=27406&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=27406&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27406&r=float