WPTT / theme-sniffer

Theme Sniffer plugin using sniffs.
MIT License
269 stars 3 forks source link

Cast PHP version as string #205

Closed ernilambar closed 4 years ago

ernilambar commented 4 years ago

Cast PHP version as string

Fix #204

dingo-d commented 4 years ago

This is odd as it should work as-is. PHP will probably (should) cast the integer value of PHP_VERSION_ID to string when doing the comparison.

https://3v4l.org/5A0pr

ernilambar commented 4 years ago

Yes, its odd. And I have also seen this first time. version_compare(70402, '70000', '<') and this is giving fatal error.

May be @jrfnl have some idea about this issue.

jrfnl commented 4 years ago

This could (should) only happen if strict types is being enforced, which AFAIK, it isn't in this application. See: https://3v4l.org/17GkX

So how are you invoking the application or is there anything in your setup which is causing strict types to be in effect ?

ernilambar commented 4 years ago

@jrfnl We are using strict_types. https://github.com/WPTT/theme-sniffer/blob/development/src/class-plugin.php#L8

dingo-d commented 4 years ago

Ok, this is then an overlook on my part. Totally forgot about strict types 🙈

jrfnl commented 4 years ago

Ah, well, that explains it :grinning: