Skip to content

Declare modx property on modPackageBuilder for PHP 8.2 compatibility - #16989

Open
Ibochkarev wants to merge 1 commit into
modxcms:3.xfrom
Ibochkarev:fix/modPackageBuilder-dynamic-modx
Open

Declare modx property on modPackageBuilder for PHP 8.2 compatibility#16989
Ibochkarev wants to merge 1 commit into
modxcms:3.xfrom
Ibochkarev:fix/modPackageBuilder-dynamic-modx

Conversation

@Ibochkarev

@Ibochkarev Ibochkarev commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

What changed and why

modPackageBuilder sets $this->modx in the constructor but never declared the property. PHP 8.2+ emits:

PHP deprecated: Creation of dynamic property MODX\Revolution\Transport\modPackageBuilder::$modx is deprecated

This PR adds public $modx = null, same as modTransportManager.

How to test

php -l core/src/Revolution/Transport/modPackageBuilder.php
core/vendor/bin/phpunit -c ./_build/test/phpunit.xml Tests/Model/Transport/modPackageBuilderTest.php

Exit 0 on PHP 8.4 locally.

To see the original warning: create a modPackageBuilder during a package build (manager or _build). PHP 8.2+ logged the deprecation at line 70 before this change.

Related issue(s)/PR(s)

Found in the manager error log.

Compatibility notes

PHP 8.2+ only. No runtime behavior change.

Breaking change assessment

No API changes. Safe for patch releases.

Test coverage

Replaced the placeholder testExample with testConstructorDoesNotCreateDynamicModxProperty. It checks for no dynamic-property deprecation on construction and confirms the $modx reference is set.

Contributors

N/A

AI tool use

Cursor agent wrote the patch and test.

Prevents "Creation of dynamic property ...::$modx is deprecated" when
instantiating the package builder. Matches modTransportManager convention.
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.

2 participants