Skip to content

Commit 26a1307

Browse files
committed
Implement code review
1 parent 5fbf3e8 commit 26a1307

24 files changed

+119
-46
lines changed

Zend/tests/ErrorException_getSeverity.phpt

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,18 @@ try {
192192
var_dump($e->getTraceAsString() === EXCEPTION_TRACE_AS_STRING_MSG);
193193
}
194194

195+
try {
196+
throw new ErrorException(EXCEPTION_PARAM_MSG, EXCEPTION_CODE_ERROR, E_STRICT);
197+
} catch(ErrorException $e) {
198+
echo EXCEPTION_SEVERITY_ERROR_MSG . $e->getSeverity();
199+
var_dump($e->getSeverity() === E_STRICT);
200+
var_dump($e->getMessage() === EXCEPTION_PARAM_MSG);
201+
var_dump($e->getCode() === 0);
202+
var_dump($e->getPrevious() === NULL);
203+
var_dump($e->getFile() === __FILE__);
204+
var_dump($e->getTraceAsString() === EXCEPTION_TRACE_AS_STRING_MSG);
205+
}
206+
195207
try {
196208
throw new ErrorException(EXCEPTION_PARAM_MSG, EXCEPTION_CODE_ERROR, E_RECOVERABLE_ERROR);
197209
} catch(ErrorException $e) {
@@ -372,6 +384,18 @@ try {
372384
var_dump($e->getTraceAsString() === EXCEPTION_TRACE_AS_STRING_MSG);
373385
}
374386

387+
try {
388+
throw new ErrorException(EXCEPTION_PARAM_MSG, EXCEPTION_CODE_ERROR, E_STRICT, __FILE__);
389+
} catch(ErrorException $e) {
390+
echo EXCEPTION_SEVERITY_ERROR_MSG . $e->getSeverity();
391+
var_dump($e->getSeverity() === E_STRICT);
392+
var_dump($e->getMessage() === EXCEPTION_PARAM_MSG);
393+
var_dump($e->getCode() === 0);
394+
var_dump($e->getPrevious() === NULL);
395+
var_dump($e->getFile() === __FILE__);
396+
var_dump($e->getTraceAsString() === EXCEPTION_TRACE_AS_STRING_MSG);
397+
}
398+
375399
try {
376400
throw new ErrorException(EXCEPTION_PARAM_MSG, EXCEPTION_CODE_ERROR, E_RECOVERABLE_ERROR, __FILE__);
377401
} catch(ErrorException $e) {
@@ -552,6 +576,18 @@ try {
552576
var_dump($e->getTraceAsString() === EXCEPTION_TRACE_AS_STRING_MSG);
553577
}
554578

579+
try {
580+
throw new ErrorException(EXCEPTION_PARAM_MSG, EXCEPTION_CODE_ERROR, E_STRICT, __FILE__, __LINE__);
581+
} catch(ErrorException $e) {
582+
echo EXCEPTION_SEVERITY_ERROR_MSG . $e->getSeverity();
583+
var_dump($e->getSeverity() === E_STRICT);
584+
var_dump($e->getMessage() === EXCEPTION_PARAM_MSG);
585+
var_dump($e->getCode() === 0);
586+
var_dump($e->getPrevious() === NULL);
587+
var_dump($e->getFile() === __FILE__);
588+
var_dump($e->getTraceAsString() === EXCEPTION_TRACE_AS_STRING_MSG);
589+
}
590+
555591
try {
556592
throw new ErrorException(EXCEPTION_PARAM_MSG, EXCEPTION_CODE_ERROR, E_RECOVERABLE_ERROR, __FILE__, __LINE__);
557593
} catch(ErrorException $e) {
@@ -777,6 +813,22 @@ try {
777813
}
778814
}
779815

816+
try {
817+
throw new ErrorException(EXCEPTION_PARAM_MSG, EXCEPTION_CODE_ERROR, E_STRICT, __FILE__, __LINE__, NULL);
818+
} catch(Exception $exceptionErr) {
819+
try {
820+
throw new ErrorException(EXCEPTION_PARAM_MSG, EXCEPTION_CODE_ERROR, E_STRICT, __FILE__, __LINE__, $exceptionErr->getPrevious());
821+
} catch(ErrorException $e) {
822+
echo EXCEPTION_SEVERITY_ERROR_MSG . $e->getSeverity();
823+
var_dump($e->getSeverity() === E_STRICT);
824+
var_dump($e->getMessage() === EXCEPTION_PARAM_MSG);
825+
var_dump($e->getCode() === 0);
826+
var_dump($e->getPrevious() === NULL);
827+
var_dump($e->getFile() === __FILE__);
828+
var_dump($e->getTraceAsString() === EXCEPTION_TRACE_AS_STRING_MSG);
829+
}
830+
}
831+
780832
try {
781833
throw new ErrorException(EXCEPTION_PARAM_MSG, EXCEPTION_CODE_ERROR, E_RECOVERABLE_ERROR, __FILE__, __LINE__, NULL);
782834
} catch(Exception $exceptionErr) {
@@ -901,6 +953,12 @@ bool(true)
901953
bool(true)
902954
bool(true)
903955
bool(true)
956+
This exception severity is: 2048bool(true)
957+
bool(true)
958+
bool(true)
959+
bool(true)
960+
bool(true)
961+
bool(true)
904962
This exception severity is: 4096bool(true)
905963
bool(true)
906964
bool(true)
@@ -991,6 +1049,12 @@ bool(true)
9911049
bool(true)
9921050
bool(true)
9931051
bool(true)
1052+
This exception severity is: 2048bool(true)
1053+
bool(true)
1054+
bool(true)
1055+
bool(true)
1056+
bool(true)
1057+
bool(true)
9941058
This exception severity is: 4096bool(true)
9951059
bool(true)
9961060
bool(true)
@@ -1081,6 +1145,12 @@ bool(true)
10811145
bool(true)
10821146
bool(true)
10831147
bool(true)
1148+
This exception severity is: 2048bool(true)
1149+
bool(true)
1150+
bool(true)
1151+
bool(true)
1152+
bool(true)
1153+
bool(true)
10841154
This exception severity is: 4096bool(true)
10851155
bool(true)
10861156
bool(true)
@@ -1171,6 +1241,12 @@ bool(true)
11711241
bool(true)
11721242
bool(true)
11731243
bool(true)
1244+
This exception severity is: 2048bool(true)
1245+
bool(true)
1246+
bool(true)
1247+
bool(true)
1248+
bool(true)
1249+
bool(true)
11741250
This exception severity is: 4096bool(true)
11751251
bool(true)
11761252
bool(true)

Zend/tests/bug33771.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Bug #33771 (error_reporting falls to 0 when @ was used inside try/catch block)
33
--FILE--
44
<?php
55

6-
error_reporting(E_ALL | E_NOTICE);
6+
error_reporting(E_ALL);
77

88
var_dump(error_reporting());
99

Zend/tests/error_reporting02.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ testing @ and error_reporting - 2
33
--FILE--
44
<?php
55

6-
error_reporting(E_ALL);
6+
error_reporting(E_ALL & ~E_DEPRECATED);
77

88
function foo($arg) {
99
}
1010

1111
function bar() {
12-
error_reporting(E_ALL|E_DEPRECATED);
12+
error_reporting(E_ALL);
1313
throw new Exception("test");
1414
}
1515

Zend/tests/error_reporting03.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ testing @ and error_reporting - 3
33
--FILE--
44
<?php
55

6-
error_reporting(E_ALL);
6+
error_reporting(E_ALL & ~E_DEPRECATED);
77

88
function foo($arg) {
99
echo @$nonex_foo;
@@ -16,7 +16,7 @@ function bar() {
1616

1717
function foo1() {
1818
echo $undef1;
19-
error_reporting(E_ALL|E_DEPRECATED);
19+
error_reporting(E_ALL);
2020
echo $undef2;
2121
}
2222

Zend/tests/error_reporting04.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ testing @ and error_reporting - 4
33
--FILE--
44
<?php
55

6-
error_reporting(E_ALL);
6+
error_reporting(E_ALL & ~E_DEPRECATED);
77

88
function foo() {
99
echo $undef;
10-
error_reporting(E_ALL|E_DEPRECATED);
10+
error_reporting(E_ALL);
1111
}
1212

1313

Zend/tests/error_reporting08.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ testing @ and error_reporting - 8
33
--FILE--
44
<?php
55

6-
error_reporting(E_ALL);
6+
error_reporting(E_ALL & ~E_DEPRECATED);
77

88
function foo1($arg) {
99
}
@@ -12,7 +12,7 @@ function foo2($arg) {
1212
}
1313

1414
function foo3() {
15-
error_reporting(E_ALL|E_DEPRECATED);
15+
error_reporting(E_ALL);
1616
echo $undef3;
1717
throw new Exception("test");
1818
}

Zend/tests/error_reporting09.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ testing @ and error_reporting - 9
33
--FILE--
44
<?php
55

6-
error_reporting(E_ALL);
6+
error_reporting(E_ALL & ~E_DEPRECATED);
77

88
function bar() {
99
echo @$blah;
@@ -12,7 +12,7 @@ function bar() {
1212

1313
function foo() {
1414
echo @$undef;
15-
error_reporting(E_ALL|E_DEPRECATED);
15+
error_reporting(E_ALL);
1616
echo $blah;
1717
return bar();
1818
}

Zend/tests/exception_004.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ Throwing exception using a class that isn't derived from the Exception base clas
33
--FILE--
44
<?php
55

6-
error_reporting(E_ALL);
7-
86
class Foo { }
97

108
try {

Zend/zend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ ZEND_API zend_bool zend_rc_debug = 0;
9494
static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */
9595
{
9696
if (!new_value) {
97-
EG(error_reporting) = E_ALL & ~E_NOTICE & ~E_DEPRECATED;
97+
EG(error_reporting) = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED;
9898
} else {
9999
EG(error_reporting) = atoi(ZSTR_VAL(new_value));
100100
}

ext/soap/tests/bugs/bug46427.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Bug #46427 (SoapClient() stumbles over its "stream_context" parameter)
44
<?php require_once('skipif.inc'); ?>
55
--FILE--
66
<?php
7-
error_reporting(E_ALL);
87

98
function getSoapClient_1() {
109
$ctx = stream_context_create();

ext/standard/tests/general_functions/parse_ini_booleans.data

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ error_reporting = E_ALL
44
error_reporting1 = E_COMPILE_ERROR|E_RECOVERABLE_ERROR |E_ERROR|E_CORE_ERROR
55
error_reporting2 = E_ALL&~E_NOTICE
66
error_reporting3 = E_ALL & ~E_NOTICE
7+
error_reporting4 = E_ALL & ~E_NOTICE | E_PARSE
78

89
['true or false']
910
bool_true = true

ext/standard/tests/general_functions/parse_ini_booleans.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ echo "Done.\n";
1313
--EXPECT--
1414
array(3) {
1515
["error_reporting values"]=>
16-
array(5) {
16+
array(6) {
1717
["foo"]=>
1818
string(7) "32767 8"
1919
["error_reporting"]=>
@@ -24,6 +24,8 @@ array(3) {
2424
string(5) "32759"
2525
["error_reporting3"]=>
2626
string(5) "32759"
27+
["error_reporting4"]=>
28+
string(5) "32759"
2729
}
2830
["true or false"]=>
2931
array(8) {

ext/standard/tests/mail/mail_basic_alt1-win32.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ max_execution_time = 120
1919
* Alias to functions:
2020
*/
2121

22-
error_reporting(E_ALL);
2322
ini_set("SMTP", "localhost");
2423
ini_set("smtp_port", 25);
2524
ini_set("sendmail_from", "user@example.com");

ext/standard/tests/mail/mail_basic_alt2-win32.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ max_execution_time = 120
1818
* Alias to functions:
1919
*/
2020

21-
error_reporting(E_ALL);
22-
2321
echo "*** Testing mail() : basic functionality ***\n";
2422
require_once(__DIR__.'/mail_include.inc');
2523
$subject_prefix = "!**PHPT**!";

ext/standard/tests/mail/mail_basic_alt3-win32.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ max_execution_time = 120
1818
* Alias to functions:
1919
*/
2020

21-
error_reporting(E_ALL);
22-
2321
echo "*** Testing mail() : basic functionality ***\n";
2422
require_once(__DIR__.'/mail_include.inc');
2523
$subject_prefix = "!**PHPT**!";

ext/standard/tests/mail/mail_basic_alt4-win32.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ max_execution_time = 120
1818
* Alias to functions:
1919
*/
2020

21-
error_reporting(E_ALL);
22-
2321
echo "*** Testing mail() : basic functionality ***\n";
2422
require_once(__DIR__.'/mail_include.inc');
2523
$subject_prefix = "!**PHPT**!";

ext/standard/tests/mail/mail_variation_alt1-win32.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ max_execution_time = 120
1818
* Alias to functions:
1919
*/
2020

21-
error_reporting(E_ALL);
2221
ini_set("SMTP", "localhost");
2322
ini_set("smtp_port", 2525);
2423
ini_set("sendmail_from", "user@example.com");

ext/standard/tests/mail/mail_variation_alt2-win32.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ max_execution_time = 120
1818
* Alias to functions:
1919
*/
2020

21-
error_reporting(E_ALL);
2221
ini_set("SMTP", "localplace");
2322
ini_set("smtp_port", 25);
2423
ini_set("sendmail_from", "user@example.com");

ext/standard/tests/mail/mail_variation_alt3-win32.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ max_execution_time = 120
1818
* Alias to functions:
1919
*/
2020

21-
error_reporting(E_ALL);
2221
ini_set("SMTP", "localhost");
2322
ini_set("smtp_port", 25);
2423

ext/zip/examples/get_set_comments.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
error_reporting(E_ALL);
32

43
copy('test_with_comment.zip', 't.zip');
54
$z = new ZipArchive;

php.ini-development

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@
104104
; Production Value: Off
105105

106106
; error_reporting
107-
; Default Value: E_ALL & ~E_NOTICE & ~E_DEPRECATED
107+
; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
108108
; Development Value: E_ALL
109-
; Production Value: E_ALL & ~E_DEPRECATED
109+
; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
110110

111111
; log_errors
112112
; Default Value: Off
@@ -409,7 +409,7 @@ memory_limit = 128M
409409
; operators. The error level constants are below here for convenience as well as
410410
; some common settings and their meanings.
411411
; By default, PHP is set to take action on all errors, notices and warnings EXCEPT
412-
; those related to E_NOTICE, which together cover best practices and
412+
; those related to E_NOTICE and E_STRICT, which together cover best practices and
413413
; recommended coding standards in PHP. For performance reasons, this is the
414414
; recommend error reporting setting. Your production server shouldn't be wasting
415415
; resources complaining about best practices and coding standards. That's what
@@ -419,7 +419,7 @@ memory_limit = 128M
419419
; development and early testing.
420420
;
421421
; Error Level Constants:
422-
; E_ALL - All errors and warnings
422+
; E_ALL - All errors and warnings (includes E_STRICT as of PHP 5.4.0)
423423
; E_ERROR - fatal run-time errors
424424
; E_RECOVERABLE_ERROR - almost fatal run-time errors
425425
; E_WARNING - run-time warnings (non-fatal errors)
@@ -429,6 +429,9 @@ memory_limit = 128M
429429
; intentional (e.g., using an uninitialized variable and
430430
; relying on the fact it is automatically initialized to an
431431
; empty string)
432+
; E_STRICT - run-time notices, enable to have PHP suggest changes
433+
; to your code which will ensure the best interoperability
434+
; and forward compatibility of your code
432435
; E_CORE_ERROR - fatal errors that occur during PHP's initial startup
433436
; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's
434437
; initial startup
@@ -443,11 +446,12 @@ memory_limit = 128M
443446
;
444447
; Common Values:
445448
; E_ALL (Show all errors, warnings and notices including coding standards.)
446-
; E_ALL & ~E_NOTICE (Show all errors, except for notices.)
449+
; E_ALL & ~E_NOTICE (Show all errors, except for notices)
450+
; E_ALL & ~E_NOTICE & ~E_STRICT (Show all errors, except for notices and coding standards warnings.)
447451
; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors)
448-
; Default Value: E_ALL & ~E_NOTICE & ~E_DEPRECATED
452+
; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
449453
; Development Value: E_ALL
450-
; Production Value: E_ALL & ~E_DEPRECATED
454+
; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
451455
; http://php.net/error-reporting
452456
error_reporting = E_ALL
453457

0 commit comments

Comments
 (0)