Closed GeorgeFive closed 11 months ago
Ah i didn't think of that, i use php 8.1 You use a php version smaller then 7 as i understand? That is out of support so that is not wise to use anymore
If this is the only problem i can add this but i'm not sure how i should implant this?
If there are more problems related to old php versions i suggest you try to update your php version.
You don't have to change any of your code, just tack that quick little function down at the bottom of title.php or something that is called from every script (not at a PC right now so can't look). If a user is using PHP>=7, it will work as normal. If they're using a lesser version, it will use that function (which does the same thing as the official implementation).
Personally, I use an older version because of some legacy code that cannot be easily updated, but is integral to the site functionality.
Anyway, I don't expect you to completely rewrite your code, but most compatibility issues can be fixed with stuff like this.... and at a glance, that's the only issue preventing it from being compatible with older versions.
Well every version below php 8 is eol so i don't feel comfortable to add legacy code for unsupported PHP versions.
you can however implant this yourself but i strongly suggest to upgrade and upgrade your legacy code accordingly I have dealt with this problem myself (my program was written in php version 4) so i rewrote the code.
replacing array_key_last with this is a option: $lastKey = key(array_slice($array, -1, 1, true)); but it is slower
Your purposal is not 100% Because this technique will ONLY work on indexed (gapless integer keys starting from zero) arrays. This is almost always the case in title class but to be shure i wont use that
Fair enough, I totally get where you're coming from. Was throwing this out there for my own personal use, and it may come up later from other users as well....?
another user was already complaining that there are methods missing in title class so i can't make everybody happy i guess
I will consider, if that is the only thing from stopping you to use it, to change it to $lastKey = key(array_slice($array, -1, 1, true)); So i suggest to fully test it and report back to me.
I haven't touched person.php yet, but so far, that's the only compatibility issue I've come across. I'm trying to test as much as I can, as quick as I can.... but with 14+ hour work days this week, I'm strapped for time and only able to do small chunks.
take your time, no rush!
I.m re open this, maybe other users have the same problem I consider to change it to a older method so php 5.6 or higher is working
Got another issue with the code changes from #8 :
PHP Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW) in this line: usort($this->goofs, fn($a, $b) => $a['type'] <=> $b['type'])
I don't use this function, so I can safely strip it out of my release.... just throwing this out there.
mm i think this comes from the fact that you use a older php version
I have remove it, the output array is not sorted but the data is still in place
I replaced all array_key_last to the other solution we talked about. The performance impact is small so after all no big deal.
The only reason it slightly bothers me is that there is finally a good solution, array_key_last(), but for compatibility reasons not usable here
If this is working right report it back here so we can close this issue successfully :)
EDIT: see #13 this is no longer an issue as i converted them to array (remains the other solution by director, composer, writer and producer for now)
I am currently using your code "straight out of the box" with no compatibility changes, so looks good!
I use an earlier version of PHP, so technically, this is not compatible with my setup. While I've only done a quick runthrough of the code, SO FAR, I can get around this pretty simply....
title.php, add:
Will dig in more as time allows....