Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Passing NULL to trim() is not allowed anymore in PHP 8.1. The code even explicitly checks for NULL (and not just an empty string), but only after the trim(.
Steps to reproduce
Proposed resolution
I'm moving the checks up to the intial if and just making it a general not-empty check, because an empty value also doesn't need to be trimmed. That would currently even result in an invalid value.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#10 | 3277114-entity-argument-value.patch | 2.3 KB | ChristianAdamski |
#6 | geolocation-trim-3277114-5.patch | 899 bytes | Berdir |
#5 | geolocation-trim-3277114-4.patch | 718 bytes | Berdir |
#2 | geolocation-trim-3277114-2.patch | 944 bytes | Berdir |
Comments
Comment #2
BerdirComment #3
BerdirNote: Accessing this as $item->lat/lng is IMHO preferred and faster (this creates a typed data object only to then just access the value again. $item->lat is optimized to not do that.
Comment #4
ChristianAdamski CreditAttribution: ChristianAdamski commentedLatitude / Longitude can be "0". Somewhere off Ghana in the Atlantic Ocean.
Opinion?
Comment #5
Berdirfair enough :)
How about we use the existing isEmpty() method of the item, that already explicitly checks for null and ''.
Comment #6
Berdirlol, wrong folder, sorry. lets try that again.
Comment #7
BerdirHm, various test fails on recent mariadb/mysql versions. "interesting", but I guess not directly related to this. There is one more similar problem with a preg_match. a trivial fix would be to just cast the input to string. it's similar to this case, where the code first parses $this->getValue() and only afterwards checks if there actually is a value.. so maybe another early return instead could make sense?
Comment #8
ChristianAdamski CreditAttribution: ChristianAdamski commentedpreg_match: have to look at it
Geometry fails: dear God have mercy. All the geometry functions work slightly differently MySQL5, MySQL8, MariaDB, PGSQL
Comment #10
ChristianAdamski CreditAttribution: ChristianAdamski commentedEntityArgument minor rework
Comment #12
ChristianAdamski CreditAttribution: ChristianAdamski commentedThanks!
Geometry in a separate issue