Problem/Motivation

Intend to fix #3275851: [META] Fix PHP 8.2 dynamic property deprecations

Proposed resolution

aggregate of

- #3311383: Apply #[\AllowDynamicProperties] attribute to core classes to allow contrib has less noise in logs
- #3309745: Fix dynamic property deprecations and other unit test failures for PHP 8.2
- #3309748: Define missing object properties on non-testing classes for PHP 8.2
- #3311562: Set sqlQuery in Entity\Query\Sql Condition classes on own class

done

- #2839195: Add a method to access the original property (not needed)
- #3298396: Upgrade composer requirement to 2.3.6 to prevent warnings on PHP 8.2 (needs work for release notes only, has been comitted)
- #3298731: Using ConstraintViolation::$arrayPropertyPath bugs on PHP 8.2
- #3308744: Fix magic connection property access from \Drupal\Core\FileTransfer\FileTransfer::__get()
- #3274474: Fix 'Access to an undefined property' PHPStan L0 errors
- #2531564: Fix leaky and brittle container serialization solution
- #3298906: Fix \Drupal\Tests\Core\Test\TestSetupTraitTest::testChangeDatabasePrefix() on PHP 8.2
- #3298199: Upgrade phpstan/phpstan to 1.8.2 for support of PHP 8.2 #[\AllowDynamicProperties] attribute - required to use #[\AllowDynamicProperties]
- #3295813: ViewsEntitySchemaSubscriber access undefined property of View
- #3299853: Apply #[\AllowDynamicProperties] attribute to base classes to make PHP 8.2 log size sane
- #3299327: Replace deprecated static::method() calls for PHP 8.2
- #3298923: Fix ProtectedUserFieldConstraintValidatorTest to not trigger deprecations on PHP 8.2
- [#]

Remaining tasks

close when parent issue fixed

CommentFileSizeAuthor
#122 3295821-122-9-meta.patch31.91 KBandypost
#122 interdiff.txt578 bytesandypost
#121 3295821-121-9-meta.patch31.73 KBandypost
#121 interdiff.txt565 bytesandypost
#118 3295821-117-9-meta.patch31.74 KBandypost
#118 interdiff.txt489 bytesandypost
#116 interdiff.txt616 bytesandypost
#116 3295821-116-9-meta.patch31.26 KBandypost
#115 3295821-115-9-meta.patch30.66 KBandypost
#115 3295821-115-9.patch5.65 KBandypost
#114 3295821-114.patch29.04 KBandypost
#114 interdiff.txt3.96 KBandypost
#113 3295821-113.patch26.17 KBandypost
#113 interdiff.txt1.87 KBandypost
#112 3295821-112.patch24.65 KBandypost
#112 interdiff.txt1.46 KBandypost
#111 3295821-111.patch24.3 KBandypost
#110 3311383-6.patch2.75 KBandypost
#109 3295821-109.patch23.13 KBandypost
#109 interdiff_0.txt1.98 KBandypost
#107 3295821-107.patch22.14 KBandypost
#107 interdiff.txt508 bytesandypost
#106 3295821-106.patch21.65 KBandypost
#106 interdiff.txt4.12 KBandypost
#104 3295821-104.patch25.76 KBandypost
#104 interdiff.txt407 bytesandypost
#103 3295821-103.patch25.59 KBandypost
#103 interdiff.txt432 bytesandypost
#100 3295821-100.patch29.86 KBandypost
#100 interdiff.txt961 bytesandypost
#98 3295821-98.patch28.92 KBandypost
#98 interdiff.txt583 bytesandypost
#94 3295821-94.patch39.05 KBandypost
#93 3295821-93.patch38.11 KBandypost
#90 3295821-90.patch38.79 KBandypost
#89 3295821-89.patch90.39 KBandypost
#89 interdiff.txt22.16 KBandypost
#88 3295821-88.patch85.13 KBandypost
#88 interdiff.txt27.09 KBandypost
#87 3295821-87.patch65.64 KBandypost
#85 3295821-85.patch144.33 KBandypost
#84 3295821-84.patch183.08 KBandypost
#83 3295821-83.patch183.08 KBandypost
#82 3295821-82.patch183.06 KBandypost
#80 3295821-80.patch183.07 KBandypost
#80 interdiff.txt3.36 KBandypost
#79 3295821-79.patch180.34 KBandypost
#77 3295821-78.patch180.37 KBandypost
#77 interdiff.txt2.14 KBandypost
#76 interdiff.txt742 bytesandypost
#75 3295821-75.patch178.64 KBandypost
#74 3295821-74.patch179.2 KBandypost
#73 3295821-73.patch220.71 KBandypost
#72 3295821-71.patch223.26 KBandypost
#70 3295821-70.patch220.5 KBandypost
#69 3295821-69.patch181.19 KBandypost
#65 3295821-65.patch181.23 KBandypost
#64 3295821-64.patch182.57 KBandypost
#63 3295821-63.patch186.14 KBandypost
#62 3295821-62.patch3.82 KBandypost
#37 3295821-37.patch196.16 KBandypost
#7 3295821-7.patch109.65 KBandypost
#37 interdiff.txt1.57 KBandypost
#8 3295821-8.patch108.29 KBandypost
#3 3295821-3.patch104.17 KBandypost
#9 3295821-9.patch176.73 KBandypost
#4 3295821-4.patch104.86 KBandypost
#9 interdiff.txt14.38 KBandypost
#5 3295821-5.patch43.84 KBandypost
#10 interdiff.txt2.24 KBandypost
#6 3295821-5.patch148.29 KBandypost
#10 3295821-10.patch178.96 KBandypost
#11 interdiff.txt1.61 KBandypost
#11 3295821-11.patch180.58 KBandypost
#12 interdiff.txt1.31 KBandypost
#12 3295821-12.patch181.89 KBandypost
#13 interdiff.txt1.48 KBandypost
#13 3295821-13.patch182.96 KBandypost
#14 interdiff.txt750 bytesandypost
#14 3295821-14.patch182.96 KBandypost
#15 interdiff.txt516 bytesandypost
#15 3295821-15.patch183.01 KBandypost
#16 3295821-16.patch182 KBandypost
#17 interdiff.txt4.12 KBandypost
#17 3295821-17.patch185.77 KBandypost
#18 interdiff.txt2.19 KBandypost
#18 3295821-18.patch187.45 KBandypost
#19 interdiff.txt717 bytesandypost
#19 3295821-19.patch187.45 KBandypost
#21 interdiff.txt486 bytesandypost
#21 3295821-21.patch187.92 KBandypost
#22 interdiff.txt532 bytesandypost
#22 3295821-22.patch188.18 KBandypost
#24 interdiff.txt1.85 KBandypost
#24 3295821-23.patch189.82 KBandypost
#27 interdiff.txt2.07 KBandypost
#27 3295821-27.patch191.1 KBandypost
#28 interdiff.txt1.05 KBandypost
#28 3295821-28.patch191.1 KBandypost
#29 interdiff.txt509 bytesandypost
#29 3295821-29.patch191.1 KBandypost
#31 interdiff.txt1.64 KBandypost
#31 3295821-30.patch191.71 KBandypost
#32 interdiff.txt4.62 KBandypost
#32 3295821-32.patch194.47 KBandypost
#33 interdiff.txt550 bytesandypost
#33 3295821-33.patch195.01 KBandypost
#34 interdiff.txt4.93 KBandypost
#34 3295821-34.patch195.33 KBandypost
#35 interdiff.txt422 bytesandypost
#35 3295821-35.patch194.88 KBandypost
#39 interdiff.txt2.86 KBandypost
#39 3295821-39.patch198.59 KBandypost
#40 3295821-39.patch198.34 KBandypost
#40 interdiff.txt4.82 KBandypost
#40 3295821-40.patch203.16 KBandypost
#42 3295821-42.patch205.71 KBandypost
#43 interdiff.txt2.38 KBandypost
#43 3295821-43.patch207.43 KBandypost
#44 interdiff.txt2.43 KBandypost
#44 3295821-44.patch207.48 KBandypost
#45 interdiff.txt1.07 KBandypost
#45 3295821-45.patch208.55 KBandypost
#46 interdiff.txt1.44 KBandypost
#46 3295821-46.patch209.99 KBandypost
#47 interdiff.txt5.68 KBandypost
#47 3295821-47.patch210.74 KBandypost
#48 interdiff.txt1.04 KBandypost
#48 3295821-48.patch214.14 KBandypost
#49 interdiff.txt14.26 KBandypost
#49 3295821-49.patch209.83 KBandypost
#50 interdiff.txt3.93 KBandypost
#50 3295821-50.patch209.02 KBandypost
#51 3295821-51.patch209.02 KBandypost
#52 3295821-52-composer.patch14.26 KBandypost
#53 3295821-53-composer-attr.patch16.45 KBandypost
#54 interdiff.txt2.19 KBandypost
#55 3295821-54-no-vfs.patch13.35 KBandypost
#56 3295821-56-no-vfs-vs.patch18.01 KBandypost
#58 3295821-58-composer.patch12.09 KBandypost

Comments

andypost created an issue. See original summary.

andypost’s picture

Issue summary: View changes
andypost’s picture

Issue summary: View changes
Status: Active » Needs work
StatusFileSize
new104.17 KB
andypost’s picture

StatusFileSize
new104.86 KB
andypost’s picture

andypost’s picture

StatusFileSize
new148.29 KB
andypost’s picture

StatusFileSize
new109.65 KB
andypost’s picture

StatusFileSize
new108.29 KB

2,581 failed

andypost’s picture

StatusFileSize
new2.24 KB
new178.96 KB

this should fix lots of tests, probably needs new issue

1,907 failed

andypost’s picture

StatusFileSize
new1.61 KB
new180.58 KB

a bit more properties

1,796 failed

andypost’s picture

StatusFileSize
new1.31 KB
new181.89 KB

more migration tests will pass

andypost’s picture

StatusFileSize
new1.48 KB
new182.96 KB

Fix ConfigurationTest and BlockHtmlTest (weird public property \Drupal\Core\Session\UserSession::$sessionId)

andypost’s picture

StatusFileSize
new750 bytes
new182.96 KB

fix #12

andypost’s picture

StatusFileSize
new516 bytes
new183.01 KB

stub phpcs

1,680 failed

andypost’s picture

StatusFileSize
new182 KB

remove modules/views_ui/src/ViewUI.php.orig

1,680 failures

andypost’s picture

StatusFileSize
new4.12 KB
new185.77 KB

fir remaining callables and core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php

andypost’s picture

StatusFileSize
new2.19 KB
new187.45 KB

one more undefined property

andypost’s picture

StatusFileSize
new717 bytes
new187.45 KB

Fix CS for #17

andypost’s picture

1,445. Failed

andypost’s picture

StatusFileSize
new486 bytes
new187.92 KB

Setting #[AllowDynamicProperties] on ConfigEntityBase

948 failed

andypost’s picture

StatusFileSize
new532 bytes
new188.18 KB

\Drupal\views\Plugin\views\PluginBase got annotation

940 failed

andypost’s picture

More fixes for views

andypost’s picture

StatusFileSize
new1.85 KB
new189.82 KB

416 failed

andypost’s picture

Lots of errors because

1) Drupal\Tests\field_ui\Functional\ManageFieldsFunctionalTest::testDefaultValue
Exception: Deprecated function: Creation of dynamic property Symfony\Component\Validator\ConstraintViolation::$arrayPropertyPath is deprecated
Drupal\Core\Field\WidgetBase->flagErrors()() (Line: 452)

sounds like needs drupal-wrapper class to use custom property

andypost’s picture

Another strange runs

-

1) Drupal\Tests\layout_builder\Functional\LayoutBuilderSectionStorageTest::testRenderByContextAwarePluginDelegate
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "overrides" plugin does not exist. Valid plugin IDs for Drupal\layout_builder\SectionStorage\SectionStorageManager are: overrides, layout_builder_test_state, test_simple_config, defaults

-


Unsilenced deprecation notices (3)

  1x: Creation of dynamic property Drupal\Tests\system\Functional\FileTransfer\TestFileTransfer::$jail is deprecated
    1x in FileTransferTest::testJail from Drupal\Tests\system\Functional\FileTransfer

  1x: Creation of dynamic property Drupal\Tests\system\Functional\FileTransfer\TestFileTransfer::$chroot is deprecated
    1x in FileTransferTest::testJail from Drupal\Tests\system\Functional\FileTransfer

  1x: Creation of dynamic property Drupal\Tests\system\Functional\FileTransfer\TestFileTransfer::$connection is deprecated
    1x in FileTransferTest::testJail from Drupal\Tests\system\Functional\FileTransfer
andypost’s picture

StatusFileSize
new2.07 KB
new191.1 KB

Fix mostly all rest and content translation tests

andypost’s picture

StatusFileSize
new1.05 KB
new191.1 KB

Fix CS

Few tests fail with similar

1) Drupal\Tests\node\Kernel\Migrate\d7\MigrateNodeRevisionTest::testNodeRevisions
Attempt to create a field storage comment_body with no type. (/var/www/html/core/modules/field/src/Entity/FieldStorageConfig.php:261)
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'status'
+'error'
Remaining self deprecation notices (82)

  27x: Creation of dynamic property Mock_EntityBase_7c3ee2dd::$id is deprecated
    27x in EntityUnitTest::setUp from Drupal\Tests\Core\Entity

  27x: Creation of dynamic property Mock_EntityBase_7c3ee2dd::$langcode is deprecated
    27x in EntityUnitTest::setUp from Drupal\Tests\Core\Entity

  27x: Creation of dynamic property Mock_EntityBase_7c3ee2dd::$uuid is deprecated
    27x in EntityUnitTest::setUp from Drupal\Tests\Core\Entity

  1x: Creation of dynamic property Mock_EntityBase_7c3ee2dd::$label is deprecated
    1x in EntityUnitTest::testLabel from Drupal\Tests\Core\Entity

mocks needs separate issue

andypost’s picture

StatusFileSize
new509 bytes
new191.1 KB

fix CS again

andypost’s picture

223 failed

andypost’s picture

StatusFileSize
new1.64 KB
new191.71 KB

Still not clear what todo with constraints

Testing Drupal\KernelTests\Core\Entity\FieldWidgetConstraintValidatorTest
...                                                                 3 / 3 (100%)

Time: 00:06.311, Memory: 4.00 MB

OK (3 tests, 25 assertions)

Unsilenced deprecation notices (12)

  12x: Creation of dynamic property Symfony\Component\Validator\ConstraintViolation::$arrayPropertyPath is deprecated
    7x in FieldWidgetConstraintValidatorTest::testValidationWithCompositeConstraint from Drupal\KernelTests\Core\Entity
    3x in FieldWidgetConstraintValidatorTest::testValidation from Drupal\KernelTests\Core\Entity
    2x in FieldWidgetConstraintValidatorTest::testEntityLevelConstraintValidation from Drupal\KernelTests\Core\Entity

186 failed

andypost’s picture

StatusFileSize
new4.62 KB
new194.47 KB

Fix few more test

Lots of migrations are fails because of

1) Drupal\Tests\menu_link_content\Kernel\Migrate\d6\MigrateMenuLinkTest::testMenuLinks
PHPUnit\Framework\Exception: PHP Fatal error:  Uncaught LogicException: Settings can not be serialized. This probably means you are serializing an object that has an indirect reference to the Settings object. Adjust your code so that is not necessary. in /var/www/html/core/lib/Drupal/Core/Site/Settings.php:81

Tricky one \Drupal\Tests\views\Kernel\ModuleTest::testLoadFunctions()

162 failed

andypost’s picture

StatusFileSize
new550 bytes
new195.01 KB

one more callable to make \Drupal\Tests\views\Kernel\ModuleTest::testLoadFunctions() pass

168

andypost’s picture

andypost’s picture

StatusFileSize
new422 bytes
new194.88 KB
andypost’s picture

StatusFileSize
new1.57 KB
new196.16 KB

interdiff vs #34

162 failed

andypost’s picture

StatusFileSize
new2.86 KB
new198.59 KB

Fixed \Drupal\Tests\Core\Test\TestSetupTraitTest - needs new issue

162

andypost’s picture

StatusFileSize
new198.34 KB
new4.82 KB
new203.16 KB
andypost’s picture

Issue summary: View changes
Related issues: +#3298906: Fix \Drupal\Tests\Core\Test\TestSetupTraitTest::testChangeDatabasePrefix() on PHP 8.2

Field_layout.Drupal\Tests\field_layout\FunctionalJavascript\FieldLayoutTest
vs
Media_library.Drupal\Tests\media_library\FunctionalJavascript\WidgetOEmbedTest

fails randomly

andypost’s picture

andypost’s picture

Related issues: +#3298923: Fix ProtectedUserFieldConstraintValidatorTest to not trigger deprecations on PHP 8.2
StatusFileSize
new2.38 KB
new207.43 KB
andypost’s picture

StatusFileSize
new2.43 KB
new207.48 KB

Fix CS

127

andypost’s picture

StatusFileSize
new1.07 KB
new208.55 KB

one more fix for mocks

122

andypost’s picture

StatusFileSize
new1.44 KB
new209.99 KB

another mock

121

andypost’s picture

StatusFileSize
new5.68 KB
new210.74 KB
andypost’s picture

StatusFileSize
new1.04 KB
new214.14 KB
andypost’s picture

StatusFileSize
new14.26 KB
new209.83 KB
andypost’s picture

StatusFileSize
new3.93 KB
new209.02 KB

2 less

116 fails

following fails randomaly

Claro.Drupal\FunctionalJavascriptTests\Theme\ClaroEntityDisplayTest.Drupal\FunctionalJavascriptTests\Theme\ClaroEntityDisplayTest
    Claro.Drupal\FunctionalJavascriptTests\Theme\ClaroEntityDisplayTest.Unknown

    Javascript.Drupal\FunctionalJavascriptTests\Tests\JSWebWithWebDriverAssertTest.Drupal\FunctionalJavascriptTests\Tests\JSWebWithWebDriverAssertTest

    Quickedit.Drupal\Tests\quickedit\FunctionalJavascript\QuickEditFileTest.Drupal\Tests\quickedit\FunctionalJavascript\QuickEditFileTest
    Quickedit.Drupal\Tests\quickedit\FunctionalJavascript\QuickEditFileTest.Unknown
andypost’s picture

StatusFileSize
new209.02 KB

re-roll

andypost’s picture

StatusFileSize
new14.26 KB

check only composer updates

2,993 failed

andypost’s picture

StatusFileSize
new16.45 KB

patch with composer and annotations

2,976 failed

andypost’s picture

StatusFileSize
new2.19 KB
andypost’s picture

StatusFileSize
new13.35 KB

- https://github.com/bovigo/vfsStream/releases/tag/v1.6.11-alpha.0 is required to pass ViewsEntitySchemaSubscriberIntegrationTest

andypost’s picture

StatusFileSize
new18.01 KB

Without stable release the branch will fail as we have a test for required stability <=1

andypost’s picture

andypost’s picture

andypost’s picture

andypost’s picture

andypost’s picture

StatusFileSize
new3.82 KB

upgrade of mglaman/phpstan-drupal

andypost’s picture

StatusFileSize
new186.14 KB

re-roll #51 - 116 fails

andypost’s picture

Related issues: +#3295520: Update dependencies for Drupal 10.0 and 9.5
StatusFileSize
new182.57 KB

re-roll after composer deps are done #3295520: Update dependencies for Drupal 10.0 and 9.5

112 failed

andypost’s picture

Issue summary: View changes
StatusFileSize
new181.23 KB
andypost’s picture

andypost’s picture

Needs reroll

andypost’s picture

StatusFileSize
new181.19 KB

109 failed

andypost’s picture

andypost’s picture

andypost’s picture

StatusFileSize
new223.26 KB

the patch

andypost’s picture

StatusFileSize
new220.71 KB
andypost’s picture

StatusFileSize
new179.2 KB

without settings-addition

andypost’s picture

StatusFileSize
new178.64 KB

24 failed

andypost’s picture

StatusFileSize
new742 bytes
andypost’s picture

StatusFileSize
new2.14 KB
new180.37 KB

2 fixed tests

andypost’s picture

Issue summary: View changes
andypost’s picture

StatusFileSize
new180.34 KB

re-roll

andypost’s picture

andypost’s picture

andypost’s picture

StatusFileSize
new183.06 KB

fix CS

andypost’s picture

StatusFileSize
new183.08 KB
andypost’s picture

StatusFileSize
new183.08 KB

20 failed

andypost’s picture

StatusFileSize
new144.33 KB
andypost’s picture

Issue summary: View changes
andypost’s picture

Issue summary: View changes
StatusFileSize
new65.64 KB
andypost’s picture

Issue summary: View changes
StatusFileSize
new27.09 KB
new85.13 KB

There's more fixes then 3 issues in summary

Rebased changes and replaced patch #24 with #48 from #3298731: Using ConstraintViolation::$arrayPropertyPath bugs on PHP 8.2

andypost’s picture

Issue summary: View changes
StatusFileSize
new22.16 KB
new90.39 KB

Added missing 2 files, interdiff vs #87

20 fails

andypost’s picture

StatusFileSize
new38.79 KB

Let's see how it went without #2839195: Add a method to access the original property

829 fails

berdir’s picture

  1. +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php
    @@ -1221,6 +1221,11 @@ public function __clone() {
     
    +    // Ensure the original property is actually cloned by overwriting the
    +    // original reference with one pointing to a copy of it.
    +    $original = $this->original;
    +    $this->original = &$original;
    +
    

    the tests failed because you didn't remove this part, this property no longer exists.

  2. +++ b/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php
    @@ -42,6 +42,7 @@ class EntityFormDisplay extends EntityDisplayBase implements EntityFormDisplayIn
        */
       protected $displayContext = 'form';
    +  protected $widgets;
     
    
    +++ b/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php
    @@ -41,6 +41,7 @@ class EntityViewDisplay extends EntityDisplayBase implements EntityViewDisplayIn
        */
       protected $displayContext = 'view';
    +  protected $formatters;
    

    you can remove this as well.

  3. +++ b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php
    @@ -114,6 +114,13 @@ abstract class EntityDisplayBase extends ConfigEntityBase implements EntityDispl
     
    +  /**
    +   * Stores serializable keys which is used in __sleep()/__wakeup().
    +   *
    +   * @var string[]
    +   */
    +  protected $serializedKeys;
    +
       /**
    

    this too. anything that's on entity classes should be safe to drop. You could post it as an interdiff in a new issue, because we want to clean it up at some point, but it doesn't need to be here and now.

  4. +++ b/core/modules/node/tests/src/Unit/NodeOperationAccessTest.php
    @@ -74,7 +74,7 @@ public function testRevisionOperations($operation, array $hasPermissionMap, $ass
         $nid = 333;
         /** @var \Drupal\node\NodeInterface|\PHPUnit\Framework\MockObject\MockObject $node */
    -    $node = $this->createMock(NodeInterface::class);
    +    $node = $this->createMock(Node::class);
         $node->expects($this->any())
    

    do we need an issue for these remaining mock changes?

  5. +++ b/core/modules/user/src/Entity/User.php
    @@ -74,6 +74,8 @@ class User extends ContentEntityBase implements UserInterface {
       protected static $anonymousUser;
    +  // phpcs:disable Drupal.Classes.PropertyDeclaration
    +  public $_skipProtectedUserFieldConstraint;
    

    this can be removed too for now.

  6. +++ b/core/modules/views/src/Views.php
    @@ -308,7 +308,7 @@ public static function getViewsAsOptions($views_only = FALSE, $filter = 'all', $
           case 'enabled':
             $filter = ucfirst($filter);
    -        $views = call_user_func("static::get{$filter}Views");
    +        $views = call_user_func(static::class . "::get{$filter}Views");
             break;
    

    this also needs an issue?

  7. +++ b/core/modules/views_ui/src/ViewUI.php
    @@ -85,6 +85,13 @@ class ViewUI implements ViewEntityInterface {
    +
    +  /**
    +   * Drupal\Tests\views_ui\Functional\FilterUITest::testFiltersUI().
    +   */
    +  public $form_cache;
    

    this needs to be investigated.

  8. +++ b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php
    @@ -168,7 +168,7 @@ public function testGet() {
         $this->assertEquals($this->container, $service->getContainer(), 'Container was injected via setter injection.');
         $this->assertEquals($some_other_parameter, $service->getSomeOtherParameter(), '%some_other_config% was injected via setter injection.');
    -    $this->assertEquals('foo', $service->_someProperty, 'Service has added properties.');
    +    $this->assertEquals('foo', $service->someProperty, 'Service has added properties.');
       }
     
       /**
    @@ -741,7 +741,7 @@ protected function getMockContainerDefinition() {
    
    @@ -741,7 +741,7 @@ protected function getMockContainerDefinition() {
             $this->getServiceCall('other.service'),
             $this->getParameterCall('some_config'),
           ]),
    -      'properties' => $this->getCollection(['_someProperty' => 'foo']),
    +      'properties' => $this->getCollection(['someProperty' => 'foo']),
           'calls' => [
             [
               'setContainer',
    @@ -1103,6 +1103,11 @@ class MockService {
    
    @@ -1103,6 +1103,11 @@ class MockService {
        */
       protected $someOtherParameter;
     
    +  /**
    +   * @var string
    +   */
    +  public $someProperty;
    +
       /**
    

    I'm not sure what's this about, what exactly are we testing here? could we just drop this now that we changed the container serialzation thing?

berdir’s picture

diff --git a/core/lib/Drupal/Core/Url.php b/core/lib/Drupal/Core/Url.php
index c4779cf9a0..894b700f2b 100644
--- a/core/lib/Drupal/Core/Url.php
+++ b/core/lib/Drupal/Core/Url.php
@@ -290,7 +290,14 @@ public static function fromUri($uri, $options = []) {
       $uri_parts['scheme'] = '';
     }
     elseif (empty($uri_parts['scheme'])) {
-      throw new \InvalidArgumentException("The URI '$uri' is invalid. You must use a valid URI scheme.");
+      // Workaround for https://github.com/php/php-src/issues/9545.
+      if (!empty($uri_parts['path']) && str_ends_with($uri_parts['path'], ':')) {
+        $uri_parts['scheme'] = substr($uri_parts['path'], 0, -1);
+        unset($uri_parts['path']);
+      }
+      else {
+        throw new \InvalidArgumentException("The URI '$uri' is invalid. You must use a valid URI scheme.");
+      }
     }
     $uri_parts += ['path' => ''];
     // Discard empty fragment in $options for consistency with parse_url().

Try adding this as a workaround, that fixes Drupal\Tests\Core\UrlTest.

andypost’s picture

StatusFileSize
new38.11 KB

Thank you, fixed #91.1 and gonna file new issues for other points

23 failed

andypost’s picture

StatusFileSize
new39.05 KB

Using #92

andypost’s picture

Re #91 filed 3 issues

2/3/5/7) filed #3309748: Define missing object properties on non-testing classes for PHP 8.2

4) #3309745: Fix dynamic property deprecations and other unit test failures for PHP 8.2

6) #3309750: Fix callable syntax for PHP 8.2 in Views.php

8) we need to define the property to prevent following errors but when I define property with underscore then sniffers does not pass
So I defined property without underscore and changed usage of old one to new

9x: Creation of dynamic property Drupal\Tests\Component\DependencyInjection\MockService::$_someProperty is deprecated
    1x in ContainerTest::testGet from Drupal\Tests\Component\DependencyInjection
    1x in ContainerTest::testGetForSerializedServiceDefinition from Drupal\Tests\Component\DependencyInjection
    1x in ContainerTest::testGetForNonExistentParameterDependency from Drupal\Tests\Component\DependencyInjection
    1x in ContainerTest::testGetForParameterDependencyWithExceptionOnSecondCall from Drupal\Tests\Component\DependencyInjection
    1x in ContainerTest::testGetForNonExistentParameterDependencyWithException from Drupal\Tests\Component\DependencyInjection
andypost’s picture

The remaining 17 failures mostly caused by

Exception: Deprecated function: Creation of dynamic property
Drupal\Core\Config\Entity\ConfigEntityType::$label_callback is deprecated
berdir’s picture

As suggested in slack, try adding #[\AllowDynamicProperties] to \Drupal\Component\Plugin\Definition\PluginDefinition as a workaround, but we should also create a separate issue to unserialize all installed entity types and remove that property from them if they have it, but we can't do that without having that property in place for now.

andypost’s picture

Status: Needs work » Needs review
StatusFileSize
new583 bytes
new28.92 KB

fix unserialize, not clear where $label_callback and others from interdiff are used

re-rolled after #3298731: Using ConstraintViolation::$arrayPropertyPath bugs on PHP 8.2

Status: Needs review » Needs work

The last submitted patch, 98: 3295821-98.patch, failed testing. View results

andypost’s picture

StatusFileSize
new961 bytes
new29.86 KB

Workaround from #92

bbrala’s picture

Issue summary: View changes

Drush cr on is

bbrala’s picture

Issue summary: View changes
andypost’s picture

Issue summary: View changes
StatusFileSize
new432 bytes
new25.59 KB

\Drupal\views\ViewExecutable::$live_preview needs more work, wanna see how many tests will fail

andypost’s picture

StatusFileSize
new407 bytes
new25.76 KB

Attempt to use attribute

berdir’s picture

8) we need to define the property to prevent following errors but when I define property with underscore then sniffers does not pass

I need to double-check because I'm not 100% sure I got it right. My proposal is not to remove the changes that you did, but remove the test entirely. Based on my understanding, this is a left-over of #2531564: Fix leaky and brittle container serialization solution. It's testing that we can set undefined properties. changing it to test setting defined properties is not the same thing, the point is that we no longer need this ability and we should no longer test it.

andypost’s picture

StatusFileSize
new508 bytes
new22.14 KB

let's see if User entity allows extra property

andypost’s picture

Issue summary: View changes
andypost’s picture

StatusFileSize
new1.98 KB
new23.13 KB

So #92.3 is required

Running PHPStan on *all* files.
 ------ --------------------------------------------------------- 
  Line   core/lib/Drupal/Core/Entity/EntityDisplayBase.php        
 ------ --------------------------------------------------------- 
  546    Access to an undefined property                          
         Drupal\Core\Entity\EntityDisplayBase::$_serializedKeys.  
  556    Access to an undefined property                          
         Drupal\Core\Entity\EntityDisplayBase::$_serializedKeys.  
 ------ --------------------------------------------------------- 
andypost’s picture

StatusFileSize
new2.75 KB
andypost’s picture

StatusFileSize
new1.46 KB
new24.65 KB

Other way to fix "sqlQuery"

andypost’s picture

StatusFileSize
new1.87 KB
new26.17 KB

one more mock (and remaining 8 failures are passed with patched PHP for parse_url)

andypost’s picture

andypost’s picture

StatusFileSize
new5.65 KB
new30.66 KB

test for 9.5

2803 failed

andypost’s picture

StatusFileSize
new31.26 KB
new616 bytes

nor clear why 9.5.x is so different

631 failed

berdir’s picture

I think a few things weren't backported. #3274474: Fix 'Access to an undefined property' PHPStan L0 errors was for example, but only a part of it, we're missing a lot of that now.

andypost’s picture

StatusFileSize
new489 bytes
new31.74 KB

one more fix

andypost’s picture

9.5 only 73 failed

andypost’s picture

The most common is
2x: Creation of dynamic property GuzzleHttp\Psr7\MultipartStream::$stream is deprecated

andypost’s picture

StatusFileSize
new565 bytes
new31.73 KB

Fix bit more tests 63 failed

andypost’s picture

StatusFileSize
new578 bytes
new31.91 KB

and backport of one more fix

andypost’s picture

Assigned: andypost » Unassigned
Status: Needs work » Fixed

no longer needed, now there's children under #3275851: [META] Fix PHP 8.2 dynamic property deprecations

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.