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

Catalog widget warnings #34

Open
wants to merge 2 commits into
base: v2.x
Choose a base branch
from

Conversation

kimhornung
Copy link

When using the Scorm Cloud Catalog Widget with WP_DEBUG enabled, warnings will appear in the debug.log file.
This happens because some functions in the ScormCloudPlugin class are not marked static.
Also, a warning about wpdb->prepare being used incorrectly appears.

Steps to reproduce

  1. Add the following lines to wp-config.php to enable WP debug
define('WP_DEBUG', true);
define('WP_DEBUG_DISPLAY', false);
define('WP_DEBUG_LOG', true);
  1. Add the "Scorm Cloud Catalog Widget" to a sidebar or footer area

  2. Open the website

Result:
The following warnings appears in the log file:

[09-Nov-2022 08:48:11 UTC] PHP Deprecated:  Non-static method ScormCloudPlugin::loadAllCourses() should not be called statically in <webroot>/scormcloud/ui/scormcloudcatalogwidget.php on line 53
[09-Nov-2022 08:48:11 UTC] PHP Notice:  Function wpdb::prepare was called <strong>incorrectly</strong>. Unsupported value type (array). Please see <a href="https://wordpress.org/support/article/debugging-in-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 4.8.2.) in <webroot>/wp-includes/functions.php on line 5831

PS: The problem with the wpdb->prepare() call is that OBJECT was passed as a 3rd parameter to the function. Instead, OBJECT should be passed to the wpdb->get_row() call.

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.

1 participant