Skip to content

Commit e9ce2e0

Browse files
committed
Add objects as offset in tests
1 parent a7efe0f commit e9ce2e0

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

Zend/tests/offsets/runtime_compile_time_offset_access.phpt

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,18 @@ test;
7777
return $fileContent;
7878
}
7979

80+
function normalize_output(string $output, string $filename): string {
81+
$output = str_replace(
82+
[$filename],
83+
['%s'],
84+
$output
85+
);
86+
87+
$output = preg_replace('/\)#\d+ \(/', ')#99 (', $output);
88+
89+
return $output;
90+
}
91+
8092
$const_dim_filename = __DIR__ . DIRECTORY_SEPARATOR . 'compare_binary_offsets_temp.php';
8193

8294
ob_start();
@@ -88,11 +100,7 @@ foreach ($containers as $container_orig) {
88100
include $const_dim_filename;
89101
$constOutput = ob_get_contents();
90102
ob_clean();
91-
$constOutput = str_replace(
92-
[$const_dim_filename],
93-
['%s'],
94-
$constOutput
95-
);
103+
$constOutput = normalize_output($constOutput, $const_dim_filename);
96104

97105
$dimension = $offset;
98106
$container = $container_orig;
@@ -102,11 +110,7 @@ foreach ($containers as $container_orig) {
102110
include $var_dim_filename;
103111
$varOutput = ob_get_contents();
104112
ob_clean();
105-
$varOutput = str_replace(
106-
[$var_dim_filename],
107-
['%s'],
108-
$varOutput
109-
);
113+
$varOutput = normalize_output($varOutput, $var_dim_filename);
110114

111115
if ($constOutput !== $varOutput) {
112116
file_put_contents(__DIR__ . DIRECTORY_SEPARATOR . "debug_{$failuresNb}_const.txt", $constOutput);

Zend/tests/offsets/test_offset_helpers.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ $offsets = [
160160
(string) PHP_INT_MAX * 2,
161161
(string) PHP_INT_MIN * 2,
162162
[],
163+
new stdClass(),
164+
new ArrayObject(),
165+
new A(),
166+
new B(),
163167
];
164168

165169
$failures = [];

0 commit comments

Comments
 (0)