Skip to content
New issue

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

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

Already on GitHub? # to your account

PHP 8.1 support #261

Closed
mbrung opened this issue Dec 18, 2021 · 20 comments
Closed

PHP 8.1 support #261

mbrung opened this issue Dec 18, 2021 · 20 comments

Comments

@mbrung
Copy link

mbrung commented Dec 18, 2021

Dear project maintainers,

Thank you very much for all your hard work, it has helped me tremendously!

Has any work been carried out towards supporting PHP 8.1? I haven't looked in details yet at what it would entail, just raising the question (and avoid duplicate work).

Thanks again!

@axelusarov
Copy link

Same here. Would be great to know if there are any plans to fix PHP compatibility issues.

@alquerci
Copy link
Contributor

Hello @mbrung, @axelusarov

As, I know, there are not any plans to fix PHP compatibility issues yet.

A short view on CI

Regarding the nightly build that run PHP 8.0.3-dev
There are a bunch of issues.
It seems that's not so easy.

Canvas

  • This project will need to keep the BC to PHP 5.3, so it will be harder and harder to comply with this constraint.

Contributions

Personalty, I do not have any project running on sf1, and therefore I do not have time to work on it.
But, I am working on applications running on PHP 7, so it will be instructive to contribute to the support of this one.

I will be glade to help for code-review.

But, I do not know the availability of guys who are merging access. cc @thePanz, @j0k3r

@mbrung, @axelusarov do you wish to contribute?

A plan ?

But let's, it is not too late to start tackling one problem at a time.
The goal is to unscale the difficulty with tiny issue.

  1. for each Backward Incompatible Changes, needs to search code occurrences
  2. etc...

Idea

  • Using issue or PR prefix [PHP 8.0] and [PHP 8.1].
    Example: [PHP 8.0] String to Number Comparison

@j0k3r
Copy link
Contributor

j0k3r commented Jan 11, 2022

I really think you need to invest time in upgrading your application to move away from symfony1 instead of upgrading your server.

@e1himself
Copy link
Contributor

@mbrung is your app under active development or is it just a legacy project requiring maintenance?

@mentalstring
Copy link
Contributor

mentalstring commented Jan 15, 2022

From a quick look, it does seem to need some work to support PHP 8.x, while being particularly tricky to keep support for PHP 5.3 at the same time as the changes keep compounding. I think at some point, PHP itself will have BC breaks that will not allow this codebase to support all PHP versions.

This fork started as a way to add some neat enhancements to Symfony 1.4, while also adding support for more recent PHP versions. I think we can all agree that, these many years later, it doesn't make much sense to continue investing new features into it.

However, I think the support for more recent PHP versions is still relevant to some — some devs are are still working in (active development) projects built on top of this fork from which it is too hard to move away from now, but supporting more recent PHP versions is still important.

So, I wonder if it would make sense to drop the PHP 5.3 compatibility goal — perhaps on a separate branch? — and only making the code changes to support more recent PHP versions?

I think the number of websites out there still running this fork with PHP 5.3 is likely close to zero (and even those can already use the code as is today to improve things). At the same time, I think it's much more likely that there are still devs who are using it with more recent PHP versions and still need to keep up with that.

I can put some time in trying to add PHP 8.x support if others can help with that too. However, the overhead of also keeping PHP 5.3 support at the same time is likely to require much more time (from just a quick look) and personally I wouldn't have use for that support myself.

Anyone else interested in helping with the PHP 8.x support?

@thirsch
Copy link
Collaborator

thirsch commented Jan 17, 2022

We are using symfony1 in a legacy project as well and would also love to get support for 8.x. From our point of view, we could drop support for any version below 7.3, as they are not supported anymore (https://www.php.net/supported-versions.php) and as mentalstring already mentioned, there will be no or, if any, very minor new features coming to the updates and therefore anyone using sf1 with a php version between 5.3 and 7.3 is able to use older releases.

While we are already migrating to newer versions of symfony and/or other frameworks, there is quite a huge codebase running on sf1 and it will still take a few month if not years to fully drop sf1 from our stack.

As we already implemented some fixes for 8.0 and 8.1 in our branch, we can offer to help on the project.

@alquerci
Copy link
Contributor

Trying to answer what PHP versions are still installed, sf1. I found that Packagist can contribute to answer to this question.

friendsofsymfony1/symfony1 statistics PHP Versions

This can give an idea because it is partial data.

Anyway, in any case, dropping support to old PHP version will require to bump the major version and maintain 2 minor version branches, that will be more time-consuming for mergers.

@thirsch said

anyone using sf1 with a php version between 5.3 and 7.3 is able to use older releases.

As @j0k3r said

I really think you need to invest time in upgrading your application to move away from symfony1 instead of upgrading your server.

In my honest opinion

Symfony 5 depends on PHP >=7.2.5
Symfony 6 depends on PHP >=8.0.2

If you want to migrate to Symfony 6, sf1 needs to supports at least PHP 8.0.


@mentalstring @thirsch If you still want to provide the supports, then the first step will be to start working on it by creating the beginning of the plan.

The goal is to discover the difficulty, we can even put the first iteration on a time-box. That way, we can fail fast.
Each week, we should readjust the plan regarding what we will learn.

The first iteration might be.

time-box Goal
Iteration 1 4 weekends Make 90% tests pass for PHP 8.0

How do you want to proceed?

Following is just a draft about the plan, you are free to amend it.

  • On what branch to work on, a feature branch on a fork or directly to master ?
    • I suggest to having a feature branch.
    • To speed up the dev, I can provide a local environment for testing with docker and docker-compose, I already have it, except for PHP 8.0 and PHP 8.1.
  • Does the first steps, of the plan, are
    • Add pending PHP versions to allow_failures on travis.yml (8.0, 8.1, nightly)
    • For each failed test group, issues related to Backward Incompatible Changes
      • Fix the issue on a dedicated pull request
    • For each Backward Incompatible Changes that are not tackled, needs to search code occurrences
      • Add test to cover and fix the issue on a dedicated pull request
    • etc...

Each problem will have its own solution, it will be challenging. So I invite you both to submit pull requests, I will be happy to code-review.

As I said before, let's go step by step.

What do you think, feedbacks are welcomes ?

@mkopinsky
Copy link
Contributor

I just want to chime in - my team maintains a large sf1 app with no viable migration path to sf2+. There are lots of non-sf1 parts of the codebase - anything not web-focused uses illuminate/queue or custom daemons (which do extend sfTask) but the web portions of the codebase do still use sf1. One of these days I want to convert the tasks and daemons from sfTask to symfony/console, and templates from PHP to twig, and introduce PSR4, and switch from doctrine1 to doctrine2 (this is probably the hardest piece of all). As a whole, though, moving from sf1 to sf2 just isn't feasible on any reasonable timescale.

As far as steps forward:

  • Even if we do break BC by dropping older versions, I'm not sure that warrants a major version bump. Unless by version bump you mean 1.5 to 1.6. Having a 2.0 version of sf1 is just too confusing. This is 2022, composer.lock is a thing, I really expect/hope that people aren't blindly installing the latest fos1/symfony1: dev/master onto their PHP 5.3 servers without any checks. Let's face it, the people still running PHP 5 probably never update dependencies on anything - automatically bumping to a version incompatible with PHP 5 isn't a real worry.
  • I think we should entirely ignore PHP 5.3-5.5. Packagist stats do show a meaningful amount of PHP 5.6 usage, but I think BC to 5.3 is unnecessary. I could also get behind @thirsch's suggestion of supporting 7.3+ if necessary - we don't need to arbitrarily drop support for <=7.2 just because php.net has done so, but if there are features of 7.3+ that we want or need, bumping is fine.
  • I agree with @alquerci's plan of one PR per breaking change. I have no opinion on whether those PRs go into master vs a feature branch.

@thirsch
Copy link
Collaborator

thirsch commented Jan 18, 2022

Thanks for your feedback, @alquerci and @mkopinsky!

Just a short feedback from me:

  • Version: I'd also go for 1.6 (1.5 can be used for any fixes in the old version and 2.0 would be too confusing, as @mkopinsky already said and composer can handle the version selection based on the local or configured php version)
  • Branch: No real opinion here, we can also create a branch for version 1.5 and move master towards the next upcoming release.
  • PRs per issue: Sure, that sounds good.
  • PHP-Version: From what we see in the stats, it should be ok to go at least to 7.0 and 7.1. Maybe we just try to focus on any changes required for 8.x support and try to fix it without changing the minimum version. If it's too much effort to support the older version, we can fix the concrete lowest version? For 8.1 we will have to add the new attribute #[ReturnTypeWillChange] to some methods, but as the attribute is a comment below 8.x, it should be ok.
  • Dev Environment: Having the same docker based env will ease things a lot, so maybe the first pr is to add the required docker files?

@mentalstring
Copy link
Contributor

It's great to still see some activity and interest in this. I'm sure we are not the only ones still having to work on top of sf1 with the problem that moving away from this monolith is a hard thing to do for some projects.

I think in general the feedback so far is fairly aligned, so just sharing my thoughts:

  • Seem consensual that dropping the PHP 5.3-5.5 support is acceptable. Above that, personally, I would go for 7.4 as the new minimum to support due to being the oldest PHP version that still receives security updates, but wouldn't mind keeping support for other 7.x versions if someone there's need/interest.

  • I agree that bumping up the version to 2.0 would be a confusing move and may be overcomplicating things. IMHO, jumping to 1.6 and documenting the BC break would be enough.

  • I have no preference regarding the PRs per issue idea, but, I don't know if making weekly iterations would work: speaking for myself, I can only work on it whenever time allows and that is rarely predictable/consistent. But having a roadmap sounds good.

  • Without being sure where this effort will take us, I would work on this on a branch as to not run the risk of leaving master in an incomplete state where neither 5.3 nor 8.x is fully supported. Once support for 8.x is complete, it would be merged.

    • Optionally, a 1.5 branch could be created from master beforehand, if someone shows interest in having security updates for the PHP 5.x version. In the limit, that 1.5 branch decision could be deferred to whenever that is really needed/asked for which may actually never come.
  • Depending on the branching decision, updating travis.yml for 8.0 and 8.1 and adding a PR with a docker env to facilitate the testing seem like good first steps. If afterwards the existing work to support PHP 8.x could be pushed too, it would enable us to have a better picture of the work still to be done and then plan how to go from there.

@mkopinsky
Copy link
Contributor

I'm curious - if we would schedule a half-day hackathon to collaborate on this, how many of you would be interested/able to participate? Let's say we did it a weekday (Monday through Thursday) starting at 13:00 UTC (thus 8:00 US Eastern, 15:00 Eastern European Time). We could do this via Zoom, Slack, or the like.

If you're interested but that timing doesn't work out (e.g. prefer a weekend, prefer evening, are in a timezone that's not between US Eastern and Eastern European Time) let me know.

If this of interest, we could also coordinate logistics by email - back and forth discussions about scheduling don't need to live permanently in Github Issues. Hit me up at my github username at gmail if you wish.

@e1himself
Copy link
Contributor

e1himself commented Jan 20, 2022

@mkopinsky

FWIW we at @prezly are maintaining a fork of sf1, which has been slowly moving forward (mainly by shaking off old functionality that, as we believe, is better to unload to specialized software. Like view-cache, for example, has been completely dropped in favour of offloading it to Varnish or a similar solution).

It's here https://github.com/rock-symphony/rock-symphony

We're at v10 (which means there were several BC breaks already).

@thirsch
Copy link
Collaborator

thirsch commented Jan 21, 2022

Thanks @e1himself, I've had a look at your project a couple of month ago. The biggest issue for us are your BC breaking changes. We are aiming for just running it with newer PHP versions but without substantial changes in the codebase. New applications have already been moved to a newer Symfony version or to a different framework or technology.

@arendvw
Copy link

arendvw commented Jan 22, 2022

In addition to the statistics: here the list when the support for php stops from the big lts vendors. (They will generally patch up vunerabilities in old php versions)

  Release End of life PHP Version
SUSE Enterprise server 12 2014-02-25 2024-10-31 7.0
SUSE Enterprise server 15 2017-10-18 2028-07-31 7.4; 8.0
Red Hat Enterprise Linux / CentOS 7 2014-06-10 2024-06-30 5.4
Red Hat Enterprise Linux / CentOS 8 2019-05-01 2029-05-01 7.2
Debian 10, Buster 2019-07-06 2022-08-01 7.3
Debian 11, Bullseye 2021-08-14 2023-08-14 7.4
Ubuntu 18.04, Bionic beaver 2018-04-01 2023-04-01 7.2
Ubuntu 20.04, Bionic beaver 2020-04-01 2025-04-01 7.4
Ubuntu 22.04, Bionic beaver 2022-04-01 2027-04-01 8.1

@alquerci
Copy link
Contributor

alquerci commented Jan 22, 2022

Summary

  • test/bin/test php73 highest
    • Failed 1/236 test scripts, 99.58% okay. 1/7477 subtests failed, 99.99% okay.
  • test/bin/test php74 highest
    • Failed 1/236 test scripts, 99.58% okay. 1/7477 subtests failed, 99.99% okay.
  • test/bin/test php80 highest
    • Failed 29/236 test scripts, 87.71% okay. 1435/6317 subtests failed, 77.28% okay.
  • test/bin/test php81 highest
    • Failed 146/236 test scripts, 38.14% okay. 2587/4731 subtests failed, 45.32% okay.

Issues

The first pass, can be reproduced with #262 using command test/bin/test php80 highest.

PHP 7.3 and 7.4

  1. RuntimeException: PHP sent a "warning" error. Trying to access array offset on value of type bool

PHP 8.0

  1. ValueError: DOMDocument::loadHTML(): Argument 1 ($source) must not be empty
  2. ArgumentCountError: Too few arguments to function lime_test::handle_error(), 4 passed and exactly 5 expected
  3. TypeError: count(): Argument 1 ($value) must be of type Countable|array, Foo given
  4. ArgumentCountError: Too few arguments to function lime_test::handle_error(), 4 passed and exactly 5 expected
  5. TypeError: abs(): Argument 1 ($num) must be of type int|float, string given

@alquerci
Copy link
Contributor

What's news ?

symfony1

Good vibes for following PRs

PHP version Status
php80 🟢
php81 🔴

PHP 8.1 tests failed as doctine1 does not support yet.

doctrine1

Good vibes for following PRs

PHP version Status
php80 🔴
php81 🔴

Thanks to @mentalstring, @teymour, @thirsch, @Tybaze, @xNatek

@mentalstring
Copy link
Contributor

Great work in adding support for PHP 8.0 and 8.1 while keeping support all way to 5.3. 👍 And #262 really helped here.

I've been using #266 in a fairly busy website both with 7.4 and 8.0 and spotted no issues so far.

As there's no significant functionality changes and support from PHP 5.3 is kept, it could be the next release, v1.5.14, as there's no need not complicate the versioning. Either way, would be great to see these improvements merged in a near future.

@mentalstring
Copy link
Contributor

I've been using #266 in a fairly busy website both with 7.4 and 8.0 and spotted no issues so far.

After running it with 8.1 I found a few additional things, in particular that the new full_path introduced on PHP8.1 was breaking form validation.

I submitted a PR on https://github.com/Tybaze/symfony1/tree/compat_php8.1 to avoid a separate PR here with changes for PHP8.1 support. @Tybaze Could you take a look and merge when you can?

Otherwise, symfony1 seems to be running smoothly under PHP 8.1 with the changes.

thePanz added a commit to FriendsOfSymfony1/doctrine1 that referenced this issue Oct 5, 2022
…ompose (#86)

Related to FriendsOfSymfony1/symfony1#261

Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>
akhumphrey pushed a commit to JamesAndJamesFulfilment/doctrine1 that referenced this issue Oct 17, 2022
akhumphrey added a commit to JamesAndJamesFulfilment/doctrine1 that referenced this issue Oct 30, 2022
* Fix tests to be able to finish it without a fatal error

Execute record generator related test first

* Fix tests for relationship fetch order when the order is not explicitly set on the query

* Fix PHP 7 compatibility about deep isset() on class that implement ArrayAccess

Fix comments for record filter

* Mark as known bug, integer validation with numbers greater than PHP_INT_MAX

* Fix test for export to XML

* Fix PHP 7.4 compatibility

* Add zlib required PHP extension on composer configuration

* Fix code structure about always close connections after each test

Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>

* Add consistent local environment for testing with docker and docker-compose (FriendsOfSymfony1#86)

Related to FriendsOfSymfony1/symfony1#261

Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>

* Update Builder.php for PHP8 compatibility (FriendsOfSymfony1#82)

Fix mandatory value for array $emittedActAs (PHP 8 compatibility)

* imported double-quoting changes from zikula/doctrine1@bda84a8

* Applied patches from JSB-363 (#1)

* JSB-363: Added missing calls to applyIndexes when considering subqueries/raw SQL (#3)

* Added missing calls for applying indexes to subsuqeries and rawSql queries

* query execution now solely depeneds on getSqlQuery

* Removed redundant binding of indexes to a cached query

* PHP 8.1 > Automatic conversion of false to array is deprecated
Fix Doctrine_Record _invokedSaveHooks cannot assign array value to boolean
Declaration to array instead of boolean

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

* PHP 8.0 > Typing of internal function parameters do not allow null value anymore.

Method str_replace/strtotime now require a string, not null

FIX: PDOStatement::fetch, $cursorOffset must be a int
Doctrine_Connection_Statement->fetch() default value to null

FIX: Private methods cannot be final as they are never overridden by other classes
Doctrine_Query_Having->_parseAliases(), remove "final"

* 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
#[\ReturnTypeWillChange]
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.

Add missing Annotation

* Update Travis to PHP up to 8.1
Php5.3 is broken due to Letsencrypt certificate cannot download composer

* PHP 8.0 > Doctrine_Query:36, uncaught TypeError: Unsupported operand types: string % int

Doctrine_Parser_Xml:89, htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated

https://wiki.php.net/rfc/internal_method_return_types for
Doctrine_Node
Doctrine_Adapter_Mock
Doctrine_EventListener_TestLogger
Doctrine_Parser_Xml

Doctrine_Ticket_1254_TestCase, replace stftime() by date() with format adaptation.

* PHP 8.1 fix last
sfYamlInline, backport fix from Symfony1.

Doctrine_Hydrator_Graph fix array_map, rtrim(): Passing null to parameter #1 ($string) of type string is deprecated
I emmit the hypothese that this array_map was broken, because array_map result is not assigned.

Doctrine_Migration_Diff:333, str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated

Doctrine_Migration_Builder:78:, is_dir(): Passing null to parameter #1 ($filename) of type string is deprecated

Doctrine_Validator_Notblank, allow null value
HydrationListener, in HydrateTestCase.php, fix strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated

internal_method_return_types
https://wiki.php.net/rfc/internal_method_return_types
see 2b2d173 for details
Doctrine_Collection_OnDemand
Doctrine_Validator_Exception

* Fix test 1783 - 64bit compatibility
On 32 bit system, PHP use a float to overflow a bigint.
On 64 bit, PHP int is the same as a database bigint, so this test is not relevant anymore

* PHP 8.1 PDO stringify is now disable by default.

Activate it for Mysql + Sqlite
https://www.php.net/manual/en/migration81.incompatible.php#migration81.incompatible.pdo.mysql

* PHP8.1 Fix: Warning: strtotime() : Epoch doesn't fit in a PHP integer in Doctrine_Record.
This is only happening on 32bit system, because int 32bit could not map the whole strtotime date scope.
Example value: "0000-00-00 00:00:00"
Before 8.1 strtotime returns false, after it return false but also raise a Warning.
@ is slightly lowering performance, it should not trigger any unwanted error, as if format is invalid strtotime should return "false"
As this old project need BC for old system, seems the best fix.

* Annotate can return null

Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>

* Return annotation

Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>

* Return annotation

Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>

* Coding style

And remove an useless return false

Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>
Co-authored-by: Thomas <th@it-solutions-hirsch.de>

* Fix annotation.
Remove Doctrine_Table::findBy* and findByOne* which are not phpdoc valid.
Each class "MyTable" which "Doctrine_Table" should have all magick @method declared

Fix invalid annotation and remove blank lines

* Remove useless string cast by testing null before

* Fix SQLite Connect to return a boolean

* Fix BC compatibility for any dev using fetch($currentOffset = null)

* Commit Suggestions - Fix phpDoc and yoda style

Thanks to thePanz and Alquerci !

Co-authored-by: Alexandre Quercia <alquerci@email.com>
Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>

* Handle default taskName to null, to avoid triggering the strlen(null) php 8.1 incompatibility

* Fix taskname empty length

Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>

* bumped min php version, bumped branch alias

* don't attempt `strtolower` on null values

* updated iterator method signatures to match upstream

* avoid returning any value from a `: void` hinted function

* PHP 8.0 > Typing of internal function parameters do not allow null value anymore.

Method str_replace/strtotime now require a string, not null

FIX: PDOStatement::fetch, $cursorOffset must be a int
Doctrine_Connection_Statement->fetch() default value to null

FIX: Private methods cannot be final as they are never overridden by other classes
Doctrine_Query_Having->_parseAliases(), remove "final"

* PHP 8.1 > Compatibility
sfYamlInline, backport fix from Symfony1.

Doctrine_Hydrator_Graph fix array_map, rtrim(): Passing null to parameter #1 ($string) of type string is deprecated
I emmit the hypothese that this array_map was broken, because array_map result is not assigned.

Doctrine_Migration_Diff:333, str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated

Doctrine_Migration_Builder:78:, is_dir(): Passing null to parameter #1 ($filename) of type string is deprecated

Doctrine_Validator_Notblank, allow null value
HydrationListener, in HydrateTestCase.php, fix strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated

internal_method_return_types
https://wiki.php.net/rfc/internal_method_return_types
see 2b2d173 for details
Doctrine_Collection_OnDemand
Doctrine_Validator_Exception

PHP 8.1 PDO stringify is now disable by default.

Activate it for Mysql + Sqlite
https://www.php.net/manual/en/migration81.incompatible.php#migration81.incompatible.pdo.mysql

PHP 8.1 Fix: Warning: strtotime() : Epoch doesn't fit in a PHP integer in Doctrine_Record.
This is only happening on 32bit system, because int 32bit could not map the whole strtotime date scope.
Example value: "0000-00-00 00:00:00"
Before 8.1 strtotime returns false, after it return false but also raise a Warning.
@ is slightly lowering performance, it should not trigger any unwanted error, as if format is invalid strtotime should return "false"
As this old project need BC for old system, seems the best fix.

PHP 8.1 > Automatic conversion of false to array is deprecated
Fix Doctrine_Record _invokedSaveHooks cannot assign array value to boolean
Declaration to array instead of boolean

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.

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.

Update Travis to PHP up to 8.1

PHP 8.0 > Doctrine_Query:36, uncaught TypeError: Unsupported operand types: string % int

Doctrine_Parser_Xml:89, htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated

https://wiki.php.net/rfc/internal_method_return_types for
Doctrine_Node
Doctrine_Adapter_Mock
Doctrine_EventListener_TestLogger
Doctrine_Parser_Xml

Doctrine_Ticket_1254_TestCase, replace stftime() by date() with format adaptation.

* PR Review - Small bug Fixes

Fix BC compatibility for any dev using fetch($currentOffset = null)
Fix SQLite Connect to return a boolean
Remove useless string cast by testing null before
Check TaskName declaration

Fix test 1783 - 64bit compatibility
On 32 bit system, PHP use a float to overflow a bigint.
On 64 bit, PHP int is the same as a database bigint, so this test is not relevant anymore

* Fix Annotation and Coding Style

* Add proof tast name with empty task name property sets by child class

* minor PSR fixes

* minor tidies suggested at code review

* removed docker environments for testing older php versions

Co-authored-by: Alexandre Quercia <alquerci@email.com>
Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>
Co-authored-by: xNatek <nathan.trenet@gmail.com>
Co-authored-by: Alexander Sims <alexmk92@live.co.uk>
Co-authored-by: Tybaze <tybaze@users.noreply.github.com>
Co-authored-by: Ben Tybaze <6998932+Tybaze@users.noreply.github.com>
Co-authored-by: Thomas <th@it-solutions-hirsch.de>
@thePanz
Copy link
Member

thePanz commented Jan 13, 2023

Should we close this issue as now PHP v8.2 is supported?
@alquerci @thirsch @mentalstring

@thirsch
Copy link
Collaborator

thirsch commented Jan 13, 2023

I agree. One day, it will be required to drop older php versions and hopefully at least one of us remembers this issue and the discussions we already had 😛 But for now, php 8.1 is supported and the primary topic of the issue is solved.

@thePanz thePanz closed this as completed Feb 21, 2023
akhumphrey added a commit to JamesAndJamesFulfilment/doctrine1 that referenced this issue Apr 1, 2024
* Fix tests to be able to finish it without a fatal error

Execute record generator related test first

* Fix tests for relationship fetch order when the order is not explicitly set on the query

* Fix PHP 7 compatibility about deep isset() on class that implement ArrayAccess

Fix comments for record filter

* Mark as known bug, integer validation with numbers greater than PHP_INT_MAX

* Fix test for export to XML

* Fix PHP 7.4 compatibility

* Add zlib required PHP extension on composer configuration

* Fix code structure about always close connections after each test

Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>

* Add consistent local environment for testing with docker and docker-compose (FriendsOfSymfony1#86)

Related to FriendsOfSymfony1/symfony1#261

Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>

* Update Builder.php for PHP8 compatibility (FriendsOfSymfony1#82)

Fix mandatory value for array $emittedActAs (PHP 8 compatibility)

* PHP 8.0 > Typing of internal function parameters do not allow null value anymore.

Method str_replace/strtotime now require a string, not null

FIX: PDOStatement::fetch, $cursorOffset must be a int
Doctrine_Connection_Statement->fetch() default value to null

FIX: Private methods cannot be final as they are never overridden by other classes
Doctrine_Query_Having->_parseAliases(), remove "final"

* PHP 8.1 > Compatibility
sfYamlInline, backport fix from Symfony1.

Doctrine_Hydrator_Graph fix array_map, rtrim(): Passing null to parameter #1 ($string) of type string is deprecated
I emmit the hypothese that this array_map was broken, because array_map result is not assigned.

Doctrine_Migration_Diff:333, str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated

Doctrine_Migration_Builder:78:, is_dir(): Passing null to parameter #1 ($filename) of type string is deprecated

Doctrine_Validator_Notblank, allow null value
HydrationListener, in HydrateTestCase.php, fix strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated

internal_method_return_types
https://wiki.php.net/rfc/internal_method_return_types
see 2b2d173 for details
Doctrine_Collection_OnDemand
Doctrine_Validator_Exception

PHP 8.1 PDO stringify is now disable by default.

Activate it for Mysql + Sqlite
https://www.php.net/manual/en/migration81.incompatible.php#migration81.incompatible.pdo.mysql

PHP 8.1 Fix: Warning: strtotime() : Epoch doesn't fit in a PHP integer in Doctrine_Record.
This is only happening on 32bit system, because int 32bit could not map the whole strtotime date scope.
Example value: "0000-00-00 00:00:00"
Before 8.1 strtotime returns false, after it return false but also raise a Warning.
@ is slightly lowering performance, it should not trigger any unwanted error, as if format is invalid strtotime should return "false"
As this old project need BC for old system, seems the best fix.

PHP 8.1 > Automatic conversion of false to array is deprecated
Fix Doctrine_Record _invokedSaveHooks cannot assign array value to boolean
Declaration to array instead of boolean

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.

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
#[\ReturnTypeWillChange]
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.

Update Travis to PHP up to 8.1

PHP 8.0 > Doctrine_Query:36, uncaught TypeError: Unsupported operand types: string % int

Doctrine_Parser_Xml:89, htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated

https://wiki.php.net/rfc/internal_method_return_types for
Doctrine_Node
Doctrine_Adapter_Mock
Doctrine_EventListener_TestLogger
Doctrine_Parser_Xml

Doctrine_Ticket_1254_TestCase, replace stftime() by date() with format adaptation.

* PR Review - Small bug Fixes

Fix BC compatibility for any dev using fetch($currentOffset = null)
Fix SQLite Connect to return a boolean
Remove useless string cast by testing null before
Check TaskName declaration

Fix test 1783 - 64bit compatibility
On 32 bit system, PHP use a float to overflow a bigint.
On 64 bit, PHP int is the same as a database bigint, so this test is not relevant anymore

* Fix Annotation and Coding Style

* Add proof tast name with empty task name property sets by child class

* Use GitHub actions for Continuous Integration tests

Note: apparently a running MySQL service is not needed to run our tests

* Fix broken tests when not using shared mysql socket within docker containers

* Remove deprecated --no-suggest option from composer

* Update GitHub actions: run pipeline for PRs too

* PHP 8.1 > a few more ReturnTypeWillChange attributes added

* Flushing more than once causes a warning. Resetting $_collections to the initial state avoids it.

* Added type hint for arrays as the second parameter allows both, a string or an array.

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

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

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

* PHP 8.2 > added test environment

* PHP 8.2 > Removed properties from Doctrine_RawSql and used _preQueried in case of clear() and moved the property _pendingJoinConditions fom Doctrine_Query up to Doctrine_Query_Abstract in the hierarchy.

* add double to type check. bug FriendsOfSymfony1#88

* PHP 8.1 > Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated

* removed automated testing for `php7.4` and `php8.0`

* removed duplicate methods from `Collection`

* Update(github) Update github workflows, use composer caches

* Fix array key access in lib/Doctrine/Import/Builder.php

Co-authored-by: Alexandre Quercia <alquerci@email.com>

* removed automated testing for old php versions

* CI: add PHP v8.3 to the CI pipelines (FriendsOfSymfony1#108)

* Remove PHP Pear configurations

* Update GitAttributes file

* Fix PHP deprecations on ArrayAccess and additional classes

* fix(Query): add failed test for column added twice with custom aliases

* Revert "Added fields with alias to pendingFields array, fixed DC-585"

This reverts commit e3ae69c.

* added missing `TRANSACTION` directives to `Mysql` connections

* Fix(Query): column added twice with custom aliases

* ANA-4734 Add trailing line break to base class files (#7)

* Fixed test 1325TestCase.php

* fix(tests) replace use of iconv in SearchTestCase.php

* add(composer): ext-iconv is now a requirement

* Adding columns defined in actAs-templates to the docblock of the generated model class.

* Update readme: we dont have 1.5 here

* Update min PHP version to v7.4 (FriendsOfSymfony1#122)

Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>
Co-authored-by: Thomas <th@it-solutions-hirsch.de>

* Fix invalid docblock for Collection::fromArray()

* Remove unused variable from Collection::fromArray()

* [composer] add sort-packages

* introduce __DIR__ constants

* PHP 8.1 > ReturnTypeWillChange attributes added

* fixed CI tasks on relevant folders

---------

Co-authored-by: Alexandre Quercia <alquerci@email.com>
Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>
Co-authored-by: xNatek <nathan.trenet@gmail.com>
Co-authored-by: Tybaze <tybaze@users.noreply.github.com>
Co-authored-by: Ben Tybaze <6998932+Tybaze@users.noreply.github.com>
Co-authored-by: Thomas A. Hirsch <thomas.hirsch@vema-eg.de>
Co-authored-by: Karoly Gossler <connor@connor.hu>
Co-authored-by: Patrick Pfähler <10995809+paddyhamburg@users.noreply.github.com>
Co-authored-by: Alex Coles <alexcoles@users.noreply.github.com>
Co-authored-by: Thomas <th@it-solutions-hirsch.de>
Co-authored-by: Sergei Miami <miami@blackcrystal.net>
akhumphrey added a commit to JamesAndJamesFulfilment/doctrine1 that referenced this issue Jul 4, 2024
* Fix tests to be able to finish it without a fatal error

Execute record generator related test first

* Fix tests for relationship fetch order when the order is not explicitly set on the query

* Fix PHP 7 compatibility about deep isset() on class that implement ArrayAccess

Fix comments for record filter

* Mark as known bug, integer validation with numbers greater than PHP_INT_MAX

* Fix test for export to XML

* Fix PHP 7.4 compatibility

* Add zlib required PHP extension on composer configuration

* Fix code structure about always close connections after each test

Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>

* Add consistent local environment for testing with docker and docker-compose (FriendsOfSymfony1#86)

Related to FriendsOfSymfony1/symfony1#261

Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>

* Update Builder.php for PHP8 compatibility (FriendsOfSymfony1#82)

Fix mandatory value for array $emittedActAs (PHP 8 compatibility)

* imported double-quoting changes from zikula/doctrine1@bda84a8

* Applied patches from JSB-363 (#1)

* JSB-363: Added missing calls to applyIndexes when considering subqueries/raw SQL (#3)

* Added missing calls for applying indexes to subsuqeries and rawSql queries

* query execution now solely depeneds on getSqlQuery

* Removed redundant binding of indexes to a cached query

* PHP 8.1 > Automatic conversion of false to array is deprecated
Fix Doctrine_Record _invokedSaveHooks cannot assign array value to boolean
Declaration to array instead of boolean

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

* PHP 8.0 > Typing of internal function parameters do not allow null value anymore.

Method str_replace/strtotime now require a string, not null

FIX: PDOStatement::fetch, $cursorOffset must be a int
Doctrine_Connection_Statement->fetch() default value to null

FIX: Private methods cannot be final as they are never overridden by other classes
Doctrine_Query_Having->_parseAliases(), remove "final"

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

Add missing Annotation

* Update Travis to PHP up to 8.1
Php5.3 is broken due to Letsencrypt certificate cannot download composer

* PHP 8.0 > Doctrine_Query:36, uncaught TypeError: Unsupported operand types: string % int

Doctrine_Parser_Xml:89, htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated

https://wiki.php.net/rfc/internal_method_return_types for
Doctrine_Node
Doctrine_Adapter_Mock
Doctrine_EventListener_TestLogger
Doctrine_Parser_Xml

Doctrine_Ticket_1254_TestCase, replace stftime() by date() with format adaptation.

* PHP 8.1 fix last
sfYamlInline, backport fix from Symfony1.

Doctrine_Hydrator_Graph fix array_map, rtrim(): Passing null to parameter #1 ($string) of type string is deprecated
I emmit the hypothese that this array_map was broken, because array_map result is not assigned.

Doctrine_Migration_Diff:333, str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated

Doctrine_Migration_Builder:78:, is_dir(): Passing null to parameter #1 ($filename) of type string is deprecated

Doctrine_Validator_Notblank, allow null value
HydrationListener, in HydrateTestCase.php, fix strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated

internal_method_return_types
https://wiki.php.net/rfc/internal_method_return_types
see 2b2d173 for details
Doctrine_Collection_OnDemand
Doctrine_Validator_Exception

* Fix test 1783 - 64bit compatibility
On 32 bit system, PHP use a float to overflow a bigint.
On 64 bit, PHP int is the same as a database bigint, so this test is not relevant anymore

* PHP 8.1 PDO stringify is now disable by default.

Activate it for Mysql + Sqlite
https://www.php.net/manual/en/migration81.incompatible.php#migration81.incompatible.pdo.mysql

* PHP8.1 Fix: Warning: strtotime() : Epoch doesn't fit in a PHP integer in Doctrine_Record.
This is only happening on 32bit system, because int 32bit could not map the whole strtotime date scope.
Example value: "0000-00-00 00:00:00"
Before 8.1 strtotime returns false, after it return false but also raise a Warning.
@ is slightly lowering performance, it should not trigger any unwanted error, as if format is invalid strtotime should return "false"
As this old project need BC for old system, seems the best fix.

* Annotate can return null

Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>

* Return annotation

Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>

* Return annotation

Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>

* Coding style

And remove an useless return false

Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>
Co-authored-by: Thomas <th@it-solutions-hirsch.de>

* Fix annotation.
Remove Doctrine_Table::findBy* and findByOne* which are not phpdoc valid.
Each class "MyTable" which "Doctrine_Table" should have all magick @method declared

Fix invalid annotation and remove blank lines

* Remove useless string cast by testing null before

* Fix SQLite Connect to return a boolean

* Fix BC compatibility for any dev using fetch($currentOffset = null)

* Commit Suggestions - Fix phpDoc and yoda style

Thanks to thePanz and Alquerci !

Co-authored-by: Alexandre Quercia <alquerci@email.com>
Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>

* Handle default taskName to null, to avoid triggering the strlen(null) php 8.1 incompatibility

* Fix taskname empty length

Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>

* bumped min php version, bumped branch alias

* don't attempt `strtolower` on null values

* updated iterator method signatures to match upstream

* avoid returning any value from a `: void` hinted function

* PHP 8.0 > Typing of internal function parameters do not allow null value anymore.

Method str_replace/strtotime now require a string, not null

FIX: PDOStatement::fetch, $cursorOffset must be a int
Doctrine_Connection_Statement->fetch() default value to null

FIX: Private methods cannot be final as they are never overridden by other classes
Doctrine_Query_Having->_parseAliases(), remove "final"

* PHP 8.1 > Compatibility
sfYamlInline, backport fix from Symfony1.

Doctrine_Hydrator_Graph fix array_map, rtrim(): Passing null to parameter #1 ($string) of type string is deprecated
I emmit the hypothese that this array_map was broken, because array_map result is not assigned.

Doctrine_Migration_Diff:333, str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated

Doctrine_Migration_Builder:78:, is_dir(): Passing null to parameter #1 ($filename) of type string is deprecated

Doctrine_Validator_Notblank, allow null value
HydrationListener, in HydrateTestCase.php, fix strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated

internal_method_return_types
https://wiki.php.net/rfc/internal_method_return_types
see 2b2d173 for details
Doctrine_Collection_OnDemand
Doctrine_Validator_Exception

PHP 8.1 PDO stringify is now disable by default.

Activate it for Mysql + Sqlite
https://www.php.net/manual/en/migration81.incompatible.php#migration81.incompatible.pdo.mysql

PHP 8.1 Fix: Warning: strtotime() : Epoch doesn't fit in a PHP integer in Doctrine_Record.
This is only happening on 32bit system, because int 32bit could not map the whole strtotime date scope.
Example value: "0000-00-00 00:00:00"
Before 8.1 strtotime returns false, after it return false but also raise a Warning.
@ is slightly lowering performance, it should not trigger any unwanted error, as if format is invalid strtotime should return "false"
As this old project need BC for old system, seems the best fix.

PHP 8.1 > Automatic conversion of false to array is deprecated
Fix Doctrine_Record _invokedSaveHooks cannot assign array value to boolean
Declaration to array instead of boolean

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.

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.

Update Travis to PHP up to 8.1

PHP 8.0 > Doctrine_Query:36, uncaught TypeError: Unsupported operand types: string % int

Doctrine_Parser_Xml:89, htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated

https://wiki.php.net/rfc/internal_method_return_types for
Doctrine_Node
Doctrine_Adapter_Mock
Doctrine_EventListener_TestLogger
Doctrine_Parser_Xml

Doctrine_Ticket_1254_TestCase, replace stftime() by date() with format adaptation.

* PR Review - Small bug Fixes

Fix BC compatibility for any dev using fetch($currentOffset = null)
Fix SQLite Connect to return a boolean
Remove useless string cast by testing null before
Check TaskName declaration

Fix test 1783 - 64bit compatibility
On 32 bit system, PHP use a float to overflow a bigint.
On 64 bit, PHP int is the same as a database bigint, so this test is not relevant anymore

* Fix Annotation and Coding Style

* Add proof tast name with empty task name property sets by child class

* minor PSR fixes

* minor tidies suggested at code review

* removed docker environments for testing older php versions

Co-authored-by: Alexandre Quercia <alquerci@email.com>
Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>
Co-authored-by: xNatek <nathan.trenet@gmail.com>
Co-authored-by: Alexander Sims <alexmk92@live.co.uk>
Co-authored-by: Tybaze <tybaze@users.noreply.github.com>
Co-authored-by: Ben Tybaze <6998932+Tybaze@users.noreply.github.com>
Co-authored-by: Thomas <th@it-solutions-hirsch.de>
akhumphrey added a commit to JamesAndJamesFulfilment/doctrine1 that referenced this issue Jul 4, 2024
* Fix tests to be able to finish it without a fatal error

Execute record generator related test first

* Fix tests for relationship fetch order when the order is not explicitly set on the query

* Fix PHP 7 compatibility about deep isset() on class that implement ArrayAccess

Fix comments for record filter

* Mark as known bug, integer validation with numbers greater than PHP_INT_MAX

* Fix test for export to XML

* Fix PHP 7.4 compatibility

* Add zlib required PHP extension on composer configuration

* Fix code structure about always close connections after each test

Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>

* Add consistent local environment for testing with docker and docker-compose (FriendsOfSymfony1#86)

Related to FriendsOfSymfony1/symfony1#261

Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>

* Update Builder.php for PHP8 compatibility (FriendsOfSymfony1#82)

Fix mandatory value for array $emittedActAs (PHP 8 compatibility)

* PHP 8.0 > Typing of internal function parameters do not allow null value anymore.

Method str_replace/strtotime now require a string, not null

FIX: PDOStatement::fetch, $cursorOffset must be a int
Doctrine_Connection_Statement->fetch() default value to null

FIX: Private methods cannot be final as they are never overridden by other classes
Doctrine_Query_Having->_parseAliases(), remove "final"

* PHP 8.1 > Compatibility
sfYamlInline, backport fix from Symfony1.

Doctrine_Hydrator_Graph fix array_map, rtrim(): Passing null to parameter #1 ($string) of type string is deprecated
I emmit the hypothese that this array_map was broken, because array_map result is not assigned.

Doctrine_Migration_Diff:333, str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated

Doctrine_Migration_Builder:78:, is_dir(): Passing null to parameter #1 ($filename) of type string is deprecated

Doctrine_Validator_Notblank, allow null value
HydrationListener, in HydrateTestCase.php, fix strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated

internal_method_return_types
https://wiki.php.net/rfc/internal_method_return_types
see 2b2d173 for details
Doctrine_Collection_OnDemand
Doctrine_Validator_Exception

PHP 8.1 PDO stringify is now disable by default.

Activate it for Mysql + Sqlite
https://www.php.net/manual/en/migration81.incompatible.php#migration81.incompatible.pdo.mysql

PHP 8.1 Fix: Warning: strtotime() : Epoch doesn't fit in a PHP integer in Doctrine_Record.
This is only happening on 32bit system, because int 32bit could not map the whole strtotime date scope.
Example value: "0000-00-00 00:00:00"
Before 8.1 strtotime returns false, after it return false but also raise a Warning.
@ is slightly lowering performance, it should not trigger any unwanted error, as if format is invalid strtotime should return "false"
As this old project need BC for old system, seems the best fix.

PHP 8.1 > Automatic conversion of false to array is deprecated
Fix Doctrine_Record _invokedSaveHooks cannot assign array value to boolean
Declaration to array instead of boolean

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.

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.

Update Travis to PHP up to 8.1

PHP 8.0 > Doctrine_Query:36, uncaught TypeError: Unsupported operand types: string % int

Doctrine_Parser_Xml:89, htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated

https://wiki.php.net/rfc/internal_method_return_types for
Doctrine_Node
Doctrine_Adapter_Mock
Doctrine_EventListener_TestLogger
Doctrine_Parser_Xml

Doctrine_Ticket_1254_TestCase, replace stftime() by date() with format adaptation.

* PR Review - Small bug Fixes

Fix BC compatibility for any dev using fetch($currentOffset = null)
Fix SQLite Connect to return a boolean
Remove useless string cast by testing null before
Check TaskName declaration

Fix test 1783 - 64bit compatibility
On 32 bit system, PHP use a float to overflow a bigint.
On 64 bit, PHP int is the same as a database bigint, so this test is not relevant anymore

* Fix Annotation and Coding Style

* Add proof tast name with empty task name property sets by child class

* Use GitHub actions for Continuous Integration tests

Note: apparently a running MySQL service is not needed to run our tests

* Fix broken tests when not using shared mysql socket within docker containers

* Remove deprecated --no-suggest option from composer

* Update GitHub actions: run pipeline for PRs too

* PHP 8.1 > a few more ReturnTypeWillChange attributes added

* Flushing more than once causes a warning. Resetting $_collections to the initial state avoids it.

* Added type hint for arrays as the second parameter allows both, a string or an array.

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

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

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

* PHP 8.2 > added test environment

* PHP 8.2 > Removed properties from Doctrine_RawSql and used _preQueried in case of clear() and moved the property _pendingJoinConditions fom Doctrine_Query up to Doctrine_Query_Abstract in the hierarchy.

* add double to type check. bug FriendsOfSymfony1#88

* PHP 8.1 > Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated

* removed automated testing for `php7.4` and `php8.0`

* removed duplicate methods from `Collection`

* Update(github) Update github workflows, use composer caches

* Fix array key access in lib/Doctrine/Import/Builder.php

Co-authored-by: Alexandre Quercia <alquerci@email.com>

* removed automated testing for old php versions

* CI: add PHP v8.3 to the CI pipelines (FriendsOfSymfony1#108)

* Remove PHP Pear configurations

* Update GitAttributes file

* Fix PHP deprecations on ArrayAccess and additional classes

* fix(Query): add failed test for column added twice with custom aliases

* Revert "Added fields with alias to pendingFields array, fixed DC-585"

This reverts commit e3ae69c.

* added missing `TRANSACTION` directives to `Mysql` connections

* Fix(Query): column added twice with custom aliases

* ANA-4734 Add trailing line break to base class files (#7)

* Fixed test 1325TestCase.php

* fix(tests) replace use of iconv in SearchTestCase.php

* add(composer): ext-iconv is now a requirement

* Adding columns defined in actAs-templates to the docblock of the generated model class.

* Update readme: we dont have 1.5 here

* Update min PHP version to v7.4 (FriendsOfSymfony1#122)

Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>
Co-authored-by: Thomas <th@it-solutions-hirsch.de>

* Fix invalid docblock for Collection::fromArray()

* Remove unused variable from Collection::fromArray()

* [composer] add sort-packages

* introduce __DIR__ constants

* PHP 8.1 > ReturnTypeWillChange attributes added

* fixed CI tasks on relevant folders

---------

Co-authored-by: Alexandre Quercia <alquerci@email.com>
Co-authored-by: Emanuele Panzeri <thepanz@gmail.com>
Co-authored-by: xNatek <nathan.trenet@gmail.com>
Co-authored-by: Tybaze <tybaze@users.noreply.github.com>
Co-authored-by: Ben Tybaze <6998932+Tybaze@users.noreply.github.com>
Co-authored-by: Thomas A. Hirsch <thomas.hirsch@vema-eg.de>
Co-authored-by: Karoly Gossler <connor@connor.hu>
Co-authored-by: Patrick Pfähler <10995809+paddyhamburg@users.noreply.github.com>
Co-authored-by: Alex Coles <alexcoles@users.noreply.github.com>
Co-authored-by: Thomas <th@it-solutions-hirsch.de>
Co-authored-by: Sergei Miami <miami@blackcrystal.net>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants