|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75984 Function empty() throws E_NOTICE on undefined index of class const array
Submitted: 2018-02-20 09:33 UTC Modified: 2018-02-20 10:05 UTC
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: evgvzubkoff at gmail dot com Assigned:
Status: Wont fix Package: Arrays related
PHP Version: 5.6.33 OS: Ubuntu 16.04 LTS
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.
Block user comment
Status: Assign to:
Bug Type:
From: evgvzubkoff at gmail dot com
New email:
PHP Version: OS:


 [2018-02-20 09:33 UTC] evgvzubkoff at gmail dot com
Test code -

Test script:

class Foo
     * Values
     * @var array
    const VALUES = [
        'key1' => 'value1',
        'key2' => 'value2',
        'key3' => 'value3'

     * Test function
    public function execute()
        $key = 'key4';
        if (!empty(self::VALUES[$key])) {
        } else {
            echo 'The key doesn\'t found in this array.';

$foo = new Foo();

Expected result:
There should not be E_NOTICE

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-02-20 10:05 UTC]
-Status: Open +Status: Wont fix
 [2018-02-20 10:05 UTC]
This bug has already been fixed in recent versions of PHP as you can see in the link you posted.

The version you're using (5.6.x) is in security-only support mode. No further bug fixes are provided for that version. Please upgrade to a newer version of PHP.

See also
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Feb 25 01:01:27 2024 UTC