Skip to content

Update to upstream #6

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

Open
wants to merge 51 commits into
base: master
Choose a base branch
from
Open

Update to upstream #6

wants to merge 51 commits into from

Conversation

MiguelAlcaino
Copy link

@MiguelAlcaino MiguelAlcaino commented Aug 18, 2023

This updates the master branch to the latest version of the upstream branch.

There was a conflict to resolve related to @wutsch0 's fix made here: #1 , which according to @wutsch0 it was not included in the FOS's repository #4 (review), but checking the history of the file, they applied his fix but then decided to go for a different solution in case of 0, check that here: https://github.com/FriendsOfSymfony1/symfony1/commits/master/lib/validator/sfValidatorBoolean.class.php
At the end I ended up overwriting @wutsch0 's changes with the changes coming from the upstream's repo.

According to my calculations, we should be fine with just pulling https://github.com/FriendsOfSymfony1/symfony1 from php-mozart's composer.json file.

Detective Miguel off 🔍

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 <[email protected]>
…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
thirsch and others added 21 commits December 13, 2022 19:54
…-8.1-fixes

Fix(php) Fix a few more php 8 issues
…ndsOfSymfony1#277)

* Fix(deprecations) Fix deprecations in sfMessageSource_Aggregate, add return types from implemented sfIMessageSource
# Conflicts:
#	lib/validator/sfValidatorBoolean.class.php
@MiguelAlcaino MiguelAlcaino requested review from wutsch0 and deiga August 18, 2023 15:00
Copy link

@pen-amboss pen-amboss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's try it! 😬
I kinda wonder why the GH action CI is failing at us, while it's green on the upstream… but 🤷

Copy link

@wutsch0 wutsch0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have found the original reason why I introduced the fix:
https://github.com/amboss-mededu/php-mozart/blob/dd4f50bb134a8c060d0fe886a110af45b0a46dbe/lib/form/doctrine/CompleteProfileUserProfileForm.class.php#L136-L141 (and another place in AbstractSfGuardUserProfileUsmleForm which got removed already). Since there is a workaround implemented in the forms as well, its save to remove my fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants