Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Zend/tests/assign_dim_op_undef.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Warning: Undefined variable $a in %s on line %d

Warning: Undefined variable $b in %s on line %d

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d

Warning: Undefined array key "" in %s on line %d
array(1) {
[""]=>
Expand Down
3 changes: 2 additions & 1 deletion Zend/tests/bug72543_2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ unset($ref);
$arr[0][$arr[0]] = null;
var_dump($arr);
?>
--EXPECT--
--EXPECTF--
Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
array(1) {
[0]=>
array(1) {
Expand Down
4 changes: 4 additions & 0 deletions Zend/tests/gc/bug67314.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ echo "ok\n";
?>
--EXPECTF--
Warning: Undefined variable $i in %s on line %d

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
made it once

Warning: Undefined variable $i in %s on line %d

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
ok
2 changes: 2 additions & 0 deletions Zend/tests/isset/isset_array.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ bool(true)
Deprecated: Implicit conversion from float 0.6 to int loses precision in %s on line %d
bool(true)
bool(false)

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
bool(false)

Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
Expand Down
2 changes: 2 additions & 0 deletions Zend/tests/list/list_keyed_conversions.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ list(STDIN => $resource) = [];

?>
--EXPECTF--
Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d

Deprecated: Implicit conversion from float 1.5 to int loses precision in %s on line %d
string(0) ""
int(1)
Expand Down
Binary file modified Zend/tests/nullsafe_operator/013.phpt
Binary file not shown.
2 changes: 2 additions & 0 deletions Zend/tests/offset_array.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ int(2)
Deprecated: Implicit conversion from float 0.0836 to int loses precision in %s on line %d
int(1)

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d

Warning: Undefined array key "" in %s on line %d
NULL

Expand Down
131 changes: 131 additions & 0 deletions Zend/tests/offsets/ArrayObject_container_offset_behaviour.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,93 @@ OUTPUT;

$EXPECTED_OUTPUT_FLOAT_OFFSETS_REGEX = '/^' . expectf_to_regex(EXPECTF_OUTPUT_FLOAT_OFFSETS) . '$/s';

const EXPECTED_OUTPUT_NULL_OFFSETS = <<<OUTPUT
Read before write:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d

Warning: Undefined array key "" in %s on line %d
NULL
Write:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
Read:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
int(5)
Read-Write:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
isset():

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
bool(true)
empty():

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
bool(false)
null coalesce:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
int(25)
Reference to dimension:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
Value of reference:
int(25)
Value of container dimension after write to reference (should be int(100) if successful):

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
int(100)
unset():

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
Nested read:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d

Warning: Undefined array key "" in %s on line %d

Warning: Trying to access array offset on null in %s on line %d
NULL
Nested write:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
Nested Read-Write:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
Nested isset():

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
bool(true)
Nested empty():

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
bool(false)
Nested null coalesce:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
int(30)
Nested unset():

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d

OUTPUT;

$EXPECTED_OUTPUT_NULL_OFFSETS_REGEX = '/^' . expectf_to_regex(EXPECTED_OUTPUT_NULL_OFFSETS) . '$/s';

const EXPECTED_OUTPUT_INVALID_OFFSETS = <<<OUTPUT
Read before write:
Cannot access offset of type %s on ArrayObject
Expand Down Expand Up @@ -175,44 +262,86 @@ $EXPECTED_OUTPUT_INVALID_OFFSETS_REGEX = '/^' . expectf_to_regex(EXPECTED_OUTPUT
const EXPECTED_OUTPUT_NULL_OFFSET = <<<OUTPUT
Read before write:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line 8

Warning: Undefined array key "" in %s on line 8
NULL
Write:
Read:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line 22

Warning: Undefined array key "" in %s on line 22
NULL
Read-Write:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line 29

Warning: Undefined array key "" in %s on line 29
isset():

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line 36
bool(false)
empty():

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line 42
bool(true)
null coalesce:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line 48
string(7) "default"
Reference to dimension:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line 55
Value of reference:
NULL
Value of container dimension after write to reference (should be int(100) if successful):

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line 60
int(100)
unset():

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line 67
Nested read:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line 74

Warning: Undefined array key "" in %s on line 74

Warning: Trying to access array offset on null in %s on line 74
NULL
Nested write:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line 81

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line 81
Nested Read-Write:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line 88

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line 88
Nested isset():

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line 95

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line 95
bool(true)
Nested empty():

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line 101

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line 101
bool(false)
Nested null coalesce:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line 107

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line 107
int(30)
Nested unset():

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line 114

OUTPUT;

const EXPECTED_OUTPUT_RESOURCE_STDERR_OFFSETS = <<<OUTPUT
Expand Down Expand Up @@ -323,6 +452,7 @@ foreach ($offsets as $dimension) {
!preg_match($EXPECTED_OUTPUT_VALID_OFFSETS_REGEX, $varOutput)
&& !preg_match($EXPECTED_OUTPUT_INVALID_OFFSETS_REGEX, $varOutput)
&& !preg_match($EXPECTED_OUTPUT_FLOAT_OFFSETS_REGEX, $varOutput)
&& !preg_match($EXPECTED_OUTPUT_NULL_OFFSETS_REGEX, $varOutput)
&& $varOutput !== EXPECTED_OUTPUT_NULL_OFFSET
&& $varOutput !== EXPECTED_OUTPUT_RESOURCE_STDERR_OFFSETS
) {
Expand Down Expand Up @@ -354,6 +484,7 @@ foreach ($offsets as $offset) {
!preg_match($EXPECTED_OUTPUT_VALID_OFFSETS_REGEX, $varOutput)
&& !preg_match($EXPECTED_OUTPUT_INVALID_OFFSETS_REGEX, $varOutput)
&& !preg_match($EXPECTED_OUTPUT_FLOAT_OFFSETS_REGEX, $varOutput)
&& !preg_match($EXPECTED_OUTPUT_NULL_OFFSETS_REGEX, $varOutput)
&& $varOutput !== EXPECTED_OUTPUT_NULL_OFFSET
&& $varOutput !== EXPECTED_OUTPUT_RESOURCE_STDERR_OFFSETS
) {
Expand Down
85 changes: 85 additions & 0 deletions Zend/tests/offsets/array_container_offset_behaviour.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,89 @@ OUTPUT;

$EXPECTED_OUTPUT_FLOAT_OFFSETS_REGEX = '/^' . expectf_to_regex(EXPECTF_OUTPUT_FLOAT_OFFSETS) . '$/s';

const EXPECTED_OUTPUT_NULL_OFFSETS = <<<OUTPUT
Read before write:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d

Warning: Undefined array key "" in %s on line %d
NULL
Write:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
Read:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
int(5)
Read-Write:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
isset():

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
bool(true)
empty():

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
bool(false)
null coalesce:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
int(25)
Reference to dimension:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
Value of reference:
int(25)
Value of container dimension after write to reference (should be int(100) if successful):

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
int(100)
unset():
Nested read:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d

Warning: Undefined array key "" in %s on line %d

Warning: Trying to access array offset on null in %s on line %d
NULL
Nested write:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
Nested Read-Write:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
Nested isset():

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
bool(true)
Nested empty():

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
bool(false)
Nested null coalesce:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
int(30)
Nested unset():

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d

OUTPUT;

$EXPECTED_OUTPUT_NULL_OFFSETS_REGEX = '/^' . expectf_to_regex(EXPECTED_OUTPUT_NULL_OFFSETS) . '$/s';

const EXPECTED_OUTPUT_INVALID_OFFSETS = <<<OUTPUT
Read before write:
Cannot access offset of type %s on array
Expand Down Expand Up @@ -273,6 +356,7 @@ foreach ($offsets as $dimension) {
!preg_match($EXPECTED_OUTPUT_VALID_OFFSETS_REGEX, $varOutput)
&& !preg_match($EXPECTED_OUTPUT_INVALID_OFFSETS_REGEX, $varOutput)
&& !preg_match($EXPECTED_OUTPUT_FLOAT_OFFSETS_REGEX, $varOutput)
&& !preg_match($EXPECTED_OUTPUT_NULL_OFFSETS_REGEX, $varOutput)
&& $varOutput !== EXPECTED_OUTPUT_RESOURCE_STDERR_OFFSETS
) {
file_put_contents(__DIR__ . DIRECTORY_SEPARATOR . "debug_array_container_{$failuresNb}.txt", $varOutput);
Expand Down Expand Up @@ -300,6 +384,7 @@ foreach ($offsets as $offset) {
!preg_match($EXPECTED_OUTPUT_VALID_OFFSETS_REGEX, $varOutput)
&& !preg_match($EXPECTED_OUTPUT_INVALID_OFFSETS_REGEX, $varOutput)
&& !preg_match($EXPECTED_OUTPUT_FLOAT_OFFSETS_REGEX, $varOutput)
&& !preg_match($EXPECTED_OUTPUT_NULL_OFFSETS_REGEX, $varOutput)
&& $varOutput !== EXPECTED_OUTPUT_RESOURCE_STDERR_OFFSETS
) {
file_put_contents(__DIR__ . DIRECTORY_SEPARATOR . "debug_array_container_{$failuresNb}.txt", $varOutput);
Expand Down
Loading