-
Notifications
You must be signed in to change notification settings - Fork 0
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
3.4.x php8 #1
Open
Bellardia
wants to merge
22
commits into
3.4.x
Choose a base branch
from
3.4.x_php8
base: 3.4.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
3.4.x php8 #1
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a full port of Phalcon 3.4.x to PHP 8.
To get here required modernizing the kernel libraries (
ext/kernel/
) to be PHP 8 compatible. I'll skip the sausage making for how that works since it requires extensive knowledge of PHP internals. With a PHP 8 capable kernel and updated build configurations, we can then begin to compile Phalcon (ext/phalcon/
).There are several major depreciations in PHP 8 that are frequently used in Phalcon 3.4.x, most commonly the
Creation of dynamic property
,\Serializable
interfaces andrequired parameters after optional parameters
.Creation of dynamic property
occurs when a variable is assigned to a class without it being included in the class definition:This is unfortunately is a very common mechanism within Phalcon (especially for
Config
,Di
andModel
) . To get around this, I backported changes from Phalcon 5, including a full overhaul ofConfig
.Config has been redesigned to not assign directly to it's own instance, which allowed for handy features like
(array) $di->credentials
to transparently convert the underlyingstdClass
to anarray
. Without dynamic properties, these values need to be housed somewhere other than the class instance itself, ie.this->data[property] = "value"
This is not fully backwards compatible, but it was possible to rewrite our usage of
Config
in JBX in a way that's compatible with both versions ofConfig
(original and rewrite) which was a bit easier then building a newConfig
system that works identically across versions.Fixing
\Serializable
and other bugs were generally more straightforward, just modifying the Phalcon source as necessary.required parameters after optional parameters
is also not possible to make fully backwards compatible. This is addressed in the JBX source in necessary locations with PHP version guards which decide which ordering to use. Luckily, our use of ABIs with this issue was minimal.I have WIP changes that modernizes the Tests (
tests/
) and gets them working again, but unfortunately some dependencies only support PHP 7.4, so it brings us to a weird place where we can only test the PHP 8 build on PHP 7.4, which doesn't guarantee that it works. Since this was another pretty involved undertaking I abandoned the effort and am relying on our JBX tests instead to verify compatibility.