Skip to content

Accept a null parameter in getLangCodeFromJsonIfEmpty()#460

Merged
galbus merged 1 commit intomainfrom
s-7768-wordpress-errors-on-site
Nov 25, 2025
Merged

Accept a null parameter in getLangCodeFromJsonIfEmpty()#460
galbus merged 1 commit intomainfrom
s-7768-wordpress-errors-on-site

Conversation

@galbus
Copy link
Copy Markdown
Contributor

@galbus galbus commented Nov 25, 2025

This PR fixes a reported error:

2025/11/18 04:38:47 [error] 2621#2621: *902533 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught TypeError: Beyondwords\Wordpress\Core\Core::getLangCodeFromJsonIfEmpty(): Argument #3 ($meta_key) must be of type string, null given

The issue was that getLangCodeFromJsonIfEmpty() is hooked to WordPress's get_post_metadata filter, but when get_post_meta() is called without specifying a meta key (to fetch all metadata for a post), WordPress passes null as the $meta_key argument.

The fix: Changed the type hint from string $meta_key to ?string $meta_key to allow nullable values.

@linear
Copy link
Copy Markdown

linear bot commented Nov 25, 2025

@galbus galbus self-assigned this Nov 25, 2025
@galbus galbus added bug php Pull requests that update Php code labels Nov 25, 2025
@galbus galbus requested a review from nklhtv November 25, 2025 13:11
@galbus galbus merged commit 374fd0e into main Nov 25, 2025
10 checks passed
@galbus galbus deleted the s-7768-wordpress-errors-on-site branch November 25, 2025 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug php Pull requests that update Php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants