php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #16330 There is no E_NONE constant. Patch included.
Submitted: 2002-03-28 10:43 UTC Modified: 2010-08-27 12:34 UTC
Votes:6
Avg. Score:4.5 ± 0.8
Reproduced:4 of 4 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (25.0%)
From: dshadow at zort dot net Assigned:
Status: Duplicate Package: *General Issues
PHP Version: 4.1.2 OS: linux
Private report: No CVE-ID: None
 [2002-03-28 10:43 UTC] 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)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-26 09:13 UTC] 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.
 [2004-04-26 13:28 UTC] dshadow at zort dot net
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
 [2010-08-27 12:34 UTC] aharvey@php.net
-Status: Open +Status: Duplicate -Package: Feature/Change Request +Package: *General Issues
 [2010-08-27 12:34 UTC] aharvey@php.net
Didn't see this request earlier. Request #52563 is dealing with this,
anyway.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC