Skip to content

Commit 59ac77f

Browse files
committed
Zend: Add tests for offsets and containers
1 parent ed6e289 commit 59ac77f

File tree

286 files changed

+4051
-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

+4051
-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: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--TEST--
2+
Object offset behaviour
3+
--XFAIL--
4+
Bug Coalesce operator with constant offset emits isset/empty error in JIT
5+
--FILE--
6+
<?php
7+
8+
require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'container_var.inc';
9+
require dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'test_const_object_offsets.inc';
10+
11+
?>
12+
--EXPECTF_EXTERNAL--
13+
../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

0 commit comments

Comments
 (0)