zubr icon indicating copy to clipboard operation
zubr copied to clipboard

Handle different PHP versions

Open nkkollaw opened this issue 7 years ago • 3 comments

As mentioned in the README, Zubr supports PHP >= 7.0.0.

However, there are some differences between PHP 7.0, 7.1, and 7.2 that we'll have to account for.

PHP 7.1

For instance, 7.1 introduces a few functions that aren't present in 7.0: http://php.net/manual/en/migration71.new-functions.php

There are also changed functions (see http://php.net/manual/en/migration71.changed-functions.php), and finally some backward-imcompatible changes (see http://php.net/manual/en/migration71.incompatible.php).

PHP 7.2

There is no migration guide yet that I can link to, but there will be incompatibilities here as well.

Possible solutions

We could/should probably check that a function exists before calling it, and do something if it doesn't.

We could also have switch statements to account for changes between versions (?).

Opinions..?

nkkollaw avatar Aug 05 '17 10:08 nkkollaw

I think we should look whether function is declared before declaring it's wrapper

ddziaduch avatar Aug 07 '17 06:08 ddziaduch

I think that @ddziaduch is right - we should bother in wrapping only existing functions (eg in PHP 7.0 Zubr\session_gc() should throw an exception).

Regarding changed functions - maybe we should stick to the latest API. Eg. getopt() received in 7.1 new argument. We could simply trigger_error when someone sets $optind argument on PHP 7.0. What do you think about it?

radmen avatar Aug 07 '17 09:08 radmen

Yes, I think we should both check if the function exists before wrapping it, and consider changed parameters.

Although, if one called a function that didn't exist, Zubr would already trigger an error by calling it...

nkkollaw avatar Aug 07 '17 09:08 nkkollaw