Skip to content

Commit da5617c

Browse files
committed
Zend: Add tests for offsets and containers
1 parent d41ee53 commit da5617c

File tree

286 files changed

+4041
-2
lines changed

Some content is hidden

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

286 files changed

+4041
-2
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Empty array offset behaviour
3+
--FILE--
4+
<?php
5+
6+
require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'container_var.inc';
7+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'test_const_array_offsets.inc';
8+
9+
?>
10+
--EXPECTF_EXTERNAL--
11+
../expect_invalid_offsets.txt
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
false offset behaviour
3+
--FILE--
4+
<?php
5+
6+
require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'container_var.inc';
7+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'test_const_false_offsets.inc';
8+
9+
?>
10+
--EXPECTF_EXTERNAL--
11+
../expect_valid_offsets.txt
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
--TEST--
2+
Float with fractional part offset behaviour
3+
--FILE--
4+
<?php
5+
6+
require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'container_var.inc';
7+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'test_const_float_with_fractional_offsets.inc';
8+
9+
?>
10+
--EXPECTF--
11+
Read before write:
12+
13+
Deprecated: Implicit conversion from float 5.5 to int loses precision in %s on line %d
14+
15+
Warning: Undefined array key 5 in %s on line %d
16+
NULL
17+
Write:
18+
19+
Deprecated: Implicit conversion from float 5.5 to int loses precision in %s on line %d
20+
Read:
21+
22+
Deprecated: Implicit conversion from float 5.5 to int loses precision in %s on line %d
23+
string(1) "v"
24+
Read-Write:
25+
26+
Deprecated: Implicit conversion from float 5.5 to int loses precision in %s on line %d
27+
isset():
28+
29+
Deprecated: Implicit conversion from float 5.5 to int loses precision in %s on line %d
30+
bool(true)
31+
empty():
32+
33+
Deprecated: Implicit conversion from float 5.5 to int loses precision in %s on line %d
34+
bool(false)
35+
Coalesce():
36+
37+
Deprecated: Implicit conversion from float 5.5 to int loses precision in %s on line %d
38+
string(7) "vappend"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Float without fractional part offset behaviour
3+
--FILE--
4+
<?php
5+
6+
require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'container_var.inc';
7+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'test_const_float_without_fractional_offsets.inc';
8+
9+
?>
10+
--EXPECTF_EXTERNAL--
11+
../expect_valid_offsets.txt
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Integer offset behaviour
3+
--FILE--
4+
<?php
5+
6+
require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'container_var.inc';
7+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'test_const_int_offsets.inc';
8+
9+
?>
10+
--EXPECTF_EXTERNAL--
11+
../expect_valid_offsets.txt
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
null offset behaviour
3+
--FILE--
4+
<?php
5+
6+
require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'container_var.inc';
7+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'test_const_null_offsets.inc';
8+
9+
?>
10+
--EXPECTF_EXTERNAL--
11+
../expect_valid_offsets.txt
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Object offset behaviour
3+
--FILE--
4+
<?php
5+
6+
require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'container_var.inc';
7+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'test_const_object_offsets.inc';
8+
9+
?>
10+
--EXPECTF_EXTERNAL--
11+
../expect_invalid_offsets.txt
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
--TEST--
2+
Resource offset behaviour
3+
--FILE--
4+
<?php
5+
6+
require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'container_var.inc';
7+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'test_const_resource_offsets.inc';
8+
9+
?>
10+
--EXPECTF--
11+
Read before write:
12+
13+
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line %d
14+
15+
Warning: Undefined array key 3 in %s on line %d
16+
NULL
17+
Write:
18+
19+
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line %d
20+
Read:
21+
22+
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line %d
23+
string(1) "v"
24+
Read-Write:
25+
26+
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line %d
27+
isset():
28+
29+
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line %d
30+
bool(true)
31+
empty():
32+
33+
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line %d
34+
bool(false)
35+
Coalesce():
36+
37+
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line %d
38+
string(7) "vappend"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Non Numeric string offset behaviour
3+
--FILE--
4+
<?php
5+
6+
require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'container_var.inc';
7+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'test_const_string_non_numeric_offsets.inc';
8+
9+
?>
10+
--EXPECTF_EXTERNAL--
11+
../expect_valid_offsets.txt
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Numeric float with fractional part string offset behaviour
3+
--FILE--
4+
<?php
5+
6+
require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'container_var.inc';
7+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'test_const_string_numeric_float_with_fractional_offsets.inc';
8+
9+
?>
10+
--EXPECTF_EXTERNAL--
11+
../expect_valid_offsets.txt
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Float without fractional part offset behaviour
3+
--FILE--
4+
<?php
5+
6+
require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'container_var.inc';
7+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'test_const_string_numeric_float_without_fractional_offsets.inc';
8+
9+
?>
10+
--EXPECTF_EXTERNAL--
11+
../expect_valid_offsets.txt
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Numeric integer string offset behaviour
3+
--FILE--
4+
<?php
5+
6+
require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'container_var.inc';
7+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'test_const_string_numeric_int_offsets.inc';
8+
9+
?>
10+
--EXPECTF_EXTERNAL--
11+
../expect_valid_offsets.txt
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
true offset behaviour
3+
--FILE--
4+
<?php
5+
6+
require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'container_var.inc';
7+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'test_const_true_offsets.inc';
8+
9+
?>
10+
--EXPECTF_EXTERNAL--
11+
../expect_valid_offsets.txt
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?php
2+
$container = [];
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Read before write:
2+
Cannot access offset of type %s on array
3+
Write:
4+
Cannot access offset of type %s on array
5+
Read:
6+
Cannot access offset of type %s on array
7+
Read-Write:
8+
Cannot access offset of type %s on array
9+
isset():
10+
Cannot access offset of type %s in isset or empty
11+
empty():
12+
Cannot access offset of type %s in isset or empty
13+
Coalesce():
14+
Cannot access offset of type %s on array
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Read before write:
2+
3+
Warning: Undefined array key %s in %s on line %d
4+
NULL
5+
Write:
6+
Read:
7+
string(1) "v"
8+
Read-Write:
9+
isset():
10+
bool(true)
11+
empty():
12+
bool(false)
13+
Coalesce():
14+
string(7) "vappend"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
Empty array offset behaviour
3+
--FILE--
4+
<?php
5+
6+
require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'container_var.inc';
7+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'dimension_var_array.inc';
8+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'test_variable_offsets.inc';
9+
10+
?>
11+
--EXPECTF_EXTERNAL--
12+
../expect_invalid_offsets.txt
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
false offset behaviour
3+
--FILE--
4+
<?php
5+
6+
require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'container_var.inc';
7+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'dimension_var_false.inc';
8+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'test_variable_offsets.inc';
9+
10+
?>
11+
--EXPECTF_EXTERNAL--
12+
../expect_valid_offsets.txt
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
--TEST--
2+
Float with fractional part offset behaviour
3+
--FILE--
4+
<?php
5+
6+
require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'container_var.inc';
7+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'dimension_var_float_with_fractional.inc';
8+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'test_variable_offsets.inc';
9+
10+
?>
11+
--EXPECTF--
12+
Read before write:
13+
14+
Deprecated: Implicit conversion from float 5.5 to int loses precision in %s on line %d
15+
16+
Warning: Undefined array key 5 in %s on line %d
17+
NULL
18+
Write:
19+
20+
Deprecated: Implicit conversion from float 5.5 to int loses precision in %s on line %d
21+
Read:
22+
23+
Deprecated: Implicit conversion from float 5.5 to int loses precision in %s on line %d
24+
string(1) "v"
25+
Read-Write:
26+
27+
Deprecated: Implicit conversion from float 5.5 to int loses precision in %s on line %d
28+
isset():
29+
30+
Deprecated: Implicit conversion from float 5.5 to int loses precision in %s on line %d
31+
bool(true)
32+
empty():
33+
34+
Deprecated: Implicit conversion from float 5.5 to int loses precision in %s on line %d
35+
bool(false)
36+
Coalesce():
37+
38+
Deprecated: Implicit conversion from float 5.5 to int loses precision in %s on line %d
39+
string(7) "vappend"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
Float without fractional part offset behaviour
3+
--FILE--
4+
<?php
5+
6+
require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'container_var.inc';
7+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'dimension_var_float_without_fractional.inc';
8+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'test_variable_offsets.inc';
9+
10+
?>
11+
--EXPECTF_EXTERNAL--
12+
../expect_valid_offsets.txt
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
Integer offset behaviour
3+
--FILE--
4+
<?php
5+
6+
require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'container_var.inc';
7+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'dimension_var_int.inc';
8+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'test_variable_offsets.inc';
9+
10+
?>
11+
--EXPECTF_EXTERNAL--
12+
../expect_valid_offsets.txt
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
null offset behaviour
3+
--FILE--
4+
<?php
5+
6+
require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'container_var.inc';
7+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'dimension_var_null.inc';
8+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'test_variable_offsets.inc';
9+
10+
?>
11+
--EXPECTF_EXTERNAL--
12+
../expect_valid_offsets.txt
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
Object offset behaviour
3+
--FILE--
4+
<?php
5+
6+
require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'container_var.inc';
7+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'dimension_var_object.inc';
8+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'test_variable_offsets.inc';
9+
10+
?>
11+
--EXPECTF_EXTERNAL--
12+
../expect_invalid_offsets.txt

0 commit comments

Comments
 (0)