Fix PHP8.2 str_split function returns empty arrays for empty strings#588
Fix PHP8.2 str_split function returns empty arrays for empty strings#588HuongNV13 wants to merge 1 commit intotecnickcom:mainfrom
Conversation
|
Unfortunately mb_str_split() was only introduced in php7.4 which will make swapping this out trickier. |
Thanks for the hint! |
|
or maybe just |
1a5a931 to
c5ed6b2
Compare
c5ed6b2 to
ae4f2e8
Compare
|
Thanks, everyone. |
|
I think this is not a valid fix as mb_str_split() behaves the same way as str_split() in PHP 8.2 and above. |
| foreach ($qrTab as $line) { | ||
| $arrAdd = array(); | ||
| foreach (str_split($line) as $char) { | ||
| $chars = function_exists('mb_str_split') ? mb_str_split($line) : str_split($line); |
There was a problem hiding this comment.
Looks like incorrect indentation, project uses tabs while this code introduces spaces. Same can be said about all other new lines in this MR.
|
Please try to resolve the conflicts. |
|
Hi Nicola, Thanks, |
|
Hi, |
Very good idead This PR should be marked as draft for now |
In PHP 8.2, the str_split function will returns empty arrays for empty strings.
See: https://php.watch/versions/8.2/str_split-empty-string-empty-array
We can use mb_str_split() instead