#16330 [Opn]: There is no E_NONE constant. Patch included.
| From: | dshadow at zort dot net | Date: | Mon, 26 Apr 2004 11:28:47 +0000 |
| Subject: | #16330 [Opn]: There is no E_NONE constant. Patch included. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-58779@lists.php.net to get a copy of this message | ||
ID: 16330
User updated by: dshadow at zort dot net
Reported By: dshadow at zort dot net
Status: Open
Bug Type: Feature/Change Request
Operating System: linux
PHP Version: 4.1.2
New Comment:
Because having E_NONE is consistent. Then any possible
value you might want to pass to error_reporting() has a
symbolic constant. Sure, "0" conceptually means "none",
but there's no reason that the value 0 MUST mean "no
errors". It just happens to be true in this case.
I'll agree that this may not be a compelling reason to
include E_NONE, but, I can't think of any compelling
reason why _NOT_ to include it, especially considering
that this is a two line patch that is not invasive at
all.
Also, the documentation references E_NONE, so at
least one other person feels it to be a reasonable
constant, so much that they didn't check to make sure
that the constant actually existed:
http://us3.php.net/security.errors
Previous Comments:
------------------------------------------------------------------------
[2004-04-26 09:13:57] jevon at jevon dot org
This makes no sense. Why have E_NONE when using '0' is simpler? I don't
see how it would be helpful at all, especially since 0 is not a
combination of any other numbers.
------------------------------------------------------------------------
[2002-03-28 10:43:36] dshadow at zort dot net
While investigating bug 16004, I noticed there is no E_NONE error
constant. The folowing patch provides one. (Apologies if this is
mangled, but I don't see another way to submit patches...)
diff -ur php-4.1.2/Zend/zend_constants.c
php-4.1.2-enone/Zend/zend_constants.c
--- php-4.1.2/Zend/zend_constants.c Mon Dec 17 00:22:24 2001
+++ php-4.1.2-enone/Zend/zend_constants.c Thu Mar 28 10:32:06 2002
@@ -102,6 +102,8 @@
void zend_register_standard_constants(TSRMLS_D)
{
+ REGISTER_MAIN_LONG_CONSTANT("E_NONE", E_NONE, CONST_PERSISTENT |
CONST_CS);
+
REGISTER_MAIN_LONG_CONSTANT("E_ERROR", E_ERROR, CONST_PERSISTENT |
CONST_CS);
REGISTER_MAIN_LONG_CONSTANT("E_WARNING", E_WARNING, CONST_PERSISTENT
| CONST_CS);
REGISTER_MAIN_LONG_CONSTANT("E_PARSE", E_PARSE, CONST_PERSISTENT |
CONST_CS);
diff -ur php-4.1.2/Zend/zend_errors.h
php-4.1.2-enone/Zend/zend_errors.h
--- php-4.1.2/Zend/zend_errors.h Mon Dec 17 00:22:24 2001
+++ php-4.1.2-enone/Zend/zend_errors.h Thu Mar 28 10:31:41 2002
@@ -21,6 +21,8 @@
#ifndef ZEND_ERRORS_H
#define ZEND_ERRORS_H
+#define E_NONE (0)
+
#define E_ERROR (1<<0L)
#define E_WARNING (1<<1L)
#define E_PARSE (1<<2L)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=16330&edit=1