Skip to content

Commit fc6e9b3

Browse files
authored
PHPC-1839: Use json_decode to produce a non-interned string in typeMap test (#1985)
1 parent 6ecaefe commit fc6e9b3

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

tests/bson/bug1839-005.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ require_once __DIR__ . "/../utils/basic.inc";
66

77
function createTypemap()
88
{
9-
// Assemble the string so as to not have an interned string
10-
$rootValue = chr(ord('a')) . 'rray';
11-
$documentValue = chr(ord('a')) . 'rray';
9+
// Use json_decode to produce a non-interned string that opcache cannot optimise
10+
$rootValue = json_decode('"array"');
11+
$documentValue = json_decode('"array"');
1212

1313
// Use a reference to this non-interned string in the type map
1414
$typemap = ['root' => &$rootValue, 'document' => &$documentValue];

tests/bson/bug1839-006.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ PHPC-1839: Referenced, local, non-interned string in typeMap (PHP >= 8.1)
44
<?php
55
require_once __DIR__ . "/../utils/basic.inc";
66

7-
// Assemble the string so as to not have an interned string
8-
$rootValue = chr(ord('a')) . 'rray';
9-
$documentValue = chr(ord('a')) . 'rray';
7+
// Use json_decode to produce a non-interned string that opcache cannot optimise
8+
$rootValue = json_decode('"array"');
9+
$documentValue = json_decode('"array"');
1010

1111
$typemap = ['root' => &$rootValue, 'document' => &$documentValue];
1212
$bson = MongoDB\BSON\Document::fromPHP((object) []);

0 commit comments

Comments
 (0)