Bug #20406 [PATCH]: defined() does not work properly within function or class
| From: | beshob998@gmail.com | Date: | Tue, 24 Oct 2023 06:24:44 +0000 |
| Subject: | Bug #20406 [PATCH]: defined() does not work properly within function or class | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-245630@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=20406&edit=1
ID: 20406
Patch added by: beshob998@gmail.com
Reported by: fredbird at contactoffice dot net
Summary: defined() does not work properly within function or
class
Status: Not a bug
Type: Bug
Package: Variables related
Operating System: Windows XP
PHP Version: 4.2.0
Block user comment: N
Private report: N
New Comment:
The following patch has been added/updated:
Patch Name: besho
Revision: 1698128684
URL: https://bugs.php.net/patch-display.php?bug=20406&patch=besho&revision=1698128684
Previous Comments:
------------------------------------------------------------------------
[2002-11-13 04:58:33] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
------------------------------------------------------------------------
[2002-11-13 04:39:32] fredbird at contactoffice dot net
The function defined() always return false within a function or class, although the value of the
constant is still available.
the code :
<?php
define(NAME, "value");
function f() {
if (defined(NOM)) echo "NOM is defined";
echo NOM;
}
f();
?>
will print "value" only. Currently tested with EasyPHP running with a Windows XP computer.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=20406&edit=1