Bug #51791 [NEW]: constant() failed to check undefined constant and php interpreter stoped

From: Date: Tue, 11 May 2010 10:12:49 +0000
Subject: Bug #51791 [NEW]: constant() failed to check undefined constant and php interpreter stoped
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-150321@lists.php.net to get a copy of this message
From:             
Operating system: Windows, Linux
PHP version:      5.3.2
Package:          Reproducible crash
Bug Type:         Bug
Bug description:constant() failed to check undefined constant and php interpreter stoped

Description:
------------
constant() failed to check undefined constant and php interpreter stoped,
but constant() should return NULL and php interpreter should continue to
work.

Test script:
---------------
class A 
{
    const B = 1;
}
var_dump(constant('A::B1'));
echo 5;


Expected result:
----------------
Warning: constant(): Couldn't find constant A::B1
NULL
5

Actual result:
--------------
>php -v 
PHP 5.3.2 (cli) (built: Mar 3 2010 19:40:13) 
Copyright (c) 1997-2010 The PHP Group 
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies 

>php -r "class A { const B = 1;} var_dump(@constant('A::B1')); echo 5;" 

>php -r "class A { const B = 1;} var_dump(constant('A::B1')); echo 5;" 

Fatal error: Undefined class constant 'A::B1' in Command line code on line
1 

Call Stack: 
0.0003 317608 1. {main}() Command line code:0 
0.0003 317688 2. constant() Command line code:1

-- 
Edit bug report at http://bugs.php.net/bug.php?id=51791&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=51791&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=51791&r=trysnapshot53
Try a snapshot (PHP 6.0):            http://bugs.php.net/fix.php?id=51791&r=trysnapshot60
Fixed in SVN:                        http://bugs.php.net/fix.php?id=51791&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51791&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=51791&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=51791&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=51791&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=51791&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=51791&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=51791&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=51791&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=51791&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=51791&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51791&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51791&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=51791&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=51791&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=51791&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=51791&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=51791&r=mysqlcfg



Thread (9 messages)

« previous php.bugs (#150321) next »