-
-
Notifications
You must be signed in to change notification settings - Fork 359
fix PHP 8.5 deprecation warnings #138
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
base: master
Are you sure you want to change the base?
Conversation
RuntimeException: Non-canonical cast (double) is deprecated, use the (float) cast instead on line 7281 in file /path/to/econea/nusoap/src/nusoap.php RuntimeException: Non-canonical cast (boolean) is deprecated, use the (bool) cast instead on line 7287 in file /path/to/econea/nusoap/src/nusoap.php RuntimeException: Function xml_parser_free() is deprecated since 8.5, as it has no effect since PHP 8.0 on line 6916 in file /path/to/econea/nusoap/src/nusoap.php
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.
Pull Request Overview
This PR addresses PHP 8.0 compatibility issues and updates type casting to use modern PHP syntax. The changes focus on conditionally calling xml_parser_free() only for PHP versions below 8.0, and updating deprecated type cast syntax.
Key Changes:
- Conditionally calls
xml_parser_free()for PHP versions < 8.0 to avoid deprecation warnings - Updates type casts from
(double)to(float)and(boolean)to(bool)to align with modern PHP standards
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| xml_parser_free($this->parser); | ||
| (PHP_VERSION_ID < 80000) && xml_parser_free($this->parser); |
Copilot
AI
Nov 8, 2025
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.
The use of short-circuit evaluation with && for conditionally calling xml_parser_free() is unconventional and potentially confusing. This pattern uses the logical AND operator for side effects rather than its intended purpose of boolean evaluation.
Consider using a more explicit conditional approach:
if (PHP_VERSION_ID < 80000) {
xml_parser_free($this->parser);
}This is clearer about intent and follows standard PHP coding practices.
| (PHP_VERSION_ID < 80000) && xml_parser_free($this->parser); | |
| if (PHP_VERSION_ID < 80000) { | |
| xml_parser_free($this->parser); | |
| } |
| $this->debug("XML payload:\n" . $wsdl_string); | ||
| $this->setError($errstr); | ||
| xml_parser_free($this->parser); | ||
| (PHP_VERSION_ID < 80000) && xml_parser_free($this->parser); |
Copilot
AI
Nov 8, 2025
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.
The use of short-circuit evaluation with && for conditionally calling xml_parser_free() is unconventional and potentially confusing. This pattern uses the logical AND operator for side effects rather than its intended purpose of boolean evaluation.
Consider using a more explicit conditional approach:
if (PHP_VERSION_ID < 80000) {
xml_parser_free($this->parser);
}This is clearer about intent and follows standard PHP coding practices.
| } | ||
| // free the parser | ||
| xml_parser_free($this->parser); | ||
| (PHP_VERSION_ID < 80000) && xml_parser_free($this->parser); |
Copilot
AI
Nov 8, 2025
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.
The use of short-circuit evaluation with && for conditionally calling xml_parser_free() is unconventional and potentially confusing. This pattern uses the logical AND operator for side effects rather than its intended purpose of boolean evaluation.
Consider using a more explicit conditional approach:
if (PHP_VERSION_ID < 80000) {
xml_parser_free($this->parser);
}This is clearer about intent and follows standard PHP coding practices.
| } | ||
| } | ||
| xml_parser_free($this->parser); | ||
| (PHP_VERSION_ID < 80000) && xml_parser_free($this->parser); |
Copilot
AI
Nov 8, 2025
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.
The use of short-circuit evaluation with && for conditionally calling xml_parser_free() is unconventional and potentially confusing. This pattern uses the logical AND operator for side effects rather than its intended purpose of boolean evaluation.
Consider using a more explicit conditional approach:
if (PHP_VERSION_ID < 80000) {
xml_parser_free($this->parser);
}This is clearer about intent and follows standard PHP coding practices.
| (PHP_VERSION_ID < 80000) && xml_parser_free($this->parser); | |
| if (PHP_VERSION_ID < 80000) { | |
| xml_parser_free($this->parser); | |
| } |
|
To complete that PR, there's one more warning : the function socket_set_timeout is an alias of stream_set_timeout. The alias is deprecated in php 8.5. |
RuntimeException: Non-canonical cast (double) is deprecated, use the (float) cast instead on line 7281 in file /path/to/econea/nusoap/src/nusoap.php
RuntimeException: Non-canonical cast (boolean) is deprecated, use the (bool) cast instead on line 7287 in file /path/to/econea/nusoap/src/nusoap.php
RuntimeException: Function xml_parser_free() is deprecated since 8.5, as it has no effect since PHP 8.0 on line 6916 in file /path/to/econea/nusoap/src/nusoap.php