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

Fix lesson loading error issue in learning mode for themes that are using referenced styles #7658

Merged
merged 6 commits into from
Aug 7, 2024

Conversation

Imran92
Copy link
Contributor

@Imran92 Imran92 commented Aug 6, 2024

Resolves #7659

8551277-zd-a8c

Proposed Changes

  • In theme.json version 3, it's possible to use a reference of a color from another json file instead of explicitly using the name of hexcode of a color. We can use a object with a ref property now. But this function here can only extract the style from a string property, not from a reference object.

So to prevent the error, we've added a check to attempt extracting style only when the value is a string. For proper extraction we've created an issue here #7660 .

Testing Instructions

  1. Make sure you are on PHP 8.1 or above
  2. Create a course with lessons
  3. Ensure learning mode is enabled for that course
  4. Download and enable the theme https://wordpress.com/theme/assembler
  5. Access the lesson as a student
  6. It should render without any issue
  7. Now try to do the same from trunk
  8. It should throw an error

Pre-Merge Checklist

  • PR title and description contain sufficient detail and accurately describe the changes
  • Acceptance criteria is met
  • Decisions are publicly documented
  • Adheres to coding standards (PHP, JavaScript, CSS, HTML)
  • All strings are translatable (without concatenation, handles plurals)
  • Follows our naming conventions (P6rkRX-4oA-p2)
  • Hooks (p6rkRX-1uS-p2) and functions are documented
  • New UIs are responsive and use a mobile-first approach
  • New UIs match the designs
  • Different user privileges (admin, teacher, subscriber) are tested as appropriate
  • Legacy courses (course without blocks) are tested
  • Code is tested on the minimum supported PHP and WordPress versions
  • User interface changes have been tested on the latest versions of Chrome, Firefox and Safari
  • "Needs Documentation" label is added if this change requires updates to documentation
  • Known issues are created as new GitHub issues

@Imran92 Imran92 requested a review from a team August 6, 2024 10:43
@Imran92 Imran92 self-assigned this Aug 6, 2024
@Imran92 Imran92 added this to the 4.24.2 milestone Aug 6, 2024
Copy link

github-actions bot commented Aug 6, 2024

Test the previous changes of this PR with WordPress Playground.

@Imran92 Imran92 closed this Aug 6, 2024
@Imran92 Imran92 reopened this Aug 6, 2024
Copy link

github-actions bot commented Aug 6, 2024

Test the previous changes of this PR with WordPress Playground.

Copy link

github-actions bot commented Aug 6, 2024

Test the previous changes of this PR with WordPress Playground.

@Imran92 Imran92 marked this pull request as ready for review August 6, 2024 19:40
@Imran92 Imran92 changed the title Add check that $value is a string before passing to strncmp Fix lesson loading error issue in learning mode for themes that are using referenced styles Aug 6, 2024
Copy link

github-actions bot commented Aug 6, 2024

Test the previous changes of this PR with WordPress Playground.

Copy link

github-actions bot commented Aug 6, 2024

Test the previous changes of this PR with WordPress Playground.

Copy link
Member

@merkushin merkushin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @Imran92!

I reproduced the issue on trunk first, then confirmed the issue is fixed in this PR.

@Imran92
Copy link
Contributor Author

Imran92 commented Aug 7, 2024

Two more incidents of this issue have been reported here #7659.

@Imran92 Imran92 merged commit 15275e8 into trunk Aug 7, 2024
23 checks passed
@Imran92 Imran92 deleted the fix/passing-array-to-strncmp branch August 7, 2024 08:28
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

Successfully merging this pull request may close these issues.

Sensei Learning Mode not working in Assembler Theme
2 participants