Skip to content

Ensure loadAddons returns an array - #218

Open
otacke wants to merge 1 commit into
h5p:masterfrom
otacke:fix-loadAddons
Open

Ensure loadAddons returns an array#218
otacke wants to merge 1 commit into
h5p:masterfrom
otacke:fix-loadAddons

Conversation

@otacke

@otacke otacke commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Thank you for your interest in contributing to H5P! 🎉
Please fill in the below sections to make your pull request:

What kind of change does this PR introduce?
Bug fix

What is the current behaviour?
The H5P framework interface requires the loadAddon function to return an array (https://github.com/h5p/h5p-php-library/blob/cb64a1f3884408487c3178e31fc140f5d45ca165/h5p.classes.php#L110-L114). However, the current implementation will return null if the SQL query fails (

public function clearFilteredParameters($library_ids) {
global $wpdb;
$wpdb->query(
"UPDATE {$wpdb->prefix}h5p_contents
SET filtered = ''
WHERE id IN (
SELECT DISTINCT content_id
FROM {$wpdb->prefix}h5p_contents_libraries
WHERE library_id IN (" . implode(',', array_map('intval', $library_ids)) . ")
)"
);
}
).

What is the new behaviour?
If the SQL query fails, an empty array will be returned (silently failing) to honor the interface.

PR Checklist

Before submitting, please confirm:

  • I searched for existing issues/PRs first
  • I linked related issues/discussions
  • I tested my changes locally

Read the contribution guidelines to get your pr accepted more quickly.

@otacke otacke added the bug Something isn't working label Aug 17, 2026
@arzola

arzola commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

This makes sense

@otacke

otacke commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

@arzola So this could be moved to "Verified by Community Maintainer"? Do you have the rights to do that already?

@arzola arzola moved this from Backlog to Verified by Community Maintainer in H5P Open Source Project Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Verified by Community Maintainer

Development

Successfully merging this pull request may close these issues.

2 participants