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:
12
ext/mbstring/tests/gh11217.phpt
Normal file
12
ext/mbstring/tests/gh11217.phpt
Normal 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)
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user