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

Add consistent local environment for testing with docker and docker-compose #86

Merged
merged 2 commits into from
Oct 5, 2022

Conversation

alquerci
Copy link

@alquerci alquerci commented Jun 10, 2022

Goal

  • Removes all side work for contributors that do not provide any value, except effective improvements
  • Provide the same testing environment for everyone.
  • Help contributors to win the big challenge of PHP new versions supports, while BC layer are kept.
  • Provide a bit more confidence during the development by reducing the testing feedback loop.

Its twin is FriendsOfSymfony1/symfony1#262

Usage

Look at the README.md.

In short

test/bin/test

Test results

Same matrix than travis-ci

Based on #56

PHP version Status
php53 🟢
php54 🟢
php55 🟢
php56 🟢
php70 🟢
php71 🟢
php72 🟢
php73 🟢
php74 🟢

New additional matrix (disabled by default)

Even with current #85

PHP version Status
php80 🔴
Fatal error: Uncaught TypeError: Unsupported operand types: string % int in /app/lib/Doctrine/Query.php:1426
Stack trace:
#0 /app/lib/Doctrine/Query.php(1281): Doctrine_Query->getLimitSubquery()
#1 /app/lib/Doctrine/Query.php(1150): Doctrine_Query->buildSqlQuery(true)

Related to FriendsOfSymfony1/symfony1#261

@alquerci alquerci changed the title [WIP] Add consistent local environment for testing with docker and docker-compose Add consistent local environment for testing with docker and docker-compose Jun 10, 2022
@Tybaze Tybaze mentioned this pull request Jun 11, 2022
Copy link
Collaborator

@Tybaze Tybaze left a comment

Choose a reason for hiding this comment

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

Everything works for me - Confirm from PHP5.3 to 7.4
Greate job to earn time

@@ -0,0 +1,54 @@
Doctrine1
Copy link
Member

Choose a reason for hiding this comment

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

The heading is not consistent within the file (using ### Header 3 and underlines, like on this like)

We should keep the formatting consistent, I suggest to use:

  • # Header 1
  • ## Hader 2

wdyt?

Copy link
Author

Choose a reason for hiding this comment

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

I do not have any point of view about Markdown formatting.

I am curious about that, do you have some resources to share ?

#
dcexec="docker-compose exec -u `id -u`:`id -g`"
composerUpdate='composer update --prefer-dist --no-suggest --optimize-autoloader'
doctrineTestSuite='run.php'
Copy link
Member

Choose a reason for hiding this comment

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

Why would we need to change this?

Copy link
Author

Choose a reason for hiding this comment

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

To speed up feedback loop during TDD sessions, when the modified does not touch outside.

The full test suite is slow, moreover, with all PHP version to execute. That's a problem.

So, need to run only one test case.
The test tool does not allow it, as I saw, so new feature.

@@ -0,0 +1,76 @@
#! /bin/sh -eu
#
# [<php-version>] [<dependency-preference>] [<php-test-runtime>]
Copy link
Member

Choose a reason for hiding this comment

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

Would it be possible to split this into 2 scripts?

  • first scripts takes the php version, dependency-level [highest|lowest]
  • second script to run tests for all php versions

WDYT?

Copy link
Author

Choose a reason for hiding this comment

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

What issue should this fix ?

Copy link
Author

Choose a reason for hiding this comment

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

Here, what I think.

The current script if a first step that can be improved.

Regarding developer experience

We need simplicity over complexity or confusion.

2 test scripts available are already too much.

2 test scripts will bring too much complexity and confusion.

The goal is to have only one command to execute the test suite and that done things well.

tests/bin/test

If this command done successfully you should feel safe to merge the code or submit the pull request.

Quote from the book "Clean Code" wrote by Robert C. Martin

You should be able to run all the unit tests with just one command. In the best case you can run all the tests by clicking on one button in your IDE. In the worst case you should be able to issue a single simple command in a shell. Being able to run all the tests is so fundamental and so important that it should be quick, easy, and obvious to do.

- -c
- |
{
echo 'pdo_mysql.default_socket = /var/run/mysqld/mysql.sock'
Copy link
Member

Choose a reason for hiding this comment

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

Can we move this into a file, and copy it into the build image?
The file looks like the same for php 5.3 and next versions, the difference is its location path

WDYT?

Copy link
Author

Choose a reason for hiding this comment

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

Exactly

- |
exec tail -f /dev/null

php53:
Copy link
Member

Choose a reason for hiding this comment

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

Instead of multiple service, we could merge together multiple docker-compose files
and with a Makefile choose which PHP container to start:
something like docker-compose --file=docker-compose.yml --file=docker/docker-compose.php5.yml

WDYT?

Copy link
Author

Choose a reason for hiding this comment

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

Nice refacto.

I do not have time to implements right now.

@alquerci alquerci force-pushed the add-docker-compose branch from b66c332 to 7387f21 Compare October 5, 2022 10:04
@alquerci
Copy link
Author

alquerci commented Oct 5, 2022

@thePanz I do not have time to implement your nice suggestions right now.

There are good tracks to iterate on this "tool".

SOLID principles can be used anywhere.

@alquerci
Copy link
Author

alquerci commented Oct 5, 2022

The first focus will be for developer experience.

So feedbacks on the usage are welcome.

@thePanz
Copy link
Member

thePanz commented Oct 5, 2022

@alquerci could you rebase this PR and fix the conflicts?

@thePanz thePanz merged commit cf59be0 into FriendsOfSymfony1:master Oct 5, 2022
@alquerci alquerci deleted the add-docker-compose branch October 5, 2022 16:25
akhumphrey pushed a commit to JamesAndJamesFulfilment/doctrine1 that referenced this pull request Oct 17, 2022
akhumphrey added a commit to JamesAndJamesFulfilment/doctrine1 that referenced this pull request 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>
akhumphrey added a commit to JamesAndJamesFulfilment/doctrine1 that referenced this pull request 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 pull request 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 pull request 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants