Bug #70591 [NEW]: ord() no longer yields correct results consistently
| From: | slevy1 at pipeline dot com | Date: | Sun, 27 Sep 2015 00:10:41 +0000 |
| Subject: | Bug #70591 [NEW]: ord() no longer yields correct results consistently | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-196262@lists.php.net to get a copy of this message | ||
From: slevy1 at pipeline dot com
Operating system: n/a
PHP version: 7.0.0RC3
Package: *General Issues
Bug Type: Bug
Bug description:ord() no longer yields correct results consistently
Description:
------------
I used ord() in combination with mb_strcut() to obtain the byte values
of a multibyte char utf-8 encoded. This used to work in PHP 5.4.8 -
5.5.29. But in PHP5.6-PHP7.00rc3 it doesn't work any more :(
Test script:
---------------
<?php
$str = "â¥"; // 3 byte values per above
var_dump( ord(mb_strcut($str, 0, 1) ));
var_dump( ord(mb_strcut($str, 1, 1) ));
var_dump( ord(mb_strcut($str, 2, 1) ));
see live code: https://3v4l.org/OoFus
Expected result:
----------------
I expected the var dumps to produce decimal results as follows:
226
153
165
Actual result:
--------------
0
0
0
--
Edit bug report at https://bugs.php.net/bug.php?id=70591&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70591&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70591&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70591&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70591&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70591&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70591&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70591&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70591&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70591&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70591&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70591&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70591&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70591&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70591&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70591&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70591&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70591&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70591&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70591&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70591&r=mysqlcfg