Bug #70178 [Opn]: Call class with interface in define
| From: | cmb@php.net | Date: | Sat, 01 Aug 2015 13:24:50 +0000 |
| Subject: | Bug #70178 [Opn]: Call class with interface in define | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-194873@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70178&edit=1
ID: 70178
Updated by: cmb@php.net
Reported by: mimic23 at seznam dot cz
Summary: Call class with interface in define
Status: Open
Type: Bug
Package: *General Issues
Operating System: windows 7
PHP Version: 5.6.11
Block user comment: N
Private report: N
New Comment:
See <http://3v4l.org/6EsPe> vs. <http://3v4l.org/iPe7d>.
Previous Comments:
------------------------------------------------------------------------
[2015-07-31 18:08:38] mimic23 at seznam dot cz
Description:
------------
Hi, i found a bug with use static function or normal function in define. If class has any interface
-> Fatal error.
Tested in PHP 5.4.x, 5.6.x and 7.x
Test script:
---------------
// Fatal error (if class is without interface it's ok)
define ('XXX', Bagr::GetNew()->n); // Fatal error
interface IBagr {}
class Bagr implements IBagr
{
public $n = 1;
public static function GetNew() { return new Bagr(); }
}
echo XXX;
Expected result:
----------------
1
Actual result:
--------------
Fatal error: Uncaught Error: Class 'Bagr' not found in demo.php:3 Stack trace: #0 {main}
thrown in demo.php on line 3
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70178&edit=1