Skip to content

Commit d81ea16

Browse files
committed
Changed silent conversion of array to string to produce a notice. (Patrick)
1 parent 2cf34bc commit d81ea16

File tree

107 files changed

+595
-49
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+595
-49
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? 2011, PHP 5.4.0 RC1
4+
- General improvements:
5+
. Changed silent conversion of array to string to produce a notice. (Patrick)
46

57
20 Oct 2011, PHP 5.4.0 beta2
68
- General improvements:
79
. Improve the warning message of incompatible arguments. (Laruence)
810
. Improve ternary operator performance when returning arrays. (Arnaud, Dmitry)
911

1012
- Core:
13+
. Fixed bug #55801 (Behavior of unserialize has changed). (Mike)
1114
. Fixed bug #55749 (TOCTOU issue in getenv() on Windows builds). (Pierre)
1215
. Fixed bug #55707 (undefined reference to `__sync_fetch_and_add_4' on Linux
1316
parisc). (Felipe)

Zend/tests/cast_to_string.phpt

100 Bytes
Binary file not shown.

Zend/tests/concat_001.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,26 +50,46 @@ var_dump($d.$d);
5050
echo "Done\n";
5151
?>
5252
--EXPECTF--
53+
54+
Notice: Array to string conversion in %sconcat_001.php on line %d
5355
string(24) "Arraythis is test object"
56+
57+
Notice: Array to string conversion in %sconcat_001.php on line %d
5458
string(16) "Arraysome string"
59+
60+
Notice: Array to string conversion in %sconcat_001.php on line %d
5561
string(8) "Array222"
62+
63+
Notice: Array to string conversion in %sconcat_001.php on line %d
5664
string(13) "Array2323.444"
65+
66+
Notice: Array to string conversion in %sconcat_001.php on line %d
67+
68+
Notice: Array to string conversion in %sconcat_001.php on line %d
5769
string(10) "ArrayArray"
70+
71+
Notice: Array to string conversion in %sconcat_001.php on line %d
5872
string(24) "this is test objectArray"
5973
string(30) "this is test objectsome string"
6074
string(22) "this is test object222"
6175
string(27) "this is test object2323.444"
6276
string(38) "this is test objectthis is test object"
6377
string(30) "some stringthis is test object"
78+
79+
Notice: Array to string conversion in %sconcat_001.php on line %d
6480
string(16) "some stringArray"
6581
string(14) "some string222"
6682
string(19) "some string2323.444"
6783
string(22) "some stringsome string"
84+
85+
Notice: Array to string conversion in %sconcat_001.php on line %d
6886
string(8) "222Array"
6987
string(22) "222this is test object"
7088
string(14) "222some string"
7189
string(11) "2222323.444"
7290
string(6) "222222"
91+
92+
Notice: Array to string conversion in %sconcat_001.php on line %d
7393
string(13) "2323.444Array"
7494
string(27) "2323.444this is test object"
7595
string(19) "2323.444some string"

Zend/tests/unset_cv05.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,7 @@ ok
2323
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at %sunset_cv05.php on line %d
2424

2525
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at %sunset_cv05.php:%d) in %sunset_cv05.php on line %d
26+
27+
Notice: Array to string conversion in %sunset_cv05.php on line %d
2628
Array
2729
ok

Zend/tests/unset_cv08.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ unset() CV 8 (unset() of global variable in array_unique($GLOBALS))
44
<?php
55
$a = "ok\n";
66
$b = "ok\n";
7-
array_unique($GLOBALS);
7+
@array_unique($GLOBALS);
88
echo $a;
99
echo $b;
1010
echo "ok\n";

Zend/zend.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop
250250
Z_STRLEN_P(expr_copy) = snprintf(Z_STRVAL_P(expr_copy), sizeof("Resource id #") - 1 + MAX_LENGTH_OF_LONG, "Resource id #%ld", Z_LVAL_P(expr));
251251
break;
252252
case IS_ARRAY:
253+
zend_error(E_NOTICE, "Array to string conversion");
253254
Z_STRLEN_P(expr_copy) = sizeof("Array") - 1;
254255
Z_STRVAL_P(expr_copy) = estrndup("Array", Z_STRLEN_P(expr_copy));
255256
break;

ext/calendar/tests/jdtomonthname.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ string(0) ""
5252
string(0) ""
5353
string(0) ""
5454

55-
=== Array
55+
===
56+
Notice: Array to string conversion in %sjdtomonthname.php on line %d
57+
Array
5658

5759
Warning: jdmonthname() expects parameter 1 to be long, array given in %s on line %d
5860
bool(false)

ext/ereg/tests/ereg_replace_variation_001.phpt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,23 +122,28 @@ Arg value 0.5
122122
Error: 8192 - Function ereg_replace() is deprecated, %s(74)
123123
Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
124124
bool(false)
125+
Error: 8 - Array to string conversion, %sereg_replace_variation_001.php(%d)
125126

126127
Arg value Array
127128
Error: 8192 - Function ereg_replace() is deprecated, %s(74)
128129
Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
129130
bool(false)
131+
Error: 8 - Array to string conversion, %sereg_replace_variation_001.php(%d)
130132

131133
Arg value Array
132134
Error: 8192 - Function ereg_replace() is deprecated, %s(74)
133135
string(8) "original"
136+
Error: 8 - Array to string conversion, %sereg_replace_variation_001.php(%d)
134137

135138
Arg value Array
136139
Error: 8192 - Function ereg_replace() is deprecated, %s(74)
137140
string(8) "original"
141+
Error: 8 - Array to string conversion, %sereg_replace_variation_001.php(%d)
138142

139143
Arg value Array
140144
Error: 8192 - Function ereg_replace() is deprecated, %s(74)
141145
string(8) "original"
146+
Error: 8 - Array to string conversion, %sereg_replace_variation_001.php(%d)
142147

143148
Arg value Array
144149
Error: 8192 - Function ereg_replace() is deprecated, %s(74)

ext/ereg/tests/ereg_replace_variation_002.phpt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,22 +119,27 @@ string(5) "ho%21"
119119
Arg value 0.5
120120
Error: 8192 - Function ereg_replace() is deprecated, %s(74)
121121
string(5) "ho%21"
122+
Error: 8 - Array to string conversion, %sereg_replace_variation_002.php(%d)
122123

123124
Arg value Array
124125
Error: 8192 - Function ereg_replace() is deprecated, %s(74)
125126
string(5) "ho%21"
127+
Error: 8 - Array to string conversion, %sereg_replace_variation_002.php(%d)
126128

127129
Arg value Array
128130
Error: 8192 - Function ereg_replace() is deprecated, %s(74)
129131
string(8) "h%01o%21"
132+
Error: 8 - Array to string conversion, %sereg_replace_variation_002.php(%d)
130133

131134
Arg value Array
132135
Error: 8192 - Function ereg_replace() is deprecated, %s(74)
133136
string(8) "h%01o%21"
137+
Error: 8 - Array to string conversion, %sereg_replace_variation_002.php(%d)
134138

135139
Arg value Array
136140
Error: 8192 - Function ereg_replace() is deprecated, %s(74)
137141
string(8) "h%01o%21"
142+
Error: 8 - Array to string conversion, %sereg_replace_variation_002.php(%d)
138143

139144
Arg value Array
140145
Error: 8192 - Function ereg_replace() is deprecated, %s(74)

ext/ereg/tests/ereg_replace_variation_003.phpt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,26 +119,31 @@ string(29) "new value.0765432new valueE-9"
119119
Arg value 0.5
120120
Error: 8192 - Function ereg_replace() is deprecated, %s(74)
121121
string(3) "0.5"
122+
Error: 8 - Array to string conversion, %sereg_replace_variation_003.php(%d)
122123

123124
Arg value Array
124125
Error: 8192 - Function ereg_replace() is deprecated, %s(74)
125126
Error: 2 - ereg_replace() expects parameter 3 to be string, array given, %s(74)
126127
NULL
128+
Error: 8 - Array to string conversion, %sereg_replace_variation_003.php(%d)
127129

128130
Arg value Array
129131
Error: 8192 - Function ereg_replace() is deprecated, %s(74)
130132
Error: 2 - ereg_replace() expects parameter 3 to be string, array given, %s(74)
131133
NULL
134+
Error: 8 - Array to string conversion, %sereg_replace_variation_003.php(%d)
132135

133136
Arg value Array
134137
Error: 8192 - Function ereg_replace() is deprecated, %s(74)
135138
Error: 2 - ereg_replace() expects parameter 3 to be string, array given, %s(74)
136139
NULL
140+
Error: 8 - Array to string conversion, %sereg_replace_variation_003.php(%d)
137141

138142
Arg value Array
139143
Error: 8192 - Function ereg_replace() is deprecated, %s(74)
140144
Error: 2 - ereg_replace() expects parameter 3 to be string, array given, %s(74)
141145
NULL
146+
Error: 8 - Array to string conversion, %sereg_replace_variation_003.php(%d)
142147

143148
Arg value Array
144149
Error: 8192 - Function ereg_replace() is deprecated, %s(74)

ext/ereg/tests/ereg_variation_001.phpt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,26 +120,31 @@ bool(false)
120120
Arg value 0.5
121121
Error: 8192 - Function ereg() is deprecated, %s(75)
122122
bool(false)
123+
Error: 8 - Array to string conversion, %sereg_variation_001.php(%d)
123124

124125
Arg value Array
125126
Error: 8192 - Function ereg() is deprecated, %s(75)
126127
Error: 8 - Array to string conversion, %s(75)
127128
bool(false)
129+
Error: 8 - Array to string conversion, %sereg_variation_001.php(%d)
128130

129131
Arg value Array
130132
Error: 8192 - Function ereg() is deprecated, %s(75)
131133
Error: 8 - Array to string conversion, %s(75)
132134
bool(false)
135+
Error: 8 - Array to string conversion, %sereg_variation_001.php(%d)
133136

134137
Arg value Array
135138
Error: 8192 - Function ereg() is deprecated, %s(75)
136139
Error: 8 - Array to string conversion, %s(75)
137140
bool(false)
141+
Error: 8 - Array to string conversion, %sereg_variation_001.php(%d)
138142

139143
Arg value Array
140144
Error: 8192 - Function ereg() is deprecated, %s(75)
141145
Error: 8 - Array to string conversion, %s(75)
142146
bool(false)
147+
Error: 8 - Array to string conversion, %sereg_variation_001.php(%d)
143148

144149
Arg value Array
145150
Error: 8192 - Function ereg() is deprecated, %s(75)

ext/ereg/tests/ereg_variation_002.phpt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,26 +119,31 @@ int(1)
119119
Arg value 0.5
120120
Error: 8192 - Function ereg() is deprecated, %s(74)
121121
bool(false)
122+
Error: 8 - Array to string conversion, %sereg_variation_002.php(%d)
122123

123124
Arg value Array
124125
Error: 8192 - Function ereg() is deprecated, %s(74)
125126
Error: 2 - ereg() expects parameter 2 to be string, array given, %s(74)
126127
NULL
128+
Error: 8 - Array to string conversion, %sereg_variation_002.php(%d)
127129

128130
Arg value Array
129131
Error: 8192 - Function ereg() is deprecated, %s(74)
130132
Error: 2 - ereg() expects parameter 2 to be string, array given, %s(74)
131133
NULL
134+
Error: 8 - Array to string conversion, %sereg_variation_002.php(%d)
132135

133136
Arg value Array
134137
Error: 8192 - Function ereg() is deprecated, %s(74)
135138
Error: 2 - ereg() expects parameter 2 to be string, array given, %s(74)
136139
NULL
140+
Error: 8 - Array to string conversion, %sereg_variation_002.php(%d)
137141

138142
Arg value Array
139143
Error: 8192 - Function ereg() is deprecated, %s(74)
140144
Error: 2 - ereg() expects parameter 2 to be string, array given, %s(74)
141145
NULL
146+
Error: 8 - Array to string conversion, %sereg_variation_002.php(%d)
142147

143148
Arg value Array
144149
Error: 8192 - Function ereg() is deprecated, %s(74)

ext/ereg/tests/eregi_replace_variation_001.phpt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,23 +122,28 @@ Arg value 0.5
122122
Error: 8192 - Function eregi_replace() is deprecated, %s(74)
123123
Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
124124
bool(false)
125+
Error: 8 - Array to string conversion, %seregi_replace_variation_001.php(%d)
125126

126127
Arg value Array
127128
Error: 8192 - Function eregi_replace() is deprecated, %s(74)
128129
Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
129130
bool(false)
131+
Error: 8 - Array to string conversion, %seregi_replace_variation_001.php(%d)
130132

131133
Arg value Array
132134
Error: 8192 - Function eregi_replace() is deprecated, %s(74)
133135
string(8) "original"
136+
Error: 8 - Array to string conversion, %seregi_replace_variation_001.php(%d)
134137

135138
Arg value Array
136139
Error: 8192 - Function eregi_replace() is deprecated, %s(74)
137140
string(8) "original"
141+
Error: 8 - Array to string conversion, %seregi_replace_variation_001.php(%d)
138142

139143
Arg value Array
140144
Error: 8192 - Function eregi_replace() is deprecated, %s(74)
141145
string(8) "original"
146+
Error: 8 - Array to string conversion, %seregi_replace_variation_001.php(%d)
142147

143148
Arg value Array
144149
Error: 8192 - Function eregi_replace() is deprecated, %s(74)

ext/ereg/tests/eregi_replace_variation_002.phpt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,22 +119,27 @@ string(5) "ho%21"
119119
Arg value 0.5
120120
Error: 8192 - Function eregi_replace() is deprecated, %s(74)
121121
string(5) "ho%21"
122+
Error: 8 - Array to string conversion, %seregi_replace_variation_002.php(%d)
122123

123124
Arg value Array
124125
Error: 8192 - Function eregi_replace() is deprecated, %s(74)
125126
string(5) "ho%21"
127+
Error: 8 - Array to string conversion, %seregi_replace_variation_002.php(%d)
126128

127129
Arg value Array
128130
Error: 8192 - Function eregi_replace() is deprecated, %s(74)
129131
string(8) "h%01o%21"
132+
Error: 8 - Array to string conversion, %seregi_replace_variation_002.php(%d)
130133

131134
Arg value Array
132135
Error: 8192 - Function eregi_replace() is deprecated, %s(74)
133136
string(8) "h%01o%21"
137+
Error: 8 - Array to string conversion, %seregi_replace_variation_002.php(%d)
134138

135139
Arg value Array
136140
Error: 8192 - Function eregi_replace() is deprecated, %s(74)
137141
string(8) "h%01o%21"
142+
Error: 8 - Array to string conversion, %seregi_replace_variation_002.php(%d)
138143

139144
Arg value Array
140145
Error: 8192 - Function eregi_replace() is deprecated, %s(74)

ext/ereg/tests/eregi_replace_variation_003.phpt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,26 +119,31 @@ string(29) "new value.0765432new valueE-9"
119119
Arg value 0.5
120120
Error: 8192 - Function eregi_replace() is deprecated, %s(74)
121121
string(3) "0.5"
122+
Error: 8 - Array to string conversion, %seregi_replace_variation_003.php(%d)
122123

123124
Arg value Array
124125
Error: 8192 - Function eregi_replace() is deprecated, %s(74)
125126
Error: 2 - eregi_replace() expects parameter 3 to be string, array given, %s(74)
126127
NULL
128+
Error: 8 - Array to string conversion, %seregi_replace_variation_003.php(%d)
127129

128130
Arg value Array
129131
Error: 8192 - Function eregi_replace() is deprecated, %s(74)
130132
Error: 2 - eregi_replace() expects parameter 3 to be string, array given, %s(74)
131133
NULL
134+
Error: 8 - Array to string conversion, %seregi_replace_variation_003.php(%d)
132135

133136
Arg value Array
134137
Error: 8192 - Function eregi_replace() is deprecated, %s(74)
135138
Error: 2 - eregi_replace() expects parameter 3 to be string, array given, %s(74)
136139
NULL
140+
Error: 8 - Array to string conversion, %seregi_replace_variation_003.php(%d)
137141

138142
Arg value Array
139143
Error: 8192 - Function eregi_replace() is deprecated, %s(74)
140144
Error: 2 - eregi_replace() expects parameter 3 to be string, array given, %s(74)
141145
NULL
146+
Error: 8 - Array to string conversion, %seregi_replace_variation_003.php(%d)
142147

143148
Arg value Array
144149
Error: 8192 - Function eregi_replace() is deprecated, %s(74)

ext/ereg/tests/eregi_variation_001.phpt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,26 +120,31 @@ bool(false)
120120
Arg value 0.5
121121
Error: 8192 - Function eregi() is deprecated, %s(75)
122122
bool(false)
123+
Error: 8 - Array to string conversion, %seregi_variation_001.php(%d)
123124

124125
Arg value Array
125126
Error: 8192 - Function eregi() is deprecated, %s(75)
126127
Error: 8 - Array to string conversion, %s(75)
127128
bool(false)
129+
Error: 8 - Array to string conversion, %seregi_variation_001.php(%d)
128130

129131
Arg value Array
130132
Error: 8192 - Function eregi() is deprecated, %s(75)
131133
Error: 8 - Array to string conversion, %s(75)
132134
bool(false)
135+
Error: 8 - Array to string conversion, %seregi_variation_001.php(%d)
133136

134137
Arg value Array
135138
Error: 8192 - Function eregi() is deprecated, %s(75)
136139
Error: 8 - Array to string conversion, %s(75)
137140
bool(false)
141+
Error: 8 - Array to string conversion, %seregi_variation_001.php(%d)
138142

139143
Arg value Array
140144
Error: 8192 - Function eregi() is deprecated, %s(75)
141145
Error: 8 - Array to string conversion, %s(75)
142146
bool(false)
147+
Error: 8 - Array to string conversion, %seregi_variation_001.php(%d)
143148

144149
Arg value Array
145150
Error: 8192 - Function eregi() is deprecated, %s(75)

0 commit comments

Comments
 (0)