Skip to content

Commit ed64949

Browse files
committed
strtok is not comptime()
Fixes GH-13145 Closes GH-13148
1 parent 00ea756 commit ed64949

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ PHP NEWS
1010
. Fixed bug GH-12996 (Incorrect SCRIPT_NAME with Apache ProxyPassMatch when
1111
plus in path). (Jakub Zelenka)
1212

13+
- Opcache:
14+
. Fixed bug GH-13145 (strtok() is not comptime). (ilutov)
15+
1316
- Phar:
1417
. Fixed bug #71465 (PHAR doesn't know about litespeed). (nielsdos)
1518

Zend/tests/gh13145.phpt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
GH-13145: strtok() misoptimization
3+
--FILE--
4+
<?php
5+
$tok = strtok("This is\tan example\nstring", " \n\t");
6+
while ($tok !== false) {
7+
var_dump($tok);
8+
$tok = strtok(" \n\t");
9+
}
10+
?>
11+
--EXPECT--
12+
string(4) "This"
13+
string(2) "is"
14+
string(2) "an"
15+
string(7) "example"
16+
string(6) "string"

ext/standard/basic_functions.stub.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2337,7 +2337,6 @@ function implode(string|array $separator, ?array $array = null): string {}
23372337
function join(string|array $separator, ?array $array = null): string {}
23382338

23392339
/**
2340-
* @compile-time-eval
23412340
* @refcount 1
23422341
*/
23432342
function strtok(string $string, ?string $token = null): string|false {}

ext/standard/basic_functions_arginfo.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)