Automattic/sensei

Sensei version 4.24.1 incompatibility with WordPress 6.6

Closed this issue · 5 comments

Hello! We have a website that is currently in development (we're launching this week). While we were doing QA, we came across a Fatal error when trying to click into the lessons of the course. We have rolled back WordPress to 6.5 which has solved our issue, but if we update to 6.6 which would be our preferred version, we're getting errors with Sensei.

Here's the quote from the engineer on the project:

the fatal error is due to the WordPress version 6.6, it is giving an error with the REST API.
If the WordPress version is downgraded from 6.6 to 6.5 for example, it works properly.

It is worth to report the bug to Sensei LMS plugin version 4.24.1 incompatibility with WordPress 6.6 version. I tested and debugged it on my local env.

What I Expected

The lesson page to display.

What Happened Instead

The lesson link loads a critical error.

Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /Users/filipa/localwp/jeff-gothelf-2024/app/public/wp-includes/rest-api.php:2156 Stack trace: #0 /Users/filipa/localwp/jeff-gothelf-2024/app/public/wp-includes/class-wp-block-type.php(517): rest_validate_value_from_schema('wp-elements-da4...', 'some-className', 'className') https://github.com/a8cteam51/jeff-gothelf-2024/pull/1 /Users/filipa/localwp/jeff-gothelf-2024/app/public/wp-includes/class-wp-block.php(194): WP_Block_Type->prepare_attributes_for_render(Array) https://github.com/a8cteam51/jeff-gothelf-2024/pull/2 /Users/filipa/localwp/jeff-gothelf-2024/app/public/wp-includes/class-wp-block.php(519): WP_Block->__get('attributes') https://github.com/a8cteam51/jeff-gothelf-2024/pull/3 /Users/filipa/localwp/jeff-gothelf-2024/app/public/wp-includes/class-wp-block.php(499): WP_Block->render() https://github.com/a8cteam51/jeff-gothelf-2024/issues/4 /Users/filipa/localwp/jeff-gothelf-2024/app/public/wp-includes/class-wp-block.php(499): WP_Block->render() https://github.com/a8cteam51/jeff-gothelf-2024/pull/5 /Users/filipa/localwp/jeff-gothelf-2024/app/public/wp-includes/blocks.php(2061): WP_Block->render() https://github.com/a8cteam51/jeff-gothelf-2024/pull/6 /Users/filipa/localwp/jeff-gothelf-2024/app/public/wp-includes/blocks.php(2113): render_block(Array) https://github.com/a8cteam51/jeff-gothelf-2024/pull/7 /Users/filipa/localwp/jeff-gothelf-2024/app/public/wp-includes/block-template.php(263): do_blocks('<!-- wp:sensei-...') https://github.com/a8cteam51/jeff-gothelf-2024/issues/8 /Users/filipa/localwp/jeff-gothelf-2024/app/public/wp-includes/template-canvas.php(12): get_the_block_template_html() https://github.com/a8cteam51/jeff-gothelf-2024/pull/9 /Users/filipa/localwp/jeff-gothelf-2024/app/public/wp-includes/template-loader.php(106): include('/Users/filipa/l...') https://github.com/a8cteam51/jeff-gothelf-2024/issues/10 /Users/filipa/localwp/jeff-gothelf-2024/app/public/wp-blog-header.php(19): require_once('/Users/filipa/l...') https://github.com/a8cteam51/jeff-gothelf-2024/issues/11 /Users/filipa/localwp/jeff-gothelf-2024/app/public/index.php(17): require('/Users/filipa/l...') https://github.com/a8cteam51/jeff-gothelf-2024/issues/12 {main} thrown in /Users/filipa/localwp/jeff-gothelf-2024/app/public/wp-includes/rest-api.php on line 2156

PHP / WordPress / Sensei LMS version

PHP 8.3
WordPress 6.6
Sesnei LMS: 4.24.1

Browser / OS version

Google Chrome Version 126.0.6478.127 (Official Build) (arm64)

Screenshot / Video

349465889-6505fa5e-82ab-4d1e-b877-a062ca8e7ebe

Context / Source

As a word around we have downgraded WordPress to 6.5.

Hi @kimclowa8c!

Thank you for opening this issue!

I tried to reproduce it by following these steps:

  • Create a new site.
  • Create a course with a lesson.
  • Create a student user.
  • Navigate to the course as the student.
  • Take the course.
  • Complete and navigate through the lessons.

But I didn't see the error. Am I missing a step to be able to reproduce it? Are you able to reproduce the same issue on a fresh site?

This issue seems to be affecting multiple sites. 8502623-zen reported it as well.

Support References

This comment is automatically generated. Please do not edit it.

  • 8502623-zen

@kimclowa8c and @dericleeyy, I tried many tests with many variations (with/without Sensei Pro, with/without WooCommerce, paid/free course, upgrading WP version, upgrading PHP version). One thing I noticed, after upgrading to PHP 8.2, is that the permalinks stopped working.

So I needed to go to /wp-admin/options-permalink.php (WP Admin > Settings > Permalinks) and click on "Save Changes" to flush it, so it worked again.

Is it something that fixes it in the broken sites?

We could test @kimclowa8c's site and it was an issue with customizations in the Learning Mode template. After resetting the changes, it worked again.

I tried to reproduce it creating a site with WP 6.5, changing the templates with any change, upgrading to WP 6.6, and it worked properly, so it's related to a specific change from that site.

@dericleeyy, so it doesn't seem to be related to the issue of this other site. A good try would be deactivating other plugins and switching the theme.

They could also try resetting the changes in the Learning Mode template to check if it fixes the issue. If it's the same issue, we probably need to investigate deeper if there's something with a specific Sensei block.

So for now, I'm closing this issue.