AlfredoRamos / phpbb-ext-seo-metadata

SEO Metadata extension for phpBB
GNU General Public License v2.0
11 stars 7 forks source link

<meta property="og:image*> is sometimes missing on some HTTPS sites #94

Closed Nekstati closed 2 years ago

Nekstati commented 2 years ago

This extension uses FastImageSize->getImageSize(), which in its turn calls @file_get_contents(), which silently fails with an SSL error "SSL operation failed with code 1..." As a result, og:image tags disappear without a trace. This doesn't happen on every server and probably depends on server config. The problem is that you use the full absolute URLs (https://etc) for local images when performing local routines like checking image dimensions etc. Please 1) make URLs absolite only in the last step, when sending them to template; 2) write to the error log when attachments that certainly exist cannot be obtained for some reason.

Example:

file_get_contents('./image.png'); // OK
file_get_contents('https://site.com/image.png'); // Fail

Refs: Typical related discussion: https://stackoverflow.com/questions/26148701/file-get-contents-ssl-operation-failed-with-code-1-failed-to-enable-crypto PHPBB bugreport: https://tracker.phpbb.com/browse/PHPBB3-16742 FastImageSize bugreport: https://github.com/marc1706/fast-image-size/issues/61

AlfredoRamos commented 2 years ago

silently fails with an SSL error "SSL operation failed with code 1..." [...] This doesn't happen on every server and probably depends on server config

Indeed.

write to the error log when attachments that certainly exist cannot be obtained for some reason

If you meant the phpBB's error logs, absolutely not.

This extension logged errors like that before it was made public. The log table got huge and the cron task that cleans the logs did not help much.

Doing that would consume unnecessarily database resources.

Doing it with PHP directly adds no value to the extension.