From 816ad137a001c84fb96d9350b07eea30fc278ff5 Mon Sep 17 00:00:00 2001 From: "Thomas A. Hirsch" Date: Thu, 15 Dec 2022 11:14:15 +0100 Subject: [PATCH 1/5] PHP 8.2 > Creation of dynamic property Class::$property is deprecated --- lib/Doctrine/Connection.php | 1 + lib/Doctrine/Hydrator/Graph.php | 4 +++- lib/Doctrine/Import/Builder.php | 1 + lib/Doctrine/RawSql.php | 5 +++++ lib/Doctrine/Sequence/Mssql.php | 2 ++ lib/Doctrine/Task/BuildAll.php | 1 + lib/Doctrine/Task/BuildAllLoad.php | 3 +++ lib/Doctrine/Task/BuildAllReload.php | 3 +++ lib/Doctrine/Task/RebuildDb.php | 4 ++++ tests/Cache/DbTestCase.php | 2 ++ tests/Connection/CustomTestCase.php | 3 +++ tests/DoctrineTest/Doctrine_UnitTestCase.php | 6 +++++- tests/DoctrineTest/GroupTest.php | 2 ++ tests/ManagerTestCase.php | 6 ++++++ tests/Record/FromArrayTestCase.php | 2 ++ tests/Record/SynchronizeTestCase.php | 2 ++ tests/Search/FileTestCase.php | 2 ++ tests/TableTestCase.php | 4 ++-- tests/Ticket/1106TestCase.php | 2 ++ tests/Ticket/1131TestCase.php | 2 ++ tests/Ticket/1436TestCase.php | 4 ++++ tests/Ticket/1992TestCase.php | 4 ++++ tests/Ticket/2158TestCase.php | 2 ++ tests/Ticket/982TestCase.php | 5 ++++- 24 files changed, 67 insertions(+), 5 deletions(-) diff --git a/lib/Doctrine/Connection.php b/lib/Doctrine/Connection.php index 338bb060d..73a7e5fa7 100644 --- a/lib/Doctrine/Connection.php +++ b/lib/Doctrine/Connection.php @@ -188,6 +188,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun */ protected $_tableCache; protected $_tableCacheTTL; + protected $exported; /** * the constructor diff --git a/lib/Doctrine/Hydrator/Graph.php b/lib/Doctrine/Hydrator/Graph.php index 88232a889..bb4ae6a24 100644 --- a/lib/Doctrine/Hydrator/Graph.php +++ b/lib/Doctrine/Hydrator/Graph.php @@ -35,7 +35,9 @@ */ abstract class Doctrine_Hydrator_Graph extends Doctrine_Hydrator_Abstract { - protected $_tables = array(); + protected + $_tables = array(), + $_rootAlias = null; /** * Gets the custom field used for indexing for the specified component alias. diff --git a/lib/Doctrine/Import/Builder.php b/lib/Doctrine/Import/Builder.php index 2ea5fc983..d27cd4206 100644 --- a/lib/Doctrine/Import/Builder.php +++ b/lib/Doctrine/Import/Builder.php @@ -36,6 +36,7 @@ * @author Nicolas BĂ©rard-Nault * @author Jonathan H. Wage */ +#[\AllowDynamicProperties] class Doctrine_Import_Builder extends Doctrine_Builder { /** diff --git a/lib/Doctrine/RawSql.php b/lib/Doctrine/RawSql.php index 25c07317b..7fb3d9b7c 100644 --- a/lib/Doctrine/RawSql.php +++ b/lib/Doctrine/RawSql.php @@ -42,6 +42,11 @@ class Doctrine_RawSql extends Doctrine_Query_Abstract * @var array $fields */ private $fields = array(); + /** + * @var false + */ + protected $_preQuery; + protected $_pendingJoinConditions; /** * Constructor. diff --git a/lib/Doctrine/Sequence/Mssql.php b/lib/Doctrine/Sequence/Mssql.php index 5b786560a..fff760886 100644 --- a/lib/Doctrine/Sequence/Mssql.php +++ b/lib/Doctrine/Sequence/Mssql.php @@ -32,6 +32,8 @@ */ class Doctrine_Sequence_Mssql extends Doctrine_Sequence { + protected $warnings; + /** * Returns the next free id of a sequence * diff --git a/lib/Doctrine/Task/BuildAll.php b/lib/Doctrine/Task/BuildAll.php index 2d5a4bb9d..07d07e216 100644 --- a/lib/Doctrine/Task/BuildAll.php +++ b/lib/Doctrine/Task/BuildAll.php @@ -37,6 +37,7 @@ class Doctrine_Task_BuildAll extends Doctrine_Task $optionalArguments = array(); protected $models, + $createDb, $tables; public function __construct($dispatcher = null) diff --git a/lib/Doctrine/Task/BuildAllLoad.php b/lib/Doctrine/Task/BuildAllLoad.php index 6b6d2fc5a..90e685a01 100644 --- a/lib/Doctrine/Task/BuildAllLoad.php +++ b/lib/Doctrine/Task/BuildAllLoad.php @@ -35,6 +35,9 @@ class Doctrine_Task_BuildAllLoad extends Doctrine_Task public $description = 'Calls build-all, and load-data', $requiredArguments = array(), $optionalArguments = array(); + + protected $buildAll, + $loadData; public function __construct($dispatcher = null) { diff --git a/lib/Doctrine/Task/BuildAllReload.php b/lib/Doctrine/Task/BuildAllReload.php index f06475cf2..1cd3c1aba 100644 --- a/lib/Doctrine/Task/BuildAllReload.php +++ b/lib/Doctrine/Task/BuildAllReload.php @@ -35,6 +35,9 @@ class Doctrine_Task_BuildAllReload extends Doctrine_Task public $description = 'Calls rebuild-db and load-data', $requiredArguments = array(), $optionalArguments = array(); + + protected $rebuildDb, + $loadData; public function __construct($dispatcher = null) { diff --git a/lib/Doctrine/Task/RebuildDb.php b/lib/Doctrine/Task/RebuildDb.php index 4a3e66581..ad9623f6d 100644 --- a/lib/Doctrine/Task/RebuildDb.php +++ b/lib/Doctrine/Task/RebuildDb.php @@ -35,6 +35,10 @@ class Doctrine_Task_RebuildDb extends Doctrine_Task public $description = 'Drops and re-creates databases', $requiredArguments = array(), $optionalArguments = array(); + + protected $dropDb, + $createDb, + $createTables; public function __construct($dispatcher = null) { diff --git a/tests/Cache/DbTestCase.php b/tests/Cache/DbTestCase.php index 91dc4563a..594103662 100644 --- a/tests/Cache/DbTestCase.php +++ b/tests/Cache/DbTestCase.php @@ -33,6 +33,8 @@ */ class Doctrine_Cache_Db_TestCase extends Doctrine_Cache_Abstract_TestCase { + protected $cache; + public function setUp() { parent::setUp(); diff --git a/tests/Connection/CustomTestCase.php b/tests/Connection/CustomTestCase.php index 815599ed9..6fd75b448 100644 --- a/tests/Connection/CustomTestCase.php +++ b/tests/Connection/CustomTestCase.php @@ -32,6 +32,9 @@ */ class Doctrine_Connection_Custom_TestCase extends Doctrine_UnitTestCase { + protected $_conn; + protected $_dbh; + public function setUp() { $manager = Doctrine_Manager::getInstance(); diff --git a/tests/DoctrineTest/Doctrine_UnitTestCase.php b/tests/DoctrineTest/Doctrine_UnitTestCase.php index 4883d28d7..a1f0fb2f7 100644 --- a/tests/DoctrineTest/Doctrine_UnitTestCase.php +++ b/tests/DoctrineTest/Doctrine_UnitTestCase.php @@ -53,7 +53,11 @@ class Doctrine_UnitTestCase extends UnitTestCase protected $dataDict; protected $transaction; protected $_name; - + protected $query; + protected $profiler; + protected $import; + protected $sequence; + protected $exc; protected $init = false; diff --git a/tests/DoctrineTest/GroupTest.php b/tests/DoctrineTest/GroupTest.php index 5e826c048..b17f5e37e 100644 --- a/tests/DoctrineTest/GroupTest.php +++ b/tests/DoctrineTest/GroupTest.php @@ -6,6 +6,8 @@ class GroupTest extends UnitTestCase protected $_title; protected $_onlyRunFailed = false; + protected $_formatter; + public function __construct($title, $name) { $this->_title = $title; diff --git a/tests/ManagerTestCase.php b/tests/ManagerTestCase.php index 780926147..752ce6a3f 100644 --- a/tests/ManagerTestCase.php +++ b/tests/ManagerTestCase.php @@ -32,6 +32,12 @@ */ class Doctrine_Manager_TestCase extends Doctrine_UnitTestCase { + protected $conn1_database; + protected $conn2_database; + + protected $conn1; + protected $conn2; + public function testGetInstance() { $this->assertTrue(Doctrine_Manager::getInstance() instanceOf Doctrine_Manager); } diff --git a/tests/Record/FromArrayTestCase.php b/tests/Record/FromArrayTestCase.php index bf0617dae..ee6922545 100755 --- a/tests/Record/FromArrayTestCase.php +++ b/tests/Record/FromArrayTestCase.php @@ -32,6 +32,8 @@ */ class Doctrine_Record_FromArray_TestCase extends Doctrine_UnitTestCase { + protected $previous_group; + public function prepareTables() { parent::prepareTables(); diff --git a/tests/Record/SynchronizeTestCase.php b/tests/Record/SynchronizeTestCase.php index 67027c15a..76457457b 100644 --- a/tests/Record/SynchronizeTestCase.php +++ b/tests/Record/SynchronizeTestCase.php @@ -32,6 +32,8 @@ */ class Doctrine_Record_Synchronize_TestCase extends Doctrine_UnitTestCase { + private $previous_group; + public function prepareTables() { parent::prepareTables(); diff --git a/tests/Search/FileTestCase.php b/tests/Search/FileTestCase.php index d592dbe7b..7f2a81c34 100644 --- a/tests/Search/FileTestCase.php +++ b/tests/Search/FileTestCase.php @@ -32,6 +32,8 @@ */ class Doctrine_Search_File_TestCase extends Doctrine_UnitTestCase { + protected $_search; + public function prepareData() { } public function prepareTables() diff --git a/tests/TableTestCase.php b/tests/TableTestCase.php index 793e9672e..3de7b5ce9 100644 --- a/tests/TableTestCase.php +++ b/tests/TableTestCase.php @@ -153,9 +153,9 @@ public function testGetData() public function testSetSequenceName() { - $this->objTable->sequenceName = 'test-seq'; + $this->objTable->setOption('sequenceName', 'test-seq'); $this->assertEqual($this->objTable->sequenceName, 'test-seq'); - $this->objTable->sequenceName = null; + $this->objTable->setOption('sequenceName', null); } public function testCreate() diff --git a/tests/Ticket/1106TestCase.php b/tests/Ticket/1106TestCase.php index 7468852f4..8bc5d6f8d 100644 --- a/tests/Ticket/1106TestCase.php +++ b/tests/Ticket/1106TestCase.php @@ -32,6 +32,8 @@ */ class Doctrine_Ticket_1106_TestCase extends Doctrine_UnitTestCase { + protected $user_id; + public function prepareTables() { parent::prepareTables(); diff --git a/tests/Ticket/1131TestCase.php b/tests/Ticket/1131TestCase.php index 2a90ebcb3..9291329d2 100644 --- a/tests/Ticket/1131TestCase.php +++ b/tests/Ticket/1131TestCase.php @@ -32,6 +32,8 @@ */ class Doctrine_Ticket_1131_TestCase extends Doctrine_UnitTestCase { + private $role_one, $role_two; + public function prepareTables() { //$this->tables = array(); diff --git a/tests/Ticket/1436TestCase.php b/tests/Ticket/1436TestCase.php index db30bd4b7..43ce87771 100644 --- a/tests/Ticket/1436TestCase.php +++ b/tests/Ticket/1436TestCase.php @@ -32,6 +32,10 @@ */ class Doctrine_Ticket_1436_TestCase extends Doctrine_UnitTestCase { + protected $group_one; + protected $group_two; + protected $group_three; + public function prepareTables() { parent::prepareTables(); diff --git a/tests/Ticket/1992TestCase.php b/tests/Ticket/1992TestCase.php index 7da049494..c7691df8f 100644 --- a/tests/Ticket/1992TestCase.php +++ b/tests/Ticket/1992TestCase.php @@ -32,6 +32,10 @@ */ class Doctrine_Ticket_1992_TestCase extends Doctrine_UnitTestCase { + protected $person; + protected $profile1; + protected $profile2; + public function prepareTables() { $this->tables[] = 'Ticket_1992_Person'; diff --git a/tests/Ticket/2158TestCase.php b/tests/Ticket/2158TestCase.php index 7531719c9..02d40cdd0 100644 --- a/tests/Ticket/2158TestCase.php +++ b/tests/Ticket/2158TestCase.php @@ -2,6 +2,8 @@ class Doctrine_Ticket_2158_TestCase extends Doctrine_UnitTestCase { + protected $myModel; + public function prepareTables() { $this->tables[] = "T2158_Model1"; diff --git a/tests/Ticket/982TestCase.php b/tests/Ticket/982TestCase.php index 781b305a1..d541ccd11 100644 --- a/tests/Ticket/982TestCase.php +++ b/tests/Ticket/982TestCase.php @@ -3,7 +3,10 @@ * Test to ensure LocalKey Relations allow 0 for id value */ class Doctrine_Ticket_982_TestCase extends Doctrine_UnitTestCase -{ +{ + protected $myModelOne; + protected $myModelTwo; + public function prepareTables() { $this->tables = array(); From a572748b57b387135f3e3fb504d52cddce2c96b6 Mon Sep 17 00:00:00 2001 From: "Thomas A. Hirsch" Date: Thu, 15 Dec 2022 11:14:46 +0100 Subject: [PATCH 2/5] PHP 8.2 > Using ${var} in strings is deprecated, use {$var} instead. --- lib/Doctrine/Cli/AnsiColorFormatter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Doctrine/Cli/AnsiColorFormatter.php b/lib/Doctrine/Cli/AnsiColorFormatter.php index b3d1aa444..cca3afb7d 100644 --- a/lib/Doctrine/Cli/AnsiColorFormatter.php +++ b/lib/Doctrine/Cli/AnsiColorFormatter.php @@ -115,7 +115,7 @@ public function formatSection($section, $text, $size = null) { $width = 9 + strlen($this->format('', 'INFO')); - return sprintf(">> %-${width}s %s", $this->format($section, 'INFO'), $this->excerpt($text, $size)); + return sprintf(">> %-{$width}s %s", $this->format($section, 'INFO'), $this->excerpt($text, $size)); } /** From 72a9ff94e053f4e56274f1b84db59504f35931e6 Mon Sep 17 00:00:00 2001 From: "Thomas A. Hirsch" Date: Thu, 15 Dec 2022 11:15:02 +0100 Subject: [PATCH 3/5] PHP 8.0 > Trying to access array offset on value of type bool --- lib/Doctrine/Manager.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Doctrine/Manager.php b/lib/Doctrine/Manager.php index fe7560b4c..a2b08944d 100644 --- a/lib/Doctrine/Manager.php +++ b/lib/Doctrine/Manager.php @@ -411,6 +411,10 @@ protected function _buildDsnPartsArray($dsn) // silence any warnings $parts = @parse_url($dsn); + if ($parts === false) { + $parts = array(); + } + $names = array('dsn', 'scheme', 'host', 'port', 'user', 'pass', 'path', 'query', 'fragment'); foreach ($names as $name) { From 33bca654da7ccaee511ccb90c35aa28bcef2106d Mon Sep 17 00:00:00 2001 From: "Thomas A. Hirsch" Date: Thu, 15 Dec 2022 11:16:32 +0100 Subject: [PATCH 4/5] PHP 8.2 > added test environment --- .docker/{php74_81 => php74_82}/Dockerfile | 0 .github/workflows/continuous-integration.yml | 1 + docker-compose.yml | 13 ++++++++++--- 3 files changed, 11 insertions(+), 3 deletions(-) rename .docker/{php74_81 => php74_82}/Dockerfile (100%) diff --git a/.docker/php74_81/Dockerfile b/.docker/php74_82/Dockerfile similarity index 100% rename from .docker/php74_81/Dockerfile rename to .docker/php74_82/Dockerfile diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 800df6757..23e86a887 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -20,6 +20,7 @@ jobs: - "7.4" - "8.0" - "8.1" + - "8.2" steps: - name: "Checkout" diff --git a/docker-compose.yml b/docker-compose.yml index 98dfe7ab4..9c36afacc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -103,24 +103,31 @@ services: php74: <<: *services_php54 build: - context: .docker/php74_81 + context: .docker/php74_82 args: PHP_VERSION: '7.4' php80: <<: *services_php54 build: - context: .docker/php74_81 + context: .docker/php74_82 args: PHP_VERSION: '8.0' php81: <<: *services_php54 build: - context: .docker/php74_81 + context: .docker/php74_82 args: PHP_VERSION: '8.1' + php82: + <<: *services_php54 + build: + context: .docker/php74_82 + args: + PHP_VERSION: '8.2' + db: image: mysql:5.5.62 environment: From 0241c0b26cb95440a36ce25589275096d0329c07 Mon Sep 17 00:00:00 2001 From: "Thomas A. Hirsch" Date: Mon, 9 Jan 2023 22:06:26 +0100 Subject: [PATCH 5/5] 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. --- lib/Doctrine/Query.php | 5 ----- lib/Doctrine/Query/Abstract.php | 5 +++++ lib/Doctrine/RawSql.php | 7 +------ 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/lib/Doctrine/Query.php b/lib/Doctrine/Query.php index 99f54a170..2ae35ee15 100644 --- a/lib/Doctrine/Query.php +++ b/lib/Doctrine/Query.php @@ -160,11 +160,6 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable */ protected $_parsers = array(); - /** - * @var array $_pendingJoinConditions an array containing pending joins - */ - protected $_pendingJoinConditions = array(); - /** * @var array */ diff --git a/lib/Doctrine/Query/Abstract.php b/lib/Doctrine/Query/Abstract.php index 3025bd09e..6042ed18e 100644 --- a/lib/Doctrine/Query/Abstract.php +++ b/lib/Doctrine/Query/Abstract.php @@ -267,6 +267,11 @@ abstract class Doctrine_Query_Abstract */ protected $_preQueried = false; + /** + * @var array $_pendingJoinConditions an array containing pending joins + */ + protected $_pendingJoinConditions = array(); + /** * Fix for http://www.doctrine-project.org/jira/browse/DC-701 * diff --git a/lib/Doctrine/RawSql.php b/lib/Doctrine/RawSql.php index 7fb3d9b7c..73220e2e9 100644 --- a/lib/Doctrine/RawSql.php +++ b/lib/Doctrine/RawSql.php @@ -42,11 +42,6 @@ class Doctrine_RawSql extends Doctrine_Query_Abstract * @var array $fields */ private $fields = array(); - /** - * @var false - */ - protected $_preQuery; - protected $_pendingJoinConditions; /** * Constructor. @@ -64,7 +59,7 @@ function __construct(Doctrine_Connection $connection = null, Doctrine_Hydrator_A protected function clear() { - $this->_preQuery = false; + $this->_preQueried = false; $this->_pendingJoinConditions = array(); }