Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 2 additions & 5 deletions ext/standard/BuiltinIntrospectionPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,8 @@ public static function functionIsAdvertised(string $functionName): bool
if ('stream_context_set_options' === $lc) {
return CompilerVersion::advertisesStreamContextSetOptions();
}
if ('grapheme_str_contains' === $lc) {
return CompilerVersion::advertisesGraphemeStrContains();
}
if ('grapheme_strimwidth' === $lc) {
return CompilerVersion::advertisesGraphemeStrimwidth();
if ('grapheme_str_contains' === $lc || 'grapheme_strimwidth' === $lc) {
return IntlExtensionPolicy::advertisesBuiltins();
}
if (\in_array($lc, [
'grapheme_strlen',
Expand Down
2 changes: 2 additions & 0 deletions test/compliance/cases/stdlib/grapheme_phantom.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ declare(strict_types=1);

$phantom = function_exists('grapheme_strlen')
|| function_exists('grapheme_str_split')
|| function_exists('grapheme_str_contains')
|| function_exists('grapheme_strimwidth')
|| function_exists('intl_get_error_code')
|| function_exists('intl_get_error_message')
|| function_exists('intl_is_failure');
Expand Down
4 changes: 2 additions & 2 deletions test/compliance/cases/stdlib/grapheme_profile_84.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ echo "\n";
echo count(grapheme_str_split($s)), "\n";
?>
--EXPECT--
false
true
true
true
false
hello
false
2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

declare(strict_types=1);

if (!function_exists('grapheme_str_contains') || !function_exists('grapheme_strimwidth')) {
echo "fail: function_exists false on forward 8.4 profile\n";
/**
* Forward 8.4 profile: grapheme helpers callable but not advertised without ext/intl (#11825).
*/

if (\function_exists('grapheme_str_contains') || \function_exists('grapheme_strimwidth')) {
echo "fail: function_exists true without intl\n";
exit(1);
}
if (!grapheme_str_contains('hello', 'ell') || 'hello' !== grapheme_strimwidth('hello', 0, 10)) {
Expand Down
13 changes: 4 additions & 9 deletions test/unit/ForwardProfilePhantomIntrospectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,11 @@ public function testGraphemeProfile84BuiltinsCallableButNotAdvertisedWithoutIntl
'grapheme_strpos',
'grapheme_extract',
'grapheme_str_split',
'grapheme_str_contains',
'grapheme_strimwidth',
] as $fn) {
$this->assertFalse(BuiltinIntrospectionPolicy::functionIsAdvertised($fn));
}
foreach (['grapheme_str_contains', 'grapheme_strimwidth'] as $fn) {
$this->assertTrue(BuiltinIntrospectionPolicy::functionIsAdvertised($fn));
}

$runtime = new Runtime();
$ctx = $runtime->vmContext;
Expand All @@ -289,18 +288,14 @@ public function testGraphemeProfile84BuiltinsCallableButNotAdvertisedWithoutIntl
'grapheme_strpos',
'grapheme_extract',
'grapheme_str_split',
'grapheme_str_contains',
'grapheme_strimwidth',
] as $fn) {
$this->assertTrue(isset($ctx->functions[$fn]));
$this->assertFalse(
\PHPCompiler\ext\standard\VmReflection::functionExists($ctx, $fn)
);
}
foreach (['grapheme_str_contains', 'grapheme_strimwidth'] as $fn) {
$this->assertTrue(isset($ctx->functions[$fn]));
$this->assertTrue(
\PHPCompiler\ext\standard\VmReflection::functionExists($ctx, $fn)
);
}
} finally {
if (false === $prev) {
putenv('PHP_COMPILER_PROFILE');
Expand Down