php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30452 php parser does not work properly (1)
Submitted: 2004-10-16 01:56 UTC Modified: 2005-08-09 13:55 UTC
Votes:3
Avg. Score:4.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:2 (66.7%)
From: guth at fiifo dot u-psud dot fr Assigned: dmitry (profile)
Status: Wont fix Package: Scripting Engine problem
PHP Version: 5CVS-2005-06-19 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: guth at fiifo dot u-psud dot fr
New email:
PHP Version: OS:

 

 [2004-10-16 01:56 UTC] guth at fiifo dot u-psud dot fr
Description:
------------
The following behaviour seems incorrect.

PHP founds the abstract class if it doesn't implement an interface, but doen't found it if it implements an interface.

Reproduce code:
---------------
<?php

interface MyInterface { }

class MyClass extends MyAbstractClass { }

abstract class MyAbstractClass implements MyInterface { }

?>

<?php

interface MyInterface { }

class MyClass extends MyAbstractClass implements MyInterface { }

abstract class MyAbstractClass { }

?>

Expected result:
----------------
First :
- Should work

Second :
- Should work

Actual result:
--------------
First :

Fatal error: Class 'MyAbstractClass' not found in /www/test.php on line 5

Second :
- Work

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-05-09 11:31 UTC] sniper@php.net
Andi, (or Dmitry maybe?) can you look into this?
 [2005-06-19 14:47 UTC] sniper@php.net
See also bug #30453
 [2005-06-24 10:56 UTC] gopalv82 at yahoo dot com
This looks like a bug with the runtime inheritance code-gen rather than a parser bug.

The opcode dump I imagine looks something like

FETCH_CLASS "MyAbstractClass"
DECLARE_INHERITED_CLASS "MyClass"
DECLARE_CLASS "MyAbstractClass"
FETCH_CLASS "MyInterface"
ADD_INTERFACE

Linear opcode generation is just not possible (conditional classes !! ?)
 [2005-08-09 13:55 UTC] dmitry@php.net
Interfaces and classes should be defined before they are used. PHP4 supported later declaration with classes, and PHP5 supports it for backward compatibility, but we don't plan support for all compinations.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 30 06:01:29 2024 UTC