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();

0 commit comments

Comments
 (0)