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

Apply updates for PHP 8.x #1909

Open
wants to merge 14 commits into
base: qa/2.x
Choose a base branch
from
Open

Apply updates for PHP 8.x #1909

wants to merge 14 commits into from

Conversation

anvit
Copy link
Contributor

@anvit anvit commented Jan 22, 2025

Update Atom and its associated dependencies (Symfony, net_gearman, sfPropel) to work with PHP 8.x.

  • For Symfony related changes, we've referred to Friends of Symfony.
  • Net Gearman was updated to 2.2.3 from their repo while retaining an AtoM specific customization to Job.php
  • Added #[\ReturnTypeWillChange] attributes to functions that were extending certain vendor classes (in line with changes that Friends of Symfony applied)

Other changes that address PHP 8.x related deprecation warnings and errors —

  • Dynamic property creation is deprecated in PHP 8.x so we've added declarations for properties created dynamically.
  • Optional params are expected to the last params in a function declaration, so updated functions and their calls where this was not the case.
  • Some comparisons (notable string to number comparison) has changed since PHP 8 and is a breaking change, so conditionals that were broken because of this have been updated.
  • There have been changes to what are partially supported callables in PHP 8.2, so call_user_func_array calls that use $this have been updated.
  • implode no longer supports having the array first and separator second in the function call.
  • preg_replace expects the second parameter to be either string or array so the places where we were using NULL have been updated to use empty string instead.

anvit and others added 14 commits January 9, 2025 11:30
Updating Symfony to PHP 8.0. This commit pulls changes from from
FriendsOfSymfony's repo (https://github.com/FriendsOfSymfony1/symfony1)
for the following fixes:
- Ensure use of string instead of null/false by casting to a string this
  (FriendsOfSymfony1/symfony1@029b0e7)
- Fix fread/count with 0 lengths (FriendsOfSymfony1/symfony1@df2ec65)
- mktime fixes (FriendsOfSymfony1/symfony1@29ab2a7)
- Fix is_numeric behaviour with trailing empty chars
  (FriendsOfSymfony1/symfony1@7341b43)
- String to number comparisons (FriendsOfSymfony1/symfony1@b191cb8)
- Fix Uncaught ArgumentCountError (FriendsOfSymfony1/symfony1@89c24cf)
- Fix attempting to access array offset on bool value type
  (FriendsOfSymfony1/symfony1@754c940)
- Fix undefined array key (FriendsOfSymfony1/symfony1@c55d53c)
- Fix invalid classname if no controller exists in sfController
  (FriendsOfSymfony1/symfony1@4820ada)
- Fix passing null to strpos function (FriendsOfSymfony1/symfony1@13bfee2)
Updating Symfony to PHP 8.1. This commit pulls changes from from
FriendsOfSymfony's repo (https://github.com/FriendsOfSymfony1/symfony1)
for the following fixes:

- Move serialize/unserialize function implementation to
  __serialize/__unserialize methods since PHP 8.1 made the old method
  serializable implementation deprecated
  (FriendsOfSymfony1/symfony1@6401fcc)
- Updated unit tests (FriendsOfSymfony1/symfony1@8450b13)
  (FriendsOfSymfony1/symfony1@b0cb92e)
- Fix lime error message (FriendsOfSymfony1/symfony1@9cb7fb4)
- Fix comparison function getVarsByStrlen in sfRoute since returning
  bool from comparison function is deprecated
  (FriendsOfSymfony1/symfony1@25a5e71)
- Fix value error DOMDocument::loadHTML
  (FriendsOfSymfony1/symfony1@09fc710)
- Update sfWebResponse getContentType function returns a string instead
  of an array (FriendsOfSymfony1/symfony1@12f7b4c)
- Update sfPearRest declaration (FriendsOfSymfony1/symfony1@42112ab)
- Fix sfTesterDoctrine string cannot be accessed as array
  (FriendsOfSymfony1/symfony1@cae793e)
- Fix use of null on string parameter (FriendsOfSymfony1/symfony1@7798328)
  (FriendsOfSymfony1/symfony1@8b81a56)
This commit pulls changes from from
FriendsOfSymfony's repo (https://github.com/FriendsOfSymfony1/symfony1)
for the following fixes:

- Add workarounds for strftime deprecation
  (FriendsOfSymfony1/symfony1@dcb1ce3)
- Set mysql error reporting to off since this is on by default in
  PHP8.1 (FriendsOfSymfony1/symfony1@bb22141)
  (FriendsOfSymfony1/symfony1@01fadb9)
- Remove full path from uploads added to PHP8.1
  (FriendsOfSymfony1/symfony1@3bb8339)
Updating Symfony to PHP 8.2. This commit pulls changes from from
FriendsOfSymfony's repo (https://github.com/FriendsOfSymfony1/symfony1)
for the following fixes:

- Update symfony classes which attempt to create dynamic class property
  as this is deprecated in PHP 8.2 (FriendsOfSymfony1/symfony1@d89618f)
- Update string interpolation format to follow {$var} since ${var} is
  deprecated in PHP 8.2 (FriendsOfSymfony1/symfony1@f6d779c)
Updating Symfony to PHP 8.0. This commit pulls changes from from
FriendsOfSymfony's repo (https://github.com/FriendsOfSymfony1/symfony1)
for the following fixes:

- Add temporary ReturnTypesWillChange attribute to return types changing
  for Iterator, ArrayAccess, Countable, IteratorAggregate
  (FriendsOfSymfony1/symfony@245c7cc)
Fix the broken routing by addressing the missing param in sfRoute
Update net_gearman vendor package to latest version
and add AtoM specific customizations to Job.php
- Add #[\ReturnTypeWillChange] attribute for functions extending PDO
  in PropelPDO and PropelConfiguration
- Using empty string instead of null in preg_replace call in
  sfAutoloadConfigHandler
- Optional params are required to be at the end in function declarations
  in PHP 8, so updating function deprecation and call in
  unlinkCreatorTask
- Dynamic property creation is deprecated in PHP 8, so adding
  declarations for properties created dynamically in
  sfCommandApplication and digitalObjectRegenDerivativesTask
- Add #[\ReturnTypeWillChange] attribute for functions
- Add declarations for dynamically created properties
- Fix deprecation wanrings in BaseSettingI18n on a first time run of
purge.
Fix deprecation warnings for call_user_func_array calls that use $this
in the callable which isn't required and has been deprecated in PHP 8.2
@anvit anvit requested a review from a team January 22, 2025 00:25
@anvit anvit self-assigned this Jan 22, 2025
@anvit anvit added the php Pull requests that update Php code label Jan 22, 2025
@anvit anvit added this to the 2.9.0 milestone Jan 22, 2025
@anvit anvit linked an issue Jan 22, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
php Pull requests that update Php code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problem: PHP 7.4 dependency
2 participants