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 8 compatibility #1914

Open
benlk opened this issue Jan 30, 2023 · 2 comments
Open

PHP 8 compatibility #1914

benlk opened this issue Jan 30, 2023 · 2 comments
Labels
category: clean up unused code/clean up items Estimate: < 10 Hours/Unknown good for beginners help wanted priority: high Either blocks work on a priority-normal task or a solution here informs other work. type: bug type: tech debt For necessary updates because code is old

Comments

@benlk
Copy link
Collaborator

benlk commented Jan 30, 2023

Expected Behavior

Largo should work under PHP 8

Actual Behavior

The grapevine tells me that INN members report that Largo is experiencing problems on PHP 8.

INN/Largo-Sample-Child-Theme#20

Steps to Reproduce the Problem

Upgrade a PHP 7.4 site to PHP 8

@benlk benlk added type: bug priority: high Either blocks work on a priority-normal task or a solution here informs other work. help wanted good for beginners type: tech debt For necessary updates because code is old Estimate: < 10 Hours/Unknown category: clean up unused code/clean up items labels Jan 30, 2023
@benlk
Copy link
Collaborator Author

benlk commented Jan 30, 2023

Fix process:

  • .nvmrc; build
  • run PHP tests on php 7.4
  • populate local site with test content
  • switch to php 8.0
  • remedy errors
  • run tests

@benlk
Copy link
Collaborator Author

benlk commented Jan 31, 2023

Bugs noted under PHP 7.4:

  • banner image uploads don't work at Appearance > Theme Options > Theme Images

Many tests fail under PHP 8 and 7.4:

There was 1 warning:

1) PostTagsTestFunctions::test_largo_post_social_links
assertRegExp() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertMatchesRegularExpression() instead.

--

There were 13 failures:

1) AjaxFunctionsTestFunctions::test_largo_load_more_posts_choose_partial
empty query vars did not result in a determination that the partial type is home
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'home'
+'archive'

/var/www/html/wp-content/themes/largo/tests/inc/test-ajax-functions.php:67

2) PostTemplatesTestFunctions::test_largo_remove_hero_C1
C1
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'<h2>Headings</h2>\n
+'<p><img src="http://example.org/wp-content/uploads/2023/01/cat-1-771x510.jpg" alt="1559758083_cef4ef63d2_o" width="771" height="475" class="alignnone size-large wp-image-244" /></p>\n
+<h2>Headings</h2>\n
 <p>Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Sed posuere consectetur est at lobortis. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Donec sed odio dui.</p>'

/var/www/html/wp-content/themes/largo/tests/inc/test-post-templates.php:92

3) PostTemplatesTestFunctions::test_largo_remove_hero_C2
C2
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'<h2>Headings</h2>\n
+'<p><img src="http://example.org/wp-content/uploads/2023/01/cat-2-771x510.jpg" alt="1559758083_cef4ef63d2_o" width="771" height="475" class="alignnone size-medium wp-image-246" /></p>\n
+<h2>Headings</h2>\n
 <p>Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Sed posuere consectetur est at lobortis. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Donec sed odio dui.</p>'

/var/www/html/wp-content/themes/largo/tests/inc/test-post-templates.php:133

4) PostTemplatesTestFunctions::test_largo_remove_hero_C3
C3
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'<p>foo</p>\n
+'<p><img src="http://example.org/wp-content/uploads/2023/01/cat-3-771x510.jpg" alt="1559758083_cef4ef63d2_o" width="771" height="475" class="alignnone size-large wp-image-248" />foo</p>\n
 <h2>Headings</h2>\n
 <p>Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Sed posuere consectetur est at lobortis. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Donec sed odio dui.</p>'

/var/www/html/wp-content/themes/largo/tests/inc/test-post-templates.php:173

5) LargoRelatedTestFunctions::test_popularity_sort
Comparing a term with 3 posts to a term with 4 posts did not return -1, which would indicate that 3 had fewer posts than 4 did. If the difference were greater than 1 post, -1 would still be returned.
Failed asserting that 1 matches expected -1.

/var/www/html/wp-content/themes/largo/tests/inc/test-related-content.php:123

6) LargoRelatedTestFunctions::test_unorganized_series_before
Largo_Related did not return the post it was expected to 
Failed asserting that 257 matches expected 258.

/var/www/html/wp-content/themes/largo/tests/inc/test-related-content.php:171

7) LargoRelatedTestFunctions::test_series_asc
The second post should be higher in post ID than the first
Failed asserting that 265 is greater than 266.

/var/www/html/wp-content/themes/largo/tests/inc/test-related-content.php:238

8) LargoRelatedTestFunctions::test_series_desc
The first post should be the younger post
Failed asserting that 271 matches expected 272.

/var/www/html/wp-content/themes/largo/tests/inc/test-related-content.php:278

9) LargoRelatedTestFunctions::test_series_series_custom
The posts were not returned in the custom order.
Failed asserting that false is true.

/var/www/html/wp-content/themes/largo/tests/inc/test-related-content.php:339

10) LargoUpdateTestAjaxFunctions::test_largo_ajax_update_database_true
Failed asserting that false is true.

/var/www/html/wp-content/themes/largo/tests/inc/test-update.php:525

11) UsersTestFunctions::test_largo_render_user_list
Failed asserting that '<div class="user-list"><div class="author-box row-fluid"><h3 class="widgettitle">About <span class="fn n"><a class="url" href="http://example.org/?author=543" rel="author" title="See all posts by User 0001079">User 0001079</a></span></h3><div class="photo"></div><p>foobar</p></div></div>' matches PCRE pattern "/src/".

/var/www/html/wp-content/themes/largo/tests/inc/test-users.php:136

12) UsersTestFunctions::test_more_profile_info
Not all inputs that should have been checked were.
Failed asserting that 1 matches expected 2.

/var/www/html/wp-content/themes/largo/tests/inc/test-users.php:190

13) UsersTestFunctions::test_save_more_profile_info
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'on'
+''

/var/www/html/wp-content/themes/largo/tests/inc/test-users.php:204

However, the frontend continues to display without error.

@benlk benlk mentioned this issue Jan 31, 2023
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: clean up unused code/clean up items Estimate: < 10 Hours/Unknown good for beginners help wanted priority: high Either blocks work on a priority-normal task or a solution here informs other work. type: bug type: tech debt For necessary updates because code is old
Projects
None yet
Development

No branches or pull requests

1 participant