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

TDT-701 remove duplication #1

Closed
wants to merge 4 commits into from
Closed

TDT-701 remove duplication #1

wants to merge 4 commits into from

Conversation

akhumphrey
Copy link

No description provided.

@akhumphrey akhumphrey added the bug Something isn't working label Apr 12, 2022
@akhumphrey akhumphrey self-assigned this Apr 12, 2022
@akhumphrey akhumphrey closed this Apr 12, 2022
@akhumphrey akhumphrey deleted the f-tdt-701 branch April 12, 2022 22:59
@akhumphrey akhumphrey restored the f-tdt-701 branch April 12, 2022 23:03
@akhumphrey akhumphrey reopened this Apr 12, 2022
@@ -6,11 +6,10 @@
* @package ##PROJECT_NAME##
Copy link
Author

Choose a reason for hiding this comment

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

These template files form the basis for how the Base<Model>Form and Base<Model>FormFilter class files get generated. It's a fascinating and kinda weird process, but the whole file is treated like a plain text file with embedded PHP tags.

You'll see that each document contains both standard <?php and odd-looking [?php tags. During the process, PHP does a first parse through the content and interprets any PHP code found within the standard <?php and <?= tags - exactly the same as any HTML document might be parsed. But importantly for this implementation, any otherwise-valid PHP code which is inside [?php or [?= tags is left alone by this process.

The output of this parsing is otherwise-valid PHP source code which is wrapped with invalid PHP opening tags. To resolve this, the content is then run through a final str_replace() to "fix" the invalid PHP tags to their standard equivalents. The original template content has now been transformed into a standard PHP source code document - held in memory - ready to be written to a file on disk.

The base Models are generated using a different mechanism, so you won't see template files here for those base classes.

All that said, while I was digging through the weeds to find the source of the bug, I happened across these template files. Previously, the generated base classes were not tracked in our repo so the generated content in those classes kinda didn't really matter. Now that we have started tracking these files into our repo, it felt appropriate that these files be generating code which more closely matches our code style/PSR requirements. The changes in the next few files are exactly that overhauling, but if you feel that's overkill, then it can be undone.

Comment on lines +38 to +41
$this->widgetSchema['<?= $alias; ?>_list'] = new sfWidgetFormDoctrineChoice([
'multiple' => true,
'model' => '<?= $table_name; ?>',
]);
Copy link
Author

Choose a reason for hiding this comment

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

Due to the way the base classes are generated, some of the content in any template file doesn't actually survive unmodified all the way through the process (and I don't mean the blocks of PHP which get interpreted during the process).

Specifically, any place where a new array is being defined using square brace syntax [] (like we see here with the options being parsed to new sfWidgetFormDoctrineChoice()) get interpolated automatically into array() syntax instead.

This interpolation is done by the PHP engine directly, and we have zero control of it unfortunately.

@@ -6,11 +6,10 @@
* @package ##PROJECT_NAME##
* @subpackage form
* @author ##AUTHOR_NAME##
* @version SVN: $Id$
Copy link
Author

Choose a reason for hiding this comment

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

It's also bugged me for years that we still have reference to Subversion (🤮) in our source code, so nuking these lines was particularly satisfying.

*
* @return array $columns
*/
public function getColumns()
Copy link
Author

Choose a reason for hiding this comment

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

This method was the source of the bug, and it appears to have existed for as much as 13 years(!).

Comment on lines -581 to -588
if (Doctrine_Relation::ONE == $relations[$relationName]->getType())
{
$columnName = $relations[$relationName]->getLocal();
if (!in_array($columnName, $relationColumns))
{
$relationColumns[] = $columnName;
$columns[] = new sfDoctrineColumn($columnName, $this->table);
}
Copy link
Author

Choose a reason for hiding this comment

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

At this point in the method, the $columns variable already contains each of the first-party properties of the model, but now we're looping through the relationships to see if any other properties need to be added.

The test being done only looks to make sure that a relationship for the current column hasn't already been added to $columns. It doesn't look to see if that column already exists in $columns as a first-party property. This means that any model which contained the one side of a one-to-many relationship would have duplication of that property in its base classes.

Comment on lines -568 to -571
foreach (array_diff(array_keys($this->table->getColumns()), $parentColumns) as $name)
/**
* Get array of sfDoctrineColumn objects that exist on the current model but not its parent.
*
* @return array $columns
*/
public function getColumns()
{
$columns[] = new sfDoctrineColumn($name, $this->table);
}
Copy link
Author

Choose a reason for hiding this comment

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

What this foreach is doing is taking all the first-party properties of the model and adding them into $columns indiscriminantly.

Comment on lines +570 to +571
$columns[] = new sfDoctrineColumn($name, $this->table);
$names[] = $name;
Copy link
Author

Choose a reason for hiding this comment

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

What has been changed is there is now a dictionary of $names which gets populated during the first-party property loop...

Comment on lines +581 to +584
if (!in_array($columnName, $names)) {
$columns[] = new sfDoctrineColumn($columnName, $this->table);
$names[] = $columnName;
}
Copy link
Author

Choose a reason for hiding this comment

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

...and we don't attempt to add another relationship-based copy of that property if we've already added it previously.

@akhumphrey akhumphrey closed this Apr 13, 2022
@akhumphrey akhumphrey deleted the f-tdt-701 branch April 13, 2022 00:30
@akhumphrey
Copy link
Author

When the code in this PR is used to generate the Base<Model>Form and Base<Model>FormFilter classes in deepwell, it creates a diff which is over 34,000 lines long. I've reverted the bulk of the changes here in favour of the absolute smallest changeset possible, and a new PR (#2) has been opened instead.

akhumphrey pushed a commit that referenced this pull request Oct 18, 2022
akhumphrey pushed a commit that referenced this pull request Oct 18, 2022
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
akhumphrey added a commit that referenced this pull request Nov 2, 2022
* Returned null if the requested controller does ont exist, as promised in the method docblock.

* Don't check the checkbox if the value is '0' or 0.

* Improved generated typehints for doctrine model classes.

* Revert "Improved generated typehints for doctrine model classes."

This reverts commit cd4243d.

* Allow swiftmailer 6

* Allowed optional installation of swiftmailer 6 if plattform >= PHP 7. Submodule for swiftmailer not required as it is also a dependency within composer.

* PHP 7.4 deprecates get_magic_quotes_gpc. Instead of checking the php-version on every pageload, let's drop PHP 5.3 support.

* Deprecated: Array and string offset access syntax with curly braces is deprecated.

* Swiftmailer6 compat.

* Swiftmailer6 compat.

* Allow swiftmailer 6

(cherry picked from commit 3622f22)

* Allowed optional installation of swiftmailer 6 if plattform >= PHP 7. Submodule for swiftmailer not required as it is also a dependency within composer.

(cherry picked from commit ba2dfe3)

* Swiftmailer6 compat.

(cherry picked from commit 2e00caa)

* Swiftmailer6 compat.

(cherry picked from commit 90c5a42)

* Check if class "Swift" is loaded.

* Another easy way for being compatbiel with swiftmailer 5 and 6!

* Reverted sfMailer changes.

* Even more reverts.

* Still 1.5.13 for our branch.

* Fixed merge conflicts.

* Is it possible to keep the submodule?

* PHP >= 5.2.4 supports stderr for reporting the error to stderr instead of stdout. This patch allows to set it as a new setting in settings.yml

* Added the new settings to WHATS_NEW.md

* Fixed deprecated non optional parameters after optional parameters.

* php 8.1 compat

* php 8.1 compat

* php 8.1 compat

* php 8.1 compat

* php 8.1 compat

* php 8.1 compat

* php 8.1 compat

* php 8.1 compat

* php 8.1 compat

* php 8.1 compat

* php 8.1 compat

* php 8.1 compat

* php 8.1 compat

* Revert "php 8.1 compat"

This reverts commit 566e652.

* php 8.1 compat

* PHP 8.1 > internal_method_return_types
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.

* PHP 8.1 > Serializable Phase Out
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

* PHP 8.0 & 8.1 > Deprecated of null to non-nullable internal function 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

* PHP 8.1 > strftime deprecated.

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.

* PHP 8.1 > Unit Test

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

* Fix lime message: "An uncaught exception has been thrown" do not have "error" value

uncaught exception does not populate error field

* PHP 8.1 > uasort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero

* Fix ValueError: DOMDocument::loadHTML(): Argument #1 ($source) must not be empty

* PHP 8.0 > fread()/count() behavior

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

* Fix Declaration of sfPearRestTest::downloadHttp($url, $lastmodified = null, $accept = false) must be compatible with sfPearRest::downloadHttp($url, $lastmodified = null, $accept = false, $channel = false)

* PHP 8.0 > mktime update
8.0.0 	hour is no longer optional.
8.0.0 	minute, second, month, day and year are nullable now.

* Fix sfWebResponse->getContentType() return a string not an array

* Fix sfDoctrineTester, string cannot be accessed as array

* PHP 8.0 > Fix is_numeric behavior with trailing empty char
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

* PHP 8.0 > String to Number Comparison.
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

* Change support to PHP 8.1

* Update Travis to PHP up to 8.1

PHP 5.3 is broken due to Letsencrypt certificate cannot download composer

PHP 5.4 do not contains apc module on (and precise has same cert problem than 5.3))

* Fix UnitTest application/x-sharedlib

/bin/ls is now application/x-sharedlib on ubuntu focal

* PHP 8.1 > mysqli_report revert to off
https://php.watch/versions/8.1/mysqli-error-mode

* WillBeRemoved, Ensure Travis is OK on PHP 8.1

It only fix one last error due to Doctrine throwing warning on PHP 8.1.
other/tasksTest, 1 subtests trying to load Doctrine_Manager.

To avoid this warning on your setup:
- Use temporary: php.ini error_reporting = E_ALL & ~E_DEPRECATED
- Use temporary: Tybaze/doctrine1, branch compat_php8.1
- Use FriendsOfSymfony1/doctrine1 once merged PR-85

* php 8.1 compat

* bumped min php version, bumped branch alias

* set more durable permissions when generating `doctrine_schema_[\d]{5}.yml`

* updated format to match existing logging

* updated method signature to match `Iterator::current()`

* disallow passing `null` to `urldecode` in `sfRoute`

* added default value for `$number` to `format_number_choice()`

* updated remaining `sfRouteCollection` iterator method signatures to match upstream

* avoid passing `null` to `urlencode()`

* avoid passing `null` to `strpos()`

* dumb syntax error

* another dumb syntax error

* Coding Style

* Code Simplification from Merge Review

* Better MYSQLI_REPORT_OFF implementations for php8.1 compat
Thanks @mentalstring

* remove full_path from uploads added on php8.1

* fix use of null on string parameter

* avoid passing `null` to `urlencode()`

* minor tweaks

* Eine Methode aufgeräumt und etwas Deutsch entfernt

Co-authored-by: Thomas A. Hirsch <thomas.hirsch@vema-eg.de>
Co-authored-by: Thomas <me@thirsch.de>
Co-authored-by: Thomas <th@it-solutions-hirsch.de>
Co-authored-by: Tybaze <tybaze@users.noreply.github.com>
Co-authored-by: Ben Tybaze <6998932+Tybaze@users.noreply.github.com>
Co-authored-by: Paulo Magalhaes <mentalstring@gmail.com>
akhumphrey added a commit that referenced this pull request Feb 24, 2023
* Returned null if the requested controller does ont exist, as promised in the method docblock.

* Don't check the checkbox if the value is '0' or 0.

* Improved generated typehints for doctrine model classes.

* Revert "Improved generated typehints for doctrine model classes."

This reverts commit cd4243d.

* Allow swiftmailer 6

* Allowed optional installation of swiftmailer 6 if plattform >= PHP 7. Submodule for swiftmailer not required as it is also a dependency within composer.

* PHP 7.4 deprecates get_magic_quotes_gpc. Instead of checking the php-version on every pageload, let's drop PHP 5.3 support.

* Deprecated: Array and string offset access syntax with curly braces is deprecated.

* Swiftmailer6 compat.

* Swiftmailer6 compat.

* Allow swiftmailer 6

(cherry picked from commit 3622f22)

* Allowed optional installation of swiftmailer 6 if plattform >= PHP 7. Submodule for swiftmailer not required as it is also a dependency within composer.

(cherry picked from commit ba2dfe3)

* Swiftmailer6 compat.

(cherry picked from commit 2e00caa)

* Swiftmailer6 compat.

(cherry picked from commit 90c5a42)

* Check if class "Swift" is loaded.

* Another easy way for being compatbiel with swiftmailer 5 and 6!

* Reverted sfMailer changes.

* Even more reverts.

* Still 1.5.13 for our branch.

* Fixed merge conflicts.

* Is it possible to keep the submodule?

* PHP >= 5.2.4 supports stderr for reporting the error to stderr instead of stdout. This patch allows to set it as a new setting in settings.yml

* Added the new settings to WHATS_NEW.md

* Fixed deprecated non optional parameters after optional parameters.

* php 8.1 compat

* php 8.1 compat

* php 8.1 compat

* php 8.1 compat

* php 8.1 compat

* php 8.1 compat

* php 8.1 compat

* php 8.1 compat

* php 8.1 compat

* php 8.1 compat

* php 8.1 compat

* php 8.1 compat

* php 8.1 compat

* Revert "php 8.1 compat"

This reverts commit 566e652.

* php 8.1 compat

* PHP 8.1 > internal_method_return_types
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.

* PHP 8.1 > Serializable Phase Out
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

* PHP 8.0 & 8.1 > Deprecated of null to non-nullable internal function 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

* PHP 8.1 > strftime deprecated.

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.

* PHP 8.1 > Unit Test

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

* Fix lime message: "An uncaught exception has been thrown" do not have "error" value

uncaught exception does not populate error field

* PHP 8.1 > uasort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero

* Fix ValueError: DOMDocument::loadHTML(): Argument #1 ($source) must not be empty

* PHP 8.0 > fread()/count() behavior

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

* Fix Declaration of sfPearRestTest::downloadHttp($url, $lastmodified = null, $accept = false) must be compatible with sfPearRest::downloadHttp($url, $lastmodified = null, $accept = false, $channel = false)

* PHP 8.0 > mktime update
8.0.0 	hour is no longer optional.
8.0.0 	minute, second, month, day and year are nullable now.

* Fix sfWebResponse->getContentType() return a string not an array

* Fix sfDoctrineTester, string cannot be accessed as array

* PHP 8.0 > Fix is_numeric behavior with trailing empty char
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

* PHP 8.0 > String to Number Comparison.
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

* Change support to PHP 8.1

* Update Travis to PHP up to 8.1

PHP 5.3 is broken due to Letsencrypt certificate cannot download composer

PHP 5.4 do not contains apc module on (and precise has same cert problem than 5.3))

* Fix UnitTest application/x-sharedlib

/bin/ls is now application/x-sharedlib on ubuntu focal

* PHP 8.1 > mysqli_report revert to off
https://php.watch/versions/8.1/mysqli-error-mode

* WillBeRemoved, Ensure Travis is OK on PHP 8.1

It only fix one last error due to Doctrine throwing warning on PHP 8.1.
other/tasksTest, 1 subtests trying to load Doctrine_Manager.

To avoid this warning on your setup:
- Use temporary: php.ini error_reporting = E_ALL & ~E_DEPRECATED
- Use temporary: Tybaze/doctrine1, branch compat_php8.1
- Use FriendsOfSymfony1/doctrine1 once merged PR-85

* php 8.1 compat

* bumped min php version, bumped branch alias

* set more durable permissions when generating `doctrine_schema_[\d]{5}.yml`

* updated format to match existing logging

* updated method signature to match `Iterator::current()`

* disallow passing `null` to `urldecode` in `sfRoute`

* added default value for `$number` to `format_number_choice()`

* updated remaining `sfRouteCollection` iterator method signatures to match upstream

* avoid passing `null` to `urlencode()`

* avoid passing `null` to `strpos()`

* dumb syntax error

* another dumb syntax error

* Coding Style

* Code Simplification from Merge Review

* Better MYSQLI_REPORT_OFF implementations for php8.1 compat
Thanks @mentalstring

* remove full_path from uploads added on php8.1

* fix use of null on string parameter

* avoid passing `null` to `urlencode()`

* minor tweaks

* Eine Methode aufgeräumt und etwas Deutsch entfernt

Co-authored-by: Thomas A. Hirsch <thomas.hirsch@vema-eg.de>
Co-authored-by: Thomas <me@thirsch.de>
Co-authored-by: Thomas <th@it-solutions-hirsch.de>
Co-authored-by: Tybaze <tybaze@users.noreply.github.com>
Co-authored-by: Ben Tybaze <6998932+Tybaze@users.noreply.github.com>
Co-authored-by: Paulo Magalhaes <mentalstring@gmail.com>
akhumphrey pushed a commit that referenced this pull request Sep 19, 2023
akhumphrey pushed a commit that referenced this pull request Sep 19, 2023
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
akhumphrey pushed a commit that referenced this pull request Sep 19, 2023
akhumphrey added a commit that referenced this pull request Mar 28, 2024
* Add docker compose

* 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>

* Use GitHub actions for Continuous Integration tests

Remove TravisCI integration

* Fix test for /bin/ls file mimetype guessing, using application/x-pie-executable

* PHP 8.1 > internal_method_return_types
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.

* PHP 8.1 > Serializable Phase Out
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

* PHP 8.0 & 8.1 > Deprecated of null to non-nullable internal function 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

* PHP 8.1 > strftime deprecated.

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.

* PHP 8.1 > Unit Test

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

* Fix lime message: "An uncaught exception has been thrown" do not have "error" value

uncaught exception does not populate error field

* PHP 8.1 > uasort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero

* Fix ValueError: DOMDocument::loadHTML(): Argument #1 ($source) must not be empty

* PHP 8.0 > fread()/count() behavior

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

* Fix Declaration of sfPearRestTest::downloadHttp($url, $lastmodified = null, $accept = false) must be compatible with sfPearRest::downloadHttp($url, $lastmodified = null, $accept = false, $channel = false)

* PHP 8.0 > mktime update

8.0.0 	hour is no longer optional.
8.0.0 	minute, second, month, day and year are nullable now.

* Fix sfWebResponse->getContentType() return a string not an array

* Fix sfDoctrineTester, string cannot be accessed as array

* PHP 8.0 > Fix is_numeric behavior with trailing empty char
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

* PHP 8.0 > String to Number Comparison.
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

* PHP 8.1 > Change support to PHP 8.1

* Fix UnitTest application/x-sharedlib

/bin/ls can be reported as:
- application/x-sharedlib
- application/x-executable
- application/x-pie-executable

* PHP 8.1 > mysqli_report revert to off
https://php.watch/versions/8.1/mysqli-error-mode

* Refactor code and apply Coding Style fixes

* PHP 8.1 > Better MYSQLI_REPORT_OFF implementations for php8.1 compat

Thanks @mentalstring

* PHP 8.1 > remove full_path from uploads added on PHP v8.1

* Fix use of null on string parameter on multiple classes

* Github Actions: enable testing on PHP v8.0 and v8.1 (for PRs too)

* test environment for php 8.2

* PHP 8.2 > Using ${var} in strings is deprecated, use {$var} instead.

* PHP 8.2 > Creation of dynamic property Class::$property is deprecated

* PHP 8.0 > Uncaught ArgumentCountError: Too few arguments to function

* PHP 8.0 > Trying to access array offset on value of type bool

* PHP 8.0 > Passing null to parameter #1 ($haystack) of type string is deprecated

* set symfony version to 1.5.15-dev

* PHP 8.0 > Class name must be a valid object or a string in case the controller does not exist.

* PHP 8.0 > Fix undefined array key

* PHP 8.1 > Fix some more null on string parameter

* Prepared release 1.5.15

* Add(changelog) Add v1.5.15 release date to Changelog file

* Add(versioning) Add v1.5.16-dev as next release

* Fix(deprecations) Fix deprecations in sfMessageSource_Aggregate (FriendsOfSymfony1#277)

* Fix(deprecations) Fix deprecations in sfMessageSource_Aggregate, add return types from implemented sfIMessageSource

* Add(linting) Add code linting to GitHub workflow, use php-cs-fixer

* Fix(php-cs) Fix php-cs styles according to configuration

* Add(gitattributes) Add .gitattributes to repository

* imported upstream php-cs-fixer configuration

* initial pass of php-cs-fixer

* updated config

* updated config

* updated config

* updated config

* imported routing fixes from `master`

* removed `7.4` and `8.0` test targets

* fixed `long_to_shorthand_operator` warnings

* temporarily disabled testing

* removed route caching

* fixed coding standards issues

* re-fixed more coding standards issues

* Fix: avoid creating dynamic property $options in sfViewCacheManager (FriendsOfSymfony1#290) 

Dynamic properties are deprecated since PHP8.2

* Update(github) Update github workflows, include cache for composer install

* Fix(php-cs-fixer) Fix php-cs-fixer warnings, according to new checks

* add php8.3

* Fix(php-cs-fix) fix php-cs-fix single_space_around_construct warning

* Fix(php-cs-fixer) Fix php-cs-fixer to v3.45 and apply code fixes

* Fix(deprecation) preg_match_all requires string parameter (FriendsOfSymfony1#298)

* Fix APC cache tests

- Using negative TTLs to force the immediate expiration of keys, while
  convenient in tests, doesn't work consistently with APC and is an
  undocumented feature. Using a low TTL and sleep() is what guarantees
  that it works for APC. See krakjoe/apcu#184

- The setting apc.use_request_time interferes with key expiration when
  running on the CLI. Making sure it always has a sensible value for
  running the tests. See krakjoe/apcu#392

* Add APCu support

Support for the APCu extension (through sfAPCuCache) as an alternative
to APC, which no longer works with recent versions of PHP.

* Fix sfCacheSessionStorageTest with PHP>=7.2

From PHP 7.2 onward, session functions are stricter and may not work
if output/headers have already been sent out. Using output buffering
prevents this issue.

* Remove test dependency on APC

Replace the use of sfAPCCache with sfFileCache in
sfCacheSessionStorageTest so that it doesn't depend on APC being
available.

* Fix deprecation on stropos()  usage on sfDebug::shortenFilePath (FriendsOfSymfony1#299)

Fix PHP v8.x deprecation on strpos() usage with `null` as first parameter

* Fix strpos() deprecation on sfCacheSessionStorage check for cookie

* Fix setrawcookie() deprecation on null parameter (FriendsOfSymfony1#304)

* Fix str_replace() deprecated null parameter on sfNumberFormat

* Declare $params var

* Replace default with 0

* removed some automated testing for old php versions

* updated `php-cs-fixer` config

* Update README

Fix build badge, update supported PHP version and other minor tweaks.

* Fix link to GitHub pipeline badge

* fix(config) sfCacheConfigHandler: There is no fourth argument. Nice catch phpstan!

* Fix PHP8.1 sfForm - Unsupported operand types: array + null on sfForm::updateValues()

Avoid error:
Fatal error: Uncaught TypeError: Unsupported operand types: array + null in lib\form\sfForm.class.php:319

Step to reproduce :
$form = new sfForm();
$form->updateValues(array('foo' => 'value'));

PHP 5.3 coding style

May use sfForm::getValues(), but as sfForm::updateValues() is a hack, it could be used before bind ($this->isBound = true);

* fix(phpdoc) remove html code from throws phpdoc. phpstan don't like this

* fix(phpdoc) remove version tag

* applied php-cs-fixer

* added missing properties

* PHP 8.3 deprecated errors fixed (FriendsOfSymfony1#320)

* Update min PHP requirement to v7.4 or v8.1

* Remove PHP v8.0 from CI workflow

* Updated gh workflow to use latest actions

* Backported display_errors-handling to sf1

* removed duplicate class properties

* Set min versions of swiftmailer to 5.4.13 and 6.2.5 and updated swiftmailer submodule (FriendsOfSymfony1#331)

* Update min versions of swiftmailer to v5.4.13 or v6.2.5
* Update swiftmailer code on submodule to v5.4.13

* Sync changelog with latest releases (FriendsOfSymfony1#337)

* Sync changelog with latest releases

* Remove(legacy): Remove unsupported PHP docker images

* Remove(legacy): drop sfAPCCache cache as apc extension does not exist anymore

Please use sfAPCUCache instead

* Fix(docblock): fix typo in check_configuration.php docblock

* Update(check-config): use PHP constant for version check on check_configuration.php file

* Remove(legacy): delete checks for 'magic_quotes_gpc' and 'register_globals' ini settings, as removed on PHP v5.4

* Remove(legacy): delete EAccelerator cache, the extension is not existing for php v7.4

See: https://github.com/eaccelerator/eaccelerator, where the following
message is shown:

> This project is deprecated and does not work with anything newer than PHP 5.3.
> Please use a recent version of PHP with OPcache instead!

* Remove(legacy): drop XCache support, as the extension is not available for PHP >= 7.4

* Remove(legacy): delete check for PHP < 5.2 in tests for mime_content_type bug

* Remove(legacy): drop PHP v5.3 check for SQLite version match

* Remove(legacy): drop PHP v5.4 check and compatibility layer on sfWebRequest

* Remove(legacy): drop PHP v5.3 check on sfRoute

This removes a preliminary fix for a legacy PHP 5.3. issue with regexp excaping
PHP bug reference: http://bugs.php.net/bug.php?id=47229

* Update: Update php-cs-fixer to v3.51

Apply rule fixes

* Update: php-cs-fixer, enable short array syntax

* Update: move php-cs-fixer cache under .cache folder

* Update: run php-cs-fixer on PHP v7.4 as min supported version

* Update: GitHub actions to run php-cs-fixer only on relevant changed files

* Hotfix: Add type checking for deserialized data in sfParameterHolder and sfNamespacedParameterHolder (CVE-2024-28861)

* Update php-cs-fixer to v3.52

* Remove(legacy): drop sf*Cache implementations for APC, XCache and EAccelerator extensions

* Phpstan: fix warnings on sfAPCiCache implementation, add docblocks and returns

* Phpstan: fix warnings on sfFileCache and sfMemcache implementation, add missing returns

* Phpstan: fix missing sfTask* return statement

* [widget] fix return statement missing (FriendsOfSymfony1#349)

* [validator] fix return statement missing (FriendsOfSymfony1#352)

* [view] fix return statement missing on ParamHolder and CacheManager (FriendsOfSymfony1#350)

* [task] Fix return statement missing on some tasks (FriendsOfSymfony1#353)

* [util] fix missing return statement and docblock on sfContext class (FriendsOfSymfony1#351)

* applied upstream php-cs-fixer configuration

* corrected json format

* use `php8.2` when linting

* don't build php8.1

* reverted many changes back to upstream equivalents

* removed upstream submodule

* replaced submodule with our fork

* updated tests to match custom functionality

* only test php82

* corrected number of expected tests

* only use php8.2 for github actions

* explicitly apply `nullable_type_declaration_for_default_null_value`

* attributes don't use `\`

* corrected method signatures

---------

Co-authored-by: Alexandre Quercia <alquerci@email.com>
Co-authored-by: Thomas <th@it-solutions-hirsch.de>
Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>
Co-authored-by: Tybaze <tybaze@users.noreply.github.com>
Co-authored-by: Paulo Magalhaes <mentalstring@gmail.com>
Co-authored-by: Thomas A. Hirsch <thomas.hirsch@vema-eg.de>
Co-authored-by: Karoly Gossler <connor@connor.hu>
Co-authored-by: Vincent Mariani <541354+vimar@users.noreply.github.com>
Co-authored-by: iricketson <iricketson@users.noreply.github.com>
Co-authored-by: Ian Ricketson <ian@trackops.com>
Co-authored-by: Sergei Miami <miami@blackcrystal.net>
Co-authored-by: darkpills <>
akhumphrey added a commit that referenced this pull request Jul 1, 2024
* Add docker compose

* 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>

* Use GitHub actions for Continuous Integration tests

Remove TravisCI integration

* Fix test for /bin/ls file mimetype guessing, using application/x-pie-executable

* PHP 8.1 > internal_method_return_types
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.

* PHP 8.1 > Serializable Phase Out
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

* PHP 8.0 & 8.1 > Deprecated of null to non-nullable internal function 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

* PHP 8.1 > strftime deprecated.

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.

* PHP 8.1 > Unit Test

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

* Fix lime message: "An uncaught exception has been thrown" do not have "error" value

uncaught exception does not populate error field

* PHP 8.1 > uasort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero

* Fix ValueError: DOMDocument::loadHTML(): Argument #1 ($source) must not be empty

* PHP 8.0 > fread()/count() behavior

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

* Fix Declaration of sfPearRestTest::downloadHttp($url, $lastmodified = null, $accept = false) must be compatible with sfPearRest::downloadHttp($url, $lastmodified = null, $accept = false, $channel = false)

* PHP 8.0 > mktime update

8.0.0 	hour is no longer optional.
8.0.0 	minute, second, month, day and year are nullable now.

* Fix sfWebResponse->getContentType() return a string not an array

* Fix sfDoctrineTester, string cannot be accessed as array

* PHP 8.0 > Fix is_numeric behavior with trailing empty char
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

* PHP 8.0 > String to Number Comparison.
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

* PHP 8.1 > Change support to PHP 8.1

* Fix UnitTest application/x-sharedlib

/bin/ls can be reported as:
- application/x-sharedlib
- application/x-executable
- application/x-pie-executable

* PHP 8.1 > mysqli_report revert to off
https://php.watch/versions/8.1/mysqli-error-mode

* Refactor code and apply Coding Style fixes

* PHP 8.1 > Better MYSQLI_REPORT_OFF implementations for php8.1 compat

Thanks @mentalstring

* PHP 8.1 > remove full_path from uploads added on PHP v8.1

* Fix use of null on string parameter on multiple classes

* Github Actions: enable testing on PHP v8.0 and v8.1 (for PRs too)

* test environment for php 8.2

* PHP 8.2 > Using ${var} in strings is deprecated, use {$var} instead.

* PHP 8.2 > Creation of dynamic property Class::$property is deprecated

* PHP 8.0 > Uncaught ArgumentCountError: Too few arguments to function

* PHP 8.0 > Trying to access array offset on value of type bool

* PHP 8.0 > Passing null to parameter #1 ($haystack) of type string is deprecated

* set symfony version to 1.5.15-dev

* PHP 8.0 > Class name must be a valid object or a string in case the controller does not exist.

* PHP 8.0 > Fix undefined array key

* PHP 8.1 > Fix some more null on string parameter

* Prepared release 1.5.15

* Add(changelog) Add v1.5.15 release date to Changelog file

* Add(versioning) Add v1.5.16-dev as next release

* Fix(deprecations) Fix deprecations in sfMessageSource_Aggregate (FriendsOfSymfony1#277)

* Fix(deprecations) Fix deprecations in sfMessageSource_Aggregate, add return types from implemented sfIMessageSource

* Add(linting) Add code linting to GitHub workflow, use php-cs-fixer

* Fix(php-cs) Fix php-cs styles according to configuration

* Add(gitattributes) Add .gitattributes to repository

* Fix: avoid creating dynamic property $options in sfViewCacheManager (FriendsOfSymfony1#290) 

Dynamic properties are deprecated since PHP8.2

* Update(github) Update github workflows, include cache for composer install

* Fix(php-cs-fixer) Fix php-cs-fixer warnings, according to new checks

* add php8.3

* Fix(php-cs-fix) fix php-cs-fix single_space_around_construct warning

* Fix(php-cs-fixer) Fix php-cs-fixer to v3.45 and apply code fixes

* Fix(deprecation) preg_match_all requires string parameter (FriendsOfSymfony1#298)

* Fix APC cache tests

- Using negative TTLs to force the immediate expiration of keys, while
  convenient in tests, doesn't work consistently with APC and is an
  undocumented feature. Using a low TTL and sleep() is what guarantees
  that it works for APC. See krakjoe/apcu#184

- The setting apc.use_request_time interferes with key expiration when
  running on the CLI. Making sure it always has a sensible value for
  running the tests. See krakjoe/apcu#392

* Add APCu support

Support for the APCu extension (through sfAPCuCache) as an alternative
to APC, which no longer works with recent versions of PHP.

* Fix sfCacheSessionStorageTest with PHP>=7.2

From PHP 7.2 onward, session functions are stricter and may not work
if output/headers have already been sent out. Using output buffering
prevents this issue.

* Remove test dependency on APC

Replace the use of sfAPCCache with sfFileCache in
sfCacheSessionStorageTest so that it doesn't depend on APC being
available.

* Fix deprecation on stropos()  usage on sfDebug::shortenFilePath (FriendsOfSymfony1#299)

Fix PHP v8.x deprecation on strpos() usage with `null` as first parameter

* Fix strpos() deprecation on sfCacheSessionStorage check for cookie

* Fix setrawcookie() deprecation on null parameter (FriendsOfSymfony1#304)

* Fix str_replace() deprecated null parameter on sfNumberFormat

* Declare $params var

* Replace default with 0

* Update README

Fix build badge, update supported PHP version and other minor tweaks.

* Fix link to GitHub pipeline badge

* fix(config) sfCacheConfigHandler: There is no fourth argument. Nice catch phpstan!

* Fix PHP8.1 sfForm - Unsupported operand types: array + null on sfForm::updateValues()

Avoid error:
Fatal error: Uncaught TypeError: Unsupported operand types: array + null in lib\form\sfForm.class.php:319

Step to reproduce :
$form = new sfForm();
$form->updateValues(array('foo' => 'value'));

PHP 5.3 coding style

May use sfForm::getValues(), but as sfForm::updateValues() is a hack, it could be used before bind ($this->isBound = true);

* fix(phpdoc) remove html code from throws phpdoc. phpstan don't like this

* fix(phpdoc) remove version tag

* PHP 8.3 deprecated errors fixed (FriendsOfSymfony1#320)

* Update min PHP requirement to v7.4 or v8.1

* Remove PHP v8.0 from CI workflow

* Updated gh workflow to use latest actions

* Backported display_errors-handling to sf1

* Set min versions of swiftmailer to 5.4.13 and 6.2.5 and updated swiftmailer submodule (FriendsOfSymfony1#331)

* Update min versions of swiftmailer to v5.4.13 or v6.2.5
* Update swiftmailer code on submodule to v5.4.13

* Sync changelog with latest releases (FriendsOfSymfony1#337)

* Sync changelog with latest releases

* Remove(legacy): Remove unsupported PHP docker images

* Remove(legacy): drop sfAPCCache cache as apc extension does not exist anymore

Please use sfAPCUCache instead

* Fix(docblock): fix typo in check_configuration.php docblock

* Update(check-config): use PHP constant for version check on check_configuration.php file

* Remove(legacy): delete checks for 'magic_quotes_gpc' and 'register_globals' ini settings, as removed on PHP v5.4

* Remove(legacy): delete EAccelerator cache, the extension is not existing for php v7.4

See: https://github.com/eaccelerator/eaccelerator, where the following
message is shown:

> This project is deprecated and does not work with anything newer than PHP 5.3.
> Please use a recent version of PHP with OPcache instead!

* Remove(legacy): drop XCache support, as the extension is not available for PHP >= 7.4

* Remove(legacy): delete check for PHP < 5.2 in tests for mime_content_type bug

* Remove(legacy): drop PHP v5.3 check for SQLite version match

* Remove(legacy): drop PHP v5.4 check and compatibility layer on sfWebRequest

* Remove(legacy): drop PHP v5.3 check on sfRoute

This removes a preliminary fix for a legacy PHP 5.3. issue with regexp excaping
PHP bug reference: http://bugs.php.net/bug.php?id=47229

* Update: Update php-cs-fixer to v3.51

Apply rule fixes

* Update: php-cs-fixer, enable short array syntax

* Update: move php-cs-fixer cache under .cache folder

* Update: run php-cs-fixer on PHP v7.4 as min supported version

* Update: GitHub actions to run php-cs-fixer only on relevant changed files

* Hotfix: Add type checking for deserialized data in sfParameterHolder and sfNamespacedParameterHolder (CVE-2024-28861)

* Update php-cs-fixer to v3.52

* Remove(legacy): drop sf*Cache implementations for APC, XCache and EAccelerator extensions

* Phpstan: fix warnings on sfAPCiCache implementation, add docblocks and returns

* Phpstan: fix warnings on sfFileCache and sfMemcache implementation, add missing returns

* Phpstan: fix missing sfTask* return statement

* [widget] fix return statement missing (FriendsOfSymfony1#349)

* [validator] fix return statement missing (FriendsOfSymfony1#352)

* [view] fix return statement missing on ParamHolder and CacheManager (FriendsOfSymfony1#350)

* [task] Fix return statement missing on some tasks (FriendsOfSymfony1#353)

* [util] fix missing return statement and docblock on sfContext class (FriendsOfSymfony1#351)

* Chore: Fix Changelog typo (FriendsOfSymfony1#361)

* Fix: update the SYMFONY_VERSION constant to the latest release number (FriendsOfSymfony1#355)

* Add: Include "test" folder to gitattribute's exclusion (FriendsOfSymfony1#368)

* Fix: Correct type-hint for parameters sfConfigCache (FriendsOfSymfony1#370)

---------

Co-authored-by: Alexandre Quercia <alquerci@email.com>
Co-authored-by: Thomas <th@it-solutions-hirsch.de>
Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>
Co-authored-by: Tybaze <tybaze@users.noreply.github.com>
Co-authored-by: Paulo Magalhaes <mentalstring@gmail.com>
Co-authored-by: Thomas A. Hirsch <thomas.hirsch@vema-eg.de>
Co-authored-by: Karoly Gossler <connor@connor.hu>
Co-authored-by: Vincent Mariani <541354+vimar@users.noreply.github.com>
Co-authored-by: iricketson <iricketson@users.noreply.github.com>
Co-authored-by: Ian Ricketson <ian@trackops.com>
Co-authored-by: Sergei Miami <miami@blackcrystal.net>
Co-authored-by: darkpills <>
Co-authored-by: ಠ_ಠ <easteregg@verfriemelt.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant