|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70884 Empty() throws E_NOTICE on undefined index of class const array
Submitted: 2015-11-09 23:04 UTC Modified: 2015-11-22 04:22 UTC
From: info at ronin-design dot com Assigned:
Status: No Feedback Package: Class/Object related
PHP Version: 5.6.15 OS: OS X 10.10.4 (14E46)
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: info at ronin-design dot com
New email:
PHP Version: OS:


 [2015-11-09 23:04 UTC] info at ronin-design dot com
Empty() function throws E_NOTICE "Notice: Undefined index" when checking a class constant of type ARRAY for non-existent element. However, isset() works as expected.

Test script:
class Test
  private $obj;
  const MAP = ['testKey' => 'test'];
  function __construct()
    $this->obj       = new \stdClass();
    $this->obj->test = "testObject";

  public function isKey($name = 'testKey') {

Expected result:
Expect to see var_dump() return boolean result of empty() WITHOUT E_NOTICE generation.

Actual result:
var_dump() correctly returns result of empty(), but also generates E_NOTICE "Notice: Undefined index"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-11-10 03:05 UTC]
-Status: Open +Status: Feedback
 [2015-11-10 03:05 UTC]
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.  There is no Notice.  please provider more information.
 [2015-11-22 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 14 08:01:28 2024 UTC