1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.2'

* PHP-8.2:
  Added negative offset test for mb_strrpos
  Fix segfault in mb_strrpos/mb_strripos with ASCII encoding and negative offset
This commit is contained in:
Ilija Tovilo
2023-05-15 10:41:22 +02:00
2 changed files with 18 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
--TEST--
GH-11217: Segfault in mb_strrpos/mb_strripos with ASCII encoding and negative offset
--EXTENSIONS--
mbstring
--FILE--
<?php
var_dump(mb_strrpos('foo', 'foo', -1, 'ASCII'));
var_dump(mb_strripos('foo', 'foo', -1, 'ASCII'));
?>
--EXPECT--
int(0)
int(0)

View File

@@ -22,6 +22,9 @@ var_dump(mb_strrpos($string_ascii, 'is', 4, 'ISO-8859-1'));
echo "\n-- ASCII string 2 --\n";
var_dump(mb_strrpos($string_ascii, 'hello, world'));
echo "\n-- ASCII string with negative offset --\n";
var_dump(mb_strrpos($string_ascii, 'hello', -1, 'ISO-8859-1'));
echo "\n-- Multibyte string 1 --\n";
$needle1 = base64_decode('44CC');
var_dump(mb_strrpos($string_mb, $needle1));
@@ -41,6 +44,9 @@ int(15)
-- ASCII string 2 --
bool(false)
-- ASCII string with negative offset --
bool(false)
-- Multibyte string 1 --
int(20)