-
Notifications
You must be signed in to change notification settings - Fork 22
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
php 8.1 compatibility fixes #149
Merged
Merged
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
falkenhawk
force-pushed
the
php81-compat
branch
from
November 28, 2022 16:57
361000b
to
6224834
Compare
falkenhawk
changed the base branch from
php81-compat-returntypewillchange
to
master
November 28, 2022 17:23
falkenhawk
force-pushed
the
php81-compat
branch
from
December 2, 2022 17:05
6ce54ba
to
e28cdc4
Compare
236 errors, 9 failures to go... 😵💫 |
falkenhawk
force-pushed
the
php81-compat
branch
4 times, most recently
from
December 4, 2022 09:30
879582e
to
403e4b2
Compare
falkenhawk
force-pushed
the
php81-compat
branch
from
December 4, 2022 10:52
403e4b2
to
4f08129
Compare
only 6 errors left. all in |
Deprecated: Test implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) https://php.watch/versions/8.1/serializable-deprecated
when they are being serialized same as PHP <8.1 In PHP 8.1, the order of properties is the same as in the class definition, but properties from parent class always go after properties from the current class. From PHP upgrade notes: https://github.com/php/php-src/blob/578b67da49af51b2f796a48782e51ceb62860943/UPGRADING#L334-L341 Copied the `correlationId` property definition from `Zend_Amf_Value_Messaging_AsyncMessage` to parent `Zend_Amf_Value_Messaging_AbstractMessage`. `correlationId` prop is expected to be at the beginning of serialized messages, otherwise it breaks Zend_Amf_ResponseTest cases for php 8.1+.
Method name was not set in constructor, but it was being read in tests (there is no property defined for it, but `__set` magic method is defined in the base class) resulting in `substr(): Passing null to parameter #1 ($string) of type string is deprecated` and similar errors in various places
where null is not valid, string is expected
- substr(): Passing null to parameter #1 ($string) of type string is deprecated - strtolower(): Passing null to parameter #1 ($string) of type string is deprecated - strlen(): Passing null to parameter #1 ($string) of type string is deprecated - trim(): Passing null to parameter #1 ($string) of type string is deprecated - str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated - strstr(): Passing null to parameter #1 ($haystack) of type string is deprecated - http_build_query(): Passing null to parameter #2 ($numeric_prefix) of type string is deprecated - current(): Calling current() on an object is deprecated - preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated - preg_match(): Passing null to parameter #4 ($flags) of type int is deprecated - always construct Zend_Exception with string message, avoid null - Implicit conversion from float-string "x.xyz" to int loses precision - PDOStatement::fetch(): Passing null to parameter #2 ($cursorOrientation) of type int is deprecated - ctype_space(): Argument of type null will be interpreted as string in the future - file_get_contents(): Passing null to parameter #2 ($use_include_path) of type bool is deprecated - imagefilledpolygon(): Using the $num_points parameter is deprecated - Implicit conversion from float to int loses precision - PDOStatement::bindParam(): Passing null to parameter #4 ($maxLength) of type int is deprecated - preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated - ctype_print(): Argument of type int will be interpreted as string in the future - trim(): Passing null to parameter #1 ($string) of type string is deprecated etc.
* [zend-date] fix calculating sunrise, sunset and twilight times When php 8.1.0 deprecated date_sunset() and date_sunrise() functions, switched to recommended date_sun_info() function is used instead (which is available in php since v5.1) but that function yields slightly different results since zenith angles are internally fixed and they are different to what zf used before. (see $horizonDeclination in Zend_Date::calcSun() - moved from Zend_Date::_checkLocation()) Yet ONLY NOW they are accurate! (calculations for civil / nautical / astronomical twilight were totally wrong before) Still values returned by date_sun_info() are slightly different in php 8.0+, (but only for sunrise/sunset, not for twilight) so yet another set of conditions have to be added to test suites.
for zf components. They are not needed since composer autoloader takes care of that. And they were breaking individual test runs e.g. `./vendor/bin/phpunit tests/Zend/Db/Adapter/MysqliTest.php`
falkenhawk
force-pushed
the
php81-compat
branch
from
December 6, 2022 09:54
9bf004f
to
a435205
Compare
[zend-db] fix MySQLi adapter - add missing typing
@glensc would you like to review this PR? |
partikus
requested changes
Dec 8, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@falkenhawk looks really good, few minor CRs added
packages/zend-file-transfer/library/Zend/File/Transfer/Adapter/Abstract.php
Outdated
Show resolved
Hide resolved
packages/zend-file-transfer/library/Zend/File/Transfer/Adapter/Abstract.php
Outdated
Show resolved
Hide resolved
packages/zend-file-transfer/library/Zend/File/Transfer/Adapter/Abstract.php
Show resolved
Hide resolved
replace conditionals with type-casting where they are not needed
partikus
approved these changes
Dec 9, 2022
marcing
approved these changes
Dec 12, 2022
Merged
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.
fix deprecation notices for
Serializable
interfaceDeprecated: Test implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary)
https://php.watch/versions/8.1/serializable-deprecated
[zend-amf] fix for php 8.1+ keep the order of properties when they are being serialized same as PHP <8.1
In PHP 8.1, the order of properties is the same as in the class definition, but properties from parent class always go after properties from the current class.
From PHP upgrade notes: https://github.com/php/php-src/blob/578b67da49af51b2f796a48782e51ceb62860943/UPGRADING#L334-L341
Copied the
correlationId
property definition fromZend_Amf_Value_Messaging_AsyncMessage
to parentZend_Amf_Value_Messaging_AbstractMessage
.correlationId
prop is expected to be at the beginning of serialized messages, otherwise it breaks Zend_Amf_ResponseTest cases for php 8.1+.This was causing 14 failures in
Zend_Amf
test suite due to serialized binary data was different than expected, due to changed order of properties of serialized objects.[zend-server] fix issue with
Zend_Server_Reflection_Method
Method name was not set in constructor, but it was being read in tests (there is no property defined for it, but
__set
magic method is defined in the base class)resulting in
substr(): Passing null to parameter https://github.com/zf1s/zf1/pull/1 ($string) of type string is deprecated
and similar errors in various placesfixing errors and warnings for php 8.1
includes [zend-date] properly calculate sunrise, sunset and twilight times #151 and [zend-db] fix MySQLi adapter after changing default reporting mode by PHP 8.1 #156