Back

Most of the PHP packages out there are using this kind of php version constraint: "^8.3" (and using 8.3 in the CI). Am I the only one who thinks that this is wrong? Shouldn't it be "8.3.*"? Otherwise it would mean that you can install/use it with 8.4 as well (although we don't know if it is compatible with 8.4).

As long my package is not adapted to 8.4 or doesn't use 8.4 in the CI pipeline I wouldn't want users to use my package with 8.4 as I simply can not guarantee that it will work ...

1

149

Assuming 8.4 is backwards compatible i don't see no issue here

1

50

that's the thing with PHP. sometimes there are breaking changes in minor versions (even though they try to avoid them).

so my post was not about PHP 8.4. specifically but in general.

1

66

In response to @lentex

Do you have any example of this. In all my years working with anything above 7.1 i have not ever once encountered something like this.

I briefly asked around in my favorite Laravel telegram group, no one would have an example of this ...

1

46

  • No matching results...
  • Searching...

/ 1000

my posting initially intended to highlight that packages are not automtically compatible with new minor versions and as maintainer you should take care of that fact.

when talking about breaking changes often TypeErrors are now thrown where before it silently accepted those.

but here are some real examples:

PHP 8.2 introduced stricter error handling in fread() and fwrite(), where passing invalid arguments now throws a TypeError instead of returning false.

PHP 8.2 made compact() stricter, throwing a TypeError if any key passed is not a string. Previously, passing non-string values would result in warnings but still execute.

Some mbstring functions received stricter type checks in PHP 8.2. For example, if mb_strlen() receives an invalid argument, it now throws a TypeError instead of returning false or producing a warning.

In PHP 8.1, the default fetch mode for PDO was changed from PDO::FETCH_BOTH to PDO::FETCH_ASSOC.

1

37

and the real life issues i had are not breaking but flooded my bug reporting tool: deprecation warnings. so i'd argue that you get rid of those immediately (this would be an argument to not use ^8.something). depending on error level settings they might even break your application 🙈

37