-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iconv_substr behaves differently under PHP8 #31
Comments
That's a great catch! Thank you @Megatherium |
I would also prefer if only single use cases are fixed. might bring up other issues in the code. I quickly skimmed over symfony/polyfill, do they deal with this problem solving, but seems no. |
Perhaps it's regression created by this project? Found this line in changelog:
|
Depends on how you wanna look at it. <?php
foreach (['a', 'ab', 'abc'] as $str) {
var_dump(iconv_substr($str, 2, 2));
} for i in 56 74 80 ; do echo $i ; docker run -v /tmp:/tmp --rm phpdockerio/php$i-cli php /tmp/iconv_test.php; done
56
bool(false)
bool(false)
string(1) "c"
74
bool(false)
string(0) ""
string(1) "c"
80
string(0) ""
string(0) ""
string(1) "c" Also I'm encoutering some other stuff on the way that needs fixing for the tests to succeed. Do you want to keep the scope of the PR narrow or should I push basically a full PHP8 compat branch? |
a full PHP8 compat branch would be the bomb 💣💥 💚 |
The PHP8 branch is basically ready. |
Ok. Everything's ready. Everything passes, except: 5.4 is suddenly failing at a point where nothing was even changed. That behaviour is something you'd expect from PHP7+ (was is why that test is skipped on 7+). Doesn't make any sense to me. Apart from that: should I hold the PR until Travis has a real 8.0 image and not snapshot/nightly? |
Nah, I am afraid it might be a long wait 🙈 Please create the PR, I'm looking forward to it! I will try to look into the php 5.4 issue. |
I think the date issues were resolved with: so this issue can be closed? |
It looks like it. Thank you for noticing. |
While testing out software with PHP8 (8.0.0~rc1-6+ubuntu18.04.1+deb.sury.org+1) I got a TypeError from mktime during basic usage of Zend_Date.
Resulted in this with PHP8
mktime
isn't the culprit in this case though. It turned out that Zend_Locale_Format was acting differently:7.4:
8.0:
As it turns oyt iconv_substr behaviour has been normalized and will now always return an empty string if the offset is out of bounds.
We have 73 usages of iconv_substr excluding tests? What's the best way to tackle this? Write a wrapper function that generates the output of iconv_substr <8.0 and replace all calls to iconv_substr with the wrapper function?
The text was updated successfully, but these errors were encountered: