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 Warning on courses (membership) archive when no course (membership) catalog set #2496

Closed
2 of 4 tasks
eri-trabiccolo opened this issue Jul 31, 2023 · 0 comments · Fixed by #2471
Closed
2 of 4 tasks
Assignees
Labels
Severity: Normal Status: Has PR This issue has an open pull request Type: Enhancement Improvements existing features or code

Comments

@eri-trabiccolo
Copy link
Collaborator

eri-trabiccolo commented Jul 31, 2023

Reproduction Steps

  • Unset, if ever set, the course catalog page under LifterLMS -> Settings -> Courses -> Course Catalog
  • Visit your example.com/courses/ page
  • (make sure you either display warnings or log them)

Expected Behavior

  • I'd expect to see the catalog with no warnings

Actual Behavior

  • PHP warnings logged

Solution suggested by @kimcoleman

this is the line: https://github.com/gocodebox/lifterlms/blob/trunk/includes/functions/llms.functions.templates.loop.php#L62
Should we consider check if $page_id is > 0 OR $page isn’t empty before we set $content = $page->post_content;?

Error Messages / Logs

  • Include any relevant error messages or log files
[31-Jul-2023 07:11:46 UTC] PHP Warning:  Attempt to read property "post_content" on null in /home/rock/Dev/code/lifterlms/includes/functions/llms.functions.templates.loop.php on line 61
[31-Jul-2023 07:11:46 UTC] PHP Deprecated:  str_contains(): Passing null to parameter #1 ($haystack) of type string is deprecated in /shared/httpd/mywp/wordpress.git/wp-includes/formatting.php on line 2484
[31-Jul-2023 07:11:46 UTC] PHP Deprecated:  trim(): Passing null to parameter #1 ($string) of type string is deprecated in /shared/httpd/mywp/wordpress.git/wp-includes/formatting.php on line 449

System and Environment Information

LifterLMS 7.2.1
PHP 8.1

This issue has been recreated:

  • Locally
  • On a staging site
  • On a production website
  • With only LifterLMS and a default theme

Browser, Device, and Operating System Information

n/a

@eri-trabiccolo eri-trabiccolo added Type: Enhancement Improvements existing features or code Severity: Normal labels Jul 31, 2023
@eri-trabiccolo eri-trabiccolo self-assigned this Jul 31, 2023
@eri-trabiccolo eri-trabiccolo added the Status: Has PR This issue has an open pull request label Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Severity: Normal Status: Has PR This issue has an open pull request Type: Enhancement Improvements existing features or code
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant