1.2.670. Mbstring Third Arg¶
Some mbstring functions use the third argument for offset, not for encoding.
Those are the following functions :
<?php
// Display BC
echo mb_substr('ABC', 1 , 2, 'UTF8');
// Yields Warning: mb_substr() expects parameter 3 to be int, string given
// Display 0 (aka, substring from 0, for length (int) 'UTF8' => 0)
echo mb_substr('ABC', 1 ,'UTF8');
?>
1.2.670.1. Connex PHP features¶
1.2.670.1.1. Suggestions¶
Add a third argument
Use the default encoding (aka, omit both third AND fourth argument)
1.2.670.1.2. Specs¶
Short name |
Structures/MbstringThirdArg |
Rulesets |
|
Exakat since |
1.9.9 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Available in |