Skip to content
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 5.6 compatibility 🐞 #3

Closed
xxsimoxx opened this issue Jan 10, 2023 · 4 comments
Closed

PHP 5.6 compatibility 🐞 #3

xxsimoxx opened this issue Jan 10, 2023 · 4 comments

Comments

@xxsimoxx
Copy link
Member

xxsimoxx commented Jan 10, 2023

Expected behavior

Compatibility with PHP 5.6.
Installation without errors on PHP 5.6.

Current behavior

This is the output of phpcs --standard=PHPCompatibility --runtime-set testVersion 5.6:

FILE: src/wp-includes/PHPMailer/PHPMailer.php
-----------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------
 2776 | ERROR | The function random_bytes() is not present in PHP version 5.6 or earlier
-----------------------------------------------------------------------------------------


FILE: src/wp-includes/SimplePie/Locator.php
--------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------
 88 | ERROR | The built-in interface Throwable is not present in PHP version 5.6 or earlier
--------------------------------------------------------------------------------------------


FILE: src/wp-includes/random_compat/random_bytes_libsodium.php
---------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
---------------------------------------------------------------------------------------------
 48 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
 49 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
 55 | ERROR | The built-in class Error is not present in PHP version 5.6 or earlier
---------------------------------------------------------------------------------------------


FILE: src/wp-includes/random_compat/random_bytes_mcrypt.php
------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
------------------------------------------------------------------------------------------
 47 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
 48 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
 54 | ERROR | The built-in class Error is not present in PHP version 5.6 or earlier
------------------------------------------------------------------------------------------


FILE: src/wp-includes/random_compat/random_bytes_dev_urandom.php
-----------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-----------------------------------------------------------------------------------------------
 111 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
 112 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
 118 | ERROR | The built-in class Error is not present in PHP version 5.6 or earlier
-----------------------------------------------------------------------------------------------


FILE: src/wp-includes/random_compat/byte_safe_strings.php
-----------------------------------------------------------------------------------------
FOUND 8 ERRORS AFFECTING 8 LINES
-----------------------------------------------------------------------------------------
  50 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
  73 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
 106 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
 112 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
 125 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
 164 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
 170 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
 177 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
-----------------------------------------------------------------------------------------


FILE: src/wp-includes/random_compat/random_bytes_libsodium_legacy.php
----------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
----------------------------------------------------------------------------------------------------
 48 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
 49 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
 55 | ERROR | The built-in class Error is not present in PHP version 5.6 or earlier
----------------------------------------------------------------------------------------------------


FILE: src/wp-includes/random_compat/random_bytes_com_dotnet.php
----------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
----------------------------------------------------------------------------------------------
 46 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
 47 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
 53 | ERROR | The built-in class Error is not present in PHP version 5.6 or earlier
 61 | ERROR | The built-in class Error is not present in PHP version 5.6 or earlier
----------------------------------------------------------------------------------------------


FILE: src/wp-includes/random_compat/cast_to_int.php
----------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------
 71 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
----------------------------------------------------------------------------------------


FILE: src/wp-includes/random_compat/random_int.php
-----------------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 6 LINES
-----------------------------------------------------------------------------------------
  56 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
  57 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
  65 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
  66 | ERROR | The built-in class TypeError is not present in PHP version 5.6 or earlier
  77 | ERROR | The built-in class Error is not present in PHP version 5.6 or earlier
 169 | ERROR | The function random_bytes() is not present in PHP version 5.6 or earlier
-----------------------------------------------------------------------------------------


FILE: src/wp-includes/random_compat/error_polyfill.php
-------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------
 39 | ERROR | The built-in class Error is not present in PHP version 5.6 or earlier
-------------------------------------------------------------------------------------


FILE: src/wp-includes/wp-db.php
-------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 48 WARNINGS AFFECTING 24 LINES
-------------------------------------------------------------------------------------
  796 | WARNING | Function mysql_set_charset() is deprecated since PHP 5.5
  796 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
  803 | WARNING | Function mysql_query() is deprecated since PHP 5.5
  803 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
  824 | WARNING | Function mysql_query() is deprecated since PHP 5.5
  824 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
  838 | WARNING | Function mysql_result() is deprecated since PHP 5.5
  838 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
  870 | WARNING | Function mysql_query() is deprecated since PHP 5.5
  870 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
 1073 | WARNING | Function mysql_select_db() is deprecated since PHP 5.5
 1073 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
 1156 | WARNING | Function mysql_real_escape_string() is deprecated since PHP 5.5
 1156 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
 1425 | WARNING | Function mysql_error() is deprecated since PHP 5.5
 1425 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
 1563 | WARNING | Function mysql_free_result() is deprecated since PHP 5.5
 1563 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
 1652 | WARNING | Function mysql_connect() is deprecated since PHP 5.5
 1652 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
 1655 | WARNING | Function mysql_connect() is deprecated since PHP 5.5
 1655 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
 1785 | WARNING | Function mysql_ping() is deprecated since PHP 5.5
 1785 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
 1924 | WARNING | Function mysql_errno() is deprecated since PHP 5.5
 1924 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
 1949 | WARNING | Function mysql_error() is deprecated since PHP 5.5
 1949 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
 1971 | WARNING | Function mysql_affected_rows() is deprecated since PHP 5.5
 1971 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
 1978 | WARNING | Function mysql_insert_id() is deprecated since PHP 5.5
 1978 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
 1991 | WARNING | Function mysql_fetch_object() is deprecated since PHP 5.5
 1991 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
 2023 | WARNING | Function mysql_query() is deprecated since PHP 5.5
 2023 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
 3089 | WARNING | Function mysql_client_encoding() is deprecated since PHP 5.5
 3089 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
 3305 | WARNING | Function mysql_num_fields() is deprecated since PHP 5.5
 3305 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
 3307 | WARNING | Function mysql_fetch_field() is deprecated since PHP 5.5
 3307 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
 3402 | WARNING | Function mysql_close() is deprecated since PHP 5.5
 3402 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
 3501 | WARNING | Function mysql_get_client_info() is deprecated since PHP 5.5
 3501 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
 3557 | WARNING | Function mysql_get_server_info() is deprecated since PHP 5.5
 3557 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
-------------------------------------------------------------------------------------


FILE: src/wp-includes/pluggable.php
---------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
---------------------------------------------------------------------------------------
 2447 | ERROR | The function random_int() is not present in PHP version 5.6 or earlier
 2453 | ERROR | The built-in class Error is not present in PHP version 5.6 or earlier
---------------------------------------------------------------------------------------


FILE: src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
----------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------------
 962 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
 971 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
----------------------------------------------------------------------------------------------------------


FILE: src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php
--------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------------------------------------
 452 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
 455 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
--------------------------------------------------------------------------------------------------------------


FILE: src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
-------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------------
 910 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
 914 | WARNING | Extension 'mysql_' is deprecated since PHP 5.5; Use mysqli instead
-------------------------------------------------------------------------------------------------------------


FILE: src/wp-includes/rest-api/class-wp-rest-server.php
-------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
-------------------------------------------------------------------------------------------------------------
 1298 | WARNING | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6; Use php://input instead
 1301 | WARNING | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6; Use php://input instead
 1302 | WARNING | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6; Use php://input instead
 1305 | WARNING | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6; Use php://input instead
-------------------------------------------------------------------------------------------------------------

FILE: src/wp-admin/includes/upgrade.php
-----------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------
 2773 | ERROR | The function str_contains() is not present in PHP version 7.4 or earlier
-----------------------------------------------------------------------------------------


FILE: src/wp-admin/setup-config.php
--------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------
 303 | ERROR | The function random_int() is not present in PHP version 5.6 or earlier
--------------------------------------------------------------------------------------

FILE: src/xmlrpc.php
-----------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 4 LINES
-----------------------------------------------------------------------------------------------------------
 20 | WARNING | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6; Use php://input instead
 21 | WARNING | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6; Use php://input instead
 25 | WARNING | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6; Use php://input instead
 26 | WARNING | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6; Use php://input instead
 26 | WARNING | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6; Use php://input instead
-----------------------------------------------------------------------------------------------------------

ClassicPress version

1.5.0 and prior

PHP version

5.6

@ClassyBot
Copy link
Collaborator

This issue has been mentioned on ClassicPress Forums. There might be relevant details there:

https://forums.classicpress.net/t/unable-to-install-classicpress-1-5-0/4494/5

@xxsimoxx
Copy link
Member Author

Giving a quick look around there are polyfills, so maybe the list can be cut down to this:

FILE: src/wp-includes/SimplePie/Locator.php
--------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------
 88 | ERROR | The built-in interface Throwable is not present in PHP version 5.6 or earlier
--------------------------------------------------------------------------------------------

FILE: src/wp-admin/includes/upgrade.php
-----------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------
 2773 | ERROR | The function str_contains() is not present in PHP version 7.4 or earlier
-----------------------------------------------------------------------------------------

@mattyrob
Copy link
Contributor

Looking at the 2 issues in the follow up comment:

The Throwable interface, it seems it cannot be polyfilled and it seems it would silently fail on PHP 5.6 as the code stands according to this:
https://www.php.net/manual/en/class.throwable.php
Silent failure isn’t ideal but it’s better than throwing loads of errors.

The second issue should be satisfactorily addressed in ClassicPress/ClassicPress#1212

@xxsimoxx
Copy link
Member Author

Closed by ClassicPress/ClassicPress#1212.

@viktorix viktorix transferred this issue from ClassicPress/ClassicPress Nov 20, 2023
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

No branches or pull requests

3 participants