nette / bootstrap

🅱 The simple way to configure and bootstrap your Nette application.
https://doc.nette.org/bootstrap
Other
663 stars 36 forks source link

Cache key of generated container should depend on PHP version #43

Closed JanTvrdik closed 8 years ago

JanTvrdik commented 8 years ago

Container generated on PHP 7 is invalid on PHP 5 due to return types.

Line hint: https://github.com/nette/bootstrap/blob/27b35e20a8c9d19e2d040a85112adc53455ded1b/src/Bootstrap/Configurator.php#L215-L218

dg commented 8 years ago

Can you send PR?

JanTvrdik commented 8 years ago

Not sure whether it should depend on PHP_VERSION_ID or PHP_MAJOR_VERSION. If someone builds container on another server before deploying to production, the PHP version might slightly differ.

Majkl578 commented 8 years ago

How about dependency on minor version? Like PHP_VERSION_ID - PHP_RELEASE_VERSION?

JanTvrdik commented 8 years ago

That seems like a reasonable compromise.

dg commented 8 years ago

Imho it is not needed at all, you should delete cache when you downgrade major php version, but to add PHP_MAJOR_VERSION to key is good compromise.

JanTvrdik commented 8 years ago

@dg My use-case is that I switch PHP versions all the time. Mostly because I have PHP 5.6 with xdebug and PHP 7 without xdebug.

PHP_MAJOR_VERSION to key is good compromise

It is good for now, but PHP syntax may change in future minor versions as well. So I think that depending on minor versions seems like the best future-proof solution.

dg commented 8 years ago

Ok