From: Operating system: linux/ubuntu 10.04 PHP version: 5.3.8 Package: mbstring related Bug Type: Bug Bug description:mb_substr reaches max execution time even on 200 character text
Description: ------------ mb_substr reaches max execution time of 30s even when it should subtract small amount of characters. In our case blog posts content (around 200 characters) was not been substracted to 140 with mb_substr. Workaround which does not bypass the max execution time is to use the following instead: utf8_encode(substr(utf8_decode($str),$start,$length)) which looks ugly but at least works :) Test script: --------------- $utf8Text = "Terveisiä Pohjanmaalta! Anoppilaan kävi matka näin syyslomaviikon edellä ja ajattelin tehdä pienen tilannekatsauksen kesärenkaiden suhteen. Kilometrit 15.10.2011 Hakka Bluet ovat rullanneet auton alla noin 1200 kilometriä, eivätkä renkaat ole aiheuttaneet hämmennystä. Sekä allekirjoittanut että muut autoa käyttäneet ovat tyytyväisiä. Koska ajo on ollut lähinnä työmatka-ajoa sekä rauhallista maantieajoa, ei mitään suuria ajo-ominaisuuskoitoksia ole matkan varrelle sattunut. Lähinnä tällä viikolla pari pakkasaamua ovat aiheuttaneet kiinnostusta pidon suhteen, mutta mustaa jäätäkään ei ole löytynyt sen vertaa, että ajonvakautus olisi edes herännyt. Kaikki siis hyvin, mennään hiljaa ja matalalla."; $short = mb_substr($utf8Text, 0, 140, "UTF-8"); Expected result: ---------------- subtracted result. ie $short == "Terveisiä Pohjanmaalta! Anoppilaan kävi matka näin syyslomaviikon edellä ja ajattelin tehdä pienen tilannekatsauksen kesärenkaiden suhteen. Kilometrit" Actual result: -------------- max execution time of 30s reached error -- Edit bug report at https://bugs.php.net/bug.php?id=60076&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60076&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60076&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60076&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60076&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60076&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60076&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60076&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60076&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60076&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60076&r=support Expected behavior: https://bugs.php.net/fix.php?id=60076&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60076&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60076&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60076&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60076&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=60076&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60076&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60076&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60076&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60076&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60076&r=mysqlcfg