File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / mbstring / tests / bug49354.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:57 2012 UTC (12 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
Bug #49354 (mb_strcut() cuts wrong length when offset is in the middle of a multibyte character)
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--FILE--
<?php
$crap = 'AåBäCöDü';
var_dump(mb_strcut($crap, 0, 100, 'UTF-8'));
var_dump(mb_strcut($crap, 1, 100, 'UTF-8'));
var_dump(mb_strcut($crap, 2, 100, 'UTF-8'));
var_dump(mb_strcut($crap, 3, 100, 'UTF-8'));
var_dump(mb_strcut($crap, 12, 100, 'UTF-8'));
var_dump(mb_strcut($crap, 13, 100, 'UTF-8'));
?>
--EXPECT--
string(12) "AåBäCöDü"
string(11) "åBäCöDü"
string(11) "åBäCöDü"
string(9) "BäCöDü"
string(0) ""
bool(false)

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>