Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NTO-180 merged upstream changes #10

Merged
merged 151 commits into from
Mar 28, 2024
Merged

NTO-180 merged upstream changes #10

merged 151 commits into from
Mar 28, 2024

Conversation

akhumphrey
Copy link

No description provided.

alquerci and others added 30 commits October 5, 2022 18:34
* Add apcu for PHP 5.5+
* Disable APC on PHP 7+ as APCu 5 is not supported
* Add ability to use a custom test runtime

Co-authored-by: Thomas <th@it-solutions-hirsch.de>
…pose

Add consistent local environment for testing with docker and docker-compose
…h-to-github-actions

Use GitHub actions for Continuous Integration tests
https://wiki.php.net/rfc/internal_method_return_types

PHP 8.0 added return type for abstract methods on Iterator, ArrayAccess, Countable, IteratorAggregate
PHP 8.1 made non implementation as a Deprecated Warning
PHP 9.0 (no release date at this moment) will drop the support.

Temporary Fix : adding this Attribute
Will drop the Deprecated warning.

Adding return type will break compatibility before PHP 7.4,
Return type has been added on PHP 7.0, but "mixed" special type is required, and it has been added on PHP 7.4.
In order to be compatible with future PHP 9.0, once it will be release, we will have to drop the support to PHP Version before 7.4

Currently a lot of Unix distribution in LTS are running a PHP Version older than 7.4 so moving to the final solution of "add return type" should break a lot of setup for the moment.
https://wiki.php.net/rfc/phase_out_serializable

PHP 7.4 add a new Serialize mecanism
PHP 8.1 made old method, "Serializable implementation" deprecated
PHP 9.0 (no release date at this moment) will drop the support.

Temporary Fix: Adding both method serialize/unserialize and __serialize/__unserialize

In order to be compatible with future PHP 9.0, once it will be release, we will have to drop the support to PHP Version before 7.4.

Currently a lot of Unix distribution in LTS are running a PHP Version older than 7.4 so moving to the final solution of "add return type" should break a lot of setup for the moment.

Each class has been serialized/unserialized and compared on PHP 8.1.2 and 5.6.30
…parameters

Mainly ensure use of string instead of null / false by casting the variable into (string)
Also fix method/function arguments with default value must be at the end.

Thanks to @teymour
FriendsOfSymfony1@cba71a4
2 possible workaround, use partial implementation with php date method or use IntlDateFormatter.
As symfony1 is not intended to evolve, it should not rely on currently unused PHP-Extension (nor update composer.json).

I propose a fix to replace "strftime" by "date", with a translation of format for PHP 8.1+

It will lose the ability of translating date of logs (does anybody use it ?) and it will deprecated a few strftime format (probably not used)
Performances should remains OK

I only tested it with a few formats (the default one and a few others)
If you need some missing strftime formats, please add them.
sfException> fileExcerpt file can be null, and PHP 8.1 do not allow null on is_readable()

sfBrowser> Move sf_test conf before getContext, because getContext can throw some sfException, which will raise some printStackTrace, hidden by another Exception "header already sent ..."

lime.php> some trace can have no "file" (internal methods call)
lime.php> handle_exception can handle Error/Throwable, not avaialble under php7.2: remove typing

sfTestFunctionalBase> can throw exception

Fix Select Unit test NewActivePendingExpired.
DomDocument on recent php return a list of values, not concatened ones.

Fix SessionStorage UnitTest.

sfSessionStorage could not be restarted.
Flag $sessionStarted as false when shutdown to avoid error during unit test which can start several sfSessionStorage

Storage need to be shutdown to avoid:
PHP Warning:  session_name(): Session name cannot be changed when a session is active
… "error" value

uncaught exception does not populate error field
…ated, return an integer less than, equal to, or greater than zero
ValueError: fread(): Argument #2 ($length) must be greater than 0

TypeError: count(): Argument #1 ($value) must be of type Countable|array Foo Given
Use Symfony Polyfill symfony/polyfill@d330c00

TypeError: count(): Argument #1 ($value) must be of type Countable|array, string given
Do not use Symfony pollyfill, is_array is enought
… null, $accept = false) must be compatible with sfPearRest::downloadHttp($url, $lastmodified = null, $accept = false, $channel = false)
8.0.0 	hour is no longer optional.
8.0.0 	minute, second, month, day and year are nullable now.
Numeric strings ending with whitespace ("42 ") will now return true. Previously, false was return instead.

Use same fix has main maintened Yaml lib :
symfony/yaml@4152e36
+ performance improvement
symfony/yaml@2b5f2ae
When $previousIndent was equal to 0, and $matches['indent'] = "    "

PHP(before 8.0)> (0 != "    ") ==> false
PHP8.0+ > (0 != "     ")  ==> true

In order to keep "false" value we avoid "0" as a valid value.

More details here why here:
https://www.php.net/manual/en/migration80.incompatible.php
/bin/ls can be reported as:
- application/x-sharedlib
- application/x-executable
- application/x-pie-executable
Ensure compatibility with PHP 8.0 & 8.1
@akhumphrey akhumphrey marked this pull request as ready for review March 28, 2024 03:04
@akhumphrey akhumphrey merged commit 1140aa1 into master Mar 28, 2024
2 checks passed
@akhumphrey akhumphrey deleted the integration branch March 28, 2024 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants