Skip to content

Commit d38c950

Browse files
akhumphreyalquercithirschthePanzTybaze
authored
integrated upstream changes (#15)
* 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 <[email protected]> * 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) * Fix: inclusion of base test files in composer package (FriendsOfSymfony1#380) Closes FriendsOfSymfony1#379 * [ci] added php 8.4 * PHP 8.4 > Removed deprecated constant E_STRICT, as it is not in use since PHP 5.4 anymore. * updated README.md to reflect supported php versions. * Fix stack trace code preview in debug screen * Fix(deprecation) Optional parameter declared before required parameter is implicitly treated as a required parameter * codestyle * Create FUNDING.yml file --------- Co-authored-by: Alexandre Quercia <[email protected]> Co-authored-by: Thomas <[email protected]> Co-authored-by: Emanuele Panzeri <[email protected]> Co-authored-by: Tybaze <[email protected]> Co-authored-by: Paulo Magalhaes <[email protected]> Co-authored-by: Thomas A. Hirsch <[email protected]> Co-authored-by: Karoly Gossler <[email protected]> Co-authored-by: Vincent Mariani <[email protected]> Co-authored-by: iricketson <[email protected]> Co-authored-by: Ian Ricketson <[email protected]> Co-authored-by: Sergei Miami <[email protected]> Co-authored-by: darkpills <> Co-authored-by: ಠ_ಠ <[email protected]> Co-authored-by: David Grüner <[email protected]> Co-authored-by: sebasbit <[email protected]>
1 parent 52e47b0 commit d38c950

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+119
-124
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
docker-compose.yml export-ignore
99
phpstan.neon export-ignore
1010
phpunit.xml export-ignore
11-
test/ export-ignore
11+
/test/ export-ignore
1212
tests/ export-ignore

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [thePanz]

.github/workflows/continuous-integration.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
matrix:
1919
php-version:
2020
- "8.2"
21+
- "8.3"
22+
- "8.4"
2123
memcached-version:
2224
- "1.6"
2325

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ All the enhancements and BC breaks are listed in the [WHATS_NEW](https://github.
1111

1212
- [DIC](https://github.com/FriendsOfSymfony1/symfony1/wiki/ServiceContainer)
1313
- Composer support
14-
- PHP 8.3 support
14+
- PHP 8.4 support
1515
- performance boost
1616
- new widgets & validators
1717
- some tickets fixed from the symfony trac
@@ -34,7 +34,7 @@ It runs on *nix and Windows platforms*.
3434
Requirements
3535
------------
3636

37-
PHP 5.3.4 and up. See prerequisites on https://symfony.com/legacy/doc/getting-started/1_4/en/02-Prerequisites
37+
PHP 7.4 and up. See prerequisites on https://symfony.com/legacy/doc/getting-started/1_4/en/02-Prerequisites
3838

3939
Installation
4040
------------

docker-compose.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,21 @@ services:
4545
- db
4646
- memcached
4747

48+
php83:
49+
<<: *services_php82
50+
build:
51+
args:
52+
PHP_VERSION: '8.3'
53+
MEMCACHE_VERSION: '8.2'
54+
APCU_VERSION: '5.1.23'
55+
56+
php84:
57+
<<: *services_php82
58+
build:
59+
args:
60+
PHP_VERSION: '8.4'
61+
MEMCACHE_VERSION: '8.2'
62+
APCU_VERSION: '5.1.23'
4863

4964
db:
5065
image: mysql:5.5.62

lib/autoload/sfCoreAutoload.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010

1111
// The current symfony version.
12-
define('SYMFONY_VERSION', '1.6.2');
12+
define('SYMFONY_VERSION', '1.6.3');
1313

1414
/**
1515
* sfCoreAutoload class.

lib/cache/sfCache.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public function setOption($name, $value)
220220
protected function patternToRegexp($pattern)
221221
{
222222
$regexp = str_replace(
223-
['\\*\\*', '\\*'],
223+
['\*\*', '\*'],
224224
['.+?', '[^'.preg_quote(sfCache::SEPARATOR, '#').']+'],
225225
preg_quote($pattern, '#')
226226
);

lib/command/sfCommandManager.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function process($arguments = null)
111111
}
112112
} elseif (!is_array($arguments)) {
113113
// hack to split arguments with spaces : --test="with some spaces"
114-
$arguments = preg_replace_callback('/(\'|")(.+?)\\1/', function ($match) {
114+
$arguments = preg_replace_callback('/(\'|")(.+?)\1/', function ($match) {
115115
return str_replace(' ', '=PLACEHOLDER=', $match[2]);
116116
}, $arguments);
117117
$arguments = preg_split('/\s+/', $arguments);

lib/debug/sfWebDebugPanel.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,6 @@ public function formatFileLink($file, $line = null, $text = null)
187187
*/
188188
public function formatSql($sql)
189189
{
190-
return preg_replace('/\b(UPDATE|SET|SELECT|FROM|AS|LIMIT|ASC|COUNT|DESC|WHERE|LEFT JOIN|INNER JOIN|RIGHT JOIN|ORDER BY|GROUP BY|IN|LIKE|DISTINCT|DELETE|INSERT|INTO|VALUES)\b/', '<span class="sfWebDebugLogInfo">\\1</span>', $sql);
190+
return preg_replace('/\b(UPDATE|SET|SELECT|FROM|AS|LIMIT|ASC|COUNT|DESC|WHERE|LEFT JOIN|INNER JOIN|RIGHT JOIN|ORDER BY|GROUP BY|IN|LIKE|DISTINCT|DELETE|INSERT|INTO|VALUES)\b/', '<span class="sfWebDebugLogInfo">\1</span>', $sql);
191191
}
192192
}

lib/debug/sfWebDebugPanelLogs.class.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function getPanelContent()
6767

6868
++$line_nb;
6969
$html .= sprintf(
70-
"<tr class='sfWebDebugLogLine sfWebDebug%s %s'><td class=\"sfWebDebugLogNumber\">%s</td><td style=\"background-color:%s\">%s</td><td class=\"sfWebDebugLogType\">%s&nbsp;%s</td><td>%s %s</td></tr>\n",
70+
"<tr class='sfWebDebugLogLine sfWebDebug%s %s'><td class=\"sfWebDebugLogNumber\">%s</td><td class=\"sfWebDebugLogType\">%s&nbsp;%s</td><td>%s %s</td></tr>\n",
7171
ucfirst($priority),
7272
$log['type'],
7373
$line_nb,
@@ -121,9 +121,9 @@ protected function formatLogLine($logLine)
121121

122122
// replace constants value with constant name
123123
$logLine = str_replace(array_keys($constants), array_values($constants), $logLine);
124-
$logLine = preg_replace('/&quot;(.+?)&quot;/s', '<span class="sfWebDebugLogInfo">\\1</span>', $logLine);
125-
$logLine = preg_replace('/^(.+?)\(\)\:/S', '<span class="sfWebDebugLogInfo">\\1()</span>:', $logLine);
126-
$logLine = preg_replace('/line (\d+)$/', 'line <span class="sfWebDebugLogInfo">\\1</span>', $logLine);
124+
$logLine = preg_replace('/&quot;(.+?)&quot;/s', '<span class="sfWebDebugLogInfo">\1</span>', $logLine);
125+
$logLine = preg_replace('/^(.+?)\(\)\:/S', '<span class="sfWebDebugLogInfo">\1()</span>:', $logLine);
126+
$logLine = preg_replace('/line (\d+)$/', 'line <span class="sfWebDebugLogInfo">\1</span>', $logLine);
127127

128128
// special formatting for SQL lines
129129
$logLine = $this->formatSql($logLine);

0 commit comments

Comments
 (0)