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

E_DEPRECATED: htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated #21737

Open
kkmuffme opened this issue Oct 22, 2024 · 4 comments · May be fixed by #21786
Open

Comments

@kkmuffme
Copy link
Contributor

E_DEPRECATED: htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated

PHP 8.3
wordpress-seo 23.7 => this issue wasn't there in 23.6

in wordpress-seo\src\images\Application\image-content-extractor.php

Maybe related to #21723 but since there's no description I'm not sure.

@josevarghese
Copy link
Contributor

Hi @kkmuffme

Thanks for creating the issue and for providing the PR. Our development team will review it and will provide you with more details.

Thanks in advance.

@Yoast Yoast deleted a comment Oct 25, 2024
@leonidasmi leonidasmi self-assigned this Oct 31, 2024
@leonidasmi
Copy link
Contributor

Hi there @kkmuffme a question so that we can replicate as well:

  • How come you get a NULL for the $processor->get_attribute( 'src' ) operation?
  • If I'm not mistaken, the only way for $processor->get_attribute( 'src' ) to return NULL is to have an <img> element without an src attribute
  • And that's not valid HTML

So I was wondering if you have some pointers for us to be able to replicate

@kkmuffme
Copy link
Contributor Author

kkmuffme commented Nov 3, 2024

Exactly, that's how it happens. I've run across 3 scenarios how that happens:

  • documentation uses an tag in markdown as example where there is no "src" tag there on purpose (= it's valid, since this <img isn't actually HTML but text documentation showcasing an example)
  • people mis-spelling the src tag (e.g. <img stc="...")
  • people messing up img tags, e.g. when refactoring text and the src,... is removed, but the img is left-over

Since I can't control what people do :-) and PHP deprecated notices are not a useful way to reach the target audience (= IT, but the HTML is from a user or a marketing dept) who created the invalid HTML, this should be handled to not throw a deprecated notice.

@leonidasmi
Copy link
Contributor

Good point, I'm moving this forward then 👍

I've created a separate PR that is based on your PR, just so that I facilitate reviewing and potentially merging this (along with some props for you).

@leonidasmi leonidasmi removed their assignment Nov 4, 2024
@vraja-pro vraja-pro assigned vraja-pro and unassigned vraja-pro Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants