php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74657 Undefined constants in array properties result in broken properties
Submitted: 2017-05-26 11:01 UTC Modified: -
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: kelunik@php.net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 7.0.19 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kelunik@php.net
New email:
PHP Version: OS:

 

 [2017-05-26 11:01 UTC] kelunik@php.net
Description:
------------
See https://3v4l.org/HgKbi. On the second construction there's not another error thrown.

Test script:
---------------
<?php

interface I {
}

class C {
    const FOO = I::FOO;
    
    public $options = [self::FOO => "bar"];
}

try {
    var_dump((new C)->options);
} catch (Throwable $e) {}

var_dump((new C)->options);

Expected result:
----------------
The second construction should throw an error like the first one.

Actual result:
--------------
The second construction went fine and `$this->options` is `UNKNOWN:0`.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-05-27 04:09 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=5269c4cacbc1372341d2091337d87fa3b0181490
Log: Fixed bug #74657 (Undefined constants in array properties result in broken properties)
 [2017-05-27 04:09 UTC] laruence@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 11:01:32 2025 UTC