|  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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
32 + 8 = ?
Subscribe to this entry?

 [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-2023 The PHP Group
All rights reserved.
Last updated: Wed Oct 04 19:01:25 2023 UTC