Fatal TypeError in BeTheme: “Unsupported operand types: string * string” in media.php
Description:
When loading pages that include images—especially SVGs—using BeTheme on WordPress 6.4 with PHP 8, the site returns a 500 Internal Server Error. The error log shows:
PHP Fatal error: Uncaught TypeError: Unsupported operand types: string * string in wp-includes/media.php:6286 Stack trace: #0 wp-includes/media.php(6148): wp_maybe_add_fetchpriority_high_attr() #1 wp-includes/media.php(1097): wp_get_loading_optimization_attributes() #2 wp-content/themes/betheme/functions/theme-functions.php(2263): wp_get_attachment_image() #3 wp-content/themes/betheme/functions/theme-shortcodes.php(8123): mfn_get_attachment() #4 wp-content/themes/betheme/functions/builder/class-mfn-builder-items.php(837): sc_image() #5 wp-content/themes/betheme/functions/builder/class-mfn-builder-front.php(2819): Mfn_Builder_Items::item_image() #6 wp-content/themes/betheme/functions/builder/class-mfn-builder-front.php(2526): Mfn_Builder_Front->show_items() #7 …
Environment:
- WordPress 6.8.2
- PHP 8.2
- Theme: BeTheme , version 28.1.3
- No additional image-optimization plugins active
Root Cause:
WordPress 6.8.2 added a “fetchpriority” optimization in wp_maybe_add_fetchpriority_high_attr()
, which multiplies the image’s width * height
to decide eager vs. lazy loading. When BeTheme calls wp_get_attachment_image()
without numeric dimensions (e.g. SVGs with width="100%"
or missing values), PHP 8 refuses to multiply two non-numeric strings, triggering the TypeError.
Impact:
- Any page built with BeTheme’s image shortcodes or SVGs will throw a 500 error.
- Breaks front-end rendering for all affected sites using this combination.
Steps to Reproduce:
- Activate BeTheme (28.1.3) on a WP 6.8.2 site running PHP 8.2.
- Insert an SVG (or any image shortcode without numeric width/height).
- Visit the page in the browser → 500 Internal Server Error appears.
Temporary Workaround:
We’ve patched core (wp-includes/media.php
) to cast width
/height
to integers before multiplying, and/or used a filter in functions.php
to bypass the fetchpriority logic.
Requested Fix:
Please include in the next BeTheme release—or issue a hotfix—a built-in compatibility adjustment that either:
- Ensures dimensions passed to
wp_get_loading_optimization_attributes()
are cast to integers (usingis_numeric()
checks), or - Disables the fetchpriority calculation for SVGs/shortcodes by default, falling back to standard loading attributes.
That way, BeTheme sites remain fully compatible with WordPress 6.8.2+ and PHP 8.2 without requiring manual core or theme-child patches.
Thank you for your prompt attention!
Comments
Hi,
We are not passing any dimensions to the
wp_get_attachment_image
function anywhere, so we cannot determine whether they are of type integer. We were also unable to reproduce the error in our test environment. If you could provide temporary access to wp-admin and FTP, along with a note indicating the change you made, we’d be happy to investigate the issue further.You can send WordPress dashboard and FTP access privately through the contact form, which is on the right side at https://themeforest.net/user/muffingroup#contact.
Notice!
Please attach a link to this forum discussion.
Sending incorrect or incomplete data will result in a longer response time.
Therefore, please ensure that the data you send are complete and correct.
Thanks
We have the exact same error after upgrading to PHP 8.3, 8.2 and 8.1 (we've tried all versions, same error):
Fatal error: Uncaught TypeError: Unsupported operand types: string * string in /home/httpd/vhosts/domainname.org/httpdocs/wp-includes/media.php:6286 Stack trace: #0 /home/httpd/vhosts/domainname.org/httpdocs/wp-includes/media.php(6148): wp_maybe_add_fetchpriority_high_attr(Array, 'img', Array) #1 /home/httpd/vhosts/domainname.org/httpdocs/wp-includes/media.php(1097): wp_get_loading_optimization_attributes('img', Array, 'wp_get_attachme...') #2 /home/httpd/vhosts/domainname.org/httpdocs/wp-content/themes/betheme/functions/theme-functions.php(2263): wp_get_attachment_image('192', 'full', false, Array) #3 /home/httpd/vhosts/domainname.org/httpdocs/wp-content/themes/betheme/functions/theme-shortcodes.php(8123): mfn_get_attachment('192', 'full', '', Array) #4 /home/httpd/vhosts/domainname.org/httpdocs/wp-content/themes/betheme/functions/builder/class-mfn-builder-items.php(837): sc_image(Array) #5 /home/httpd/vhosts/domainname.org/httpdocs/wp-content/themes/betheme/functions/builder/class-mfn-builder-front.php(2819): Mfn_Builder_Items::item_image(Array, false) #6 /home/httpd/vhosts/domainname.org/httpdocs/wp-content/themes/betheme/functions/builder/class-mfn-builder-front.php(2526): Mfn_Builder_Front->show_items(Array, 0, false, 0) #7 /home/httpd/vhosts/domainname.org/httpdocs/wp-content/themes/betheme/functions/builder/class-mfn-builder-front.php(1432): Mfn_Builder_Front->show_wraps(Array, 0, false, 0) #8 /home/httpd/vhosts/domainname.org/httpdocs/wp-content/themes/betheme/functions/builder/class-mfn-builder-front.php(390): Mfn_Builder_Front->show_sections(Array, false) #9 /home/httpd/vhosts/domainname.org/httpdocs/wp-content/themes/betheme/page.php(28): Mfn_Builder_Front->show() #10 /home/httpd/vhosts/domainname.org/httpdocs/wp-includes/template-loader.php(106): include('/home/httpd/vho...') #11 /home/httpd/vhosts/domainname.org/httpdocs/wp-blog-header.php(19): require_once('/home/httpd/vho...')
Please send us the WordPress dashboard and FTP access privately through the contact form, which is on the right side at https://themeforest.net/user/muffingroup#contact and we will check what might be the reason.
Notice!
Please attach a link to this forum discussion.
Sending incorrect or incomplete data will result in a longer response time.
Therefore, please ensure that the data you send are complete and correct.
Thanks
Seems that your child theme and plugin "Worth The Read" are the root cause.
When they are inactive, no error appears. I left them disabled, so you can verify it.
I also noticed that your home page does not load correctly, and found that the corrupted SVG image of Google in the Query Loop caused this. I have replaced it with random image for now. Please regenerate this SVG file, and reupload it.
Best regards
Hi there, thank you for your answer.
I've adapted the child theme, looks like the load_child_theme_textdomain() was loaded too early. I've reactivated it, this seems to work, thank you.
Same thing with the "Worth The Read" plugin.
But once I enable an SVG, in the loop, no matter which it is, I get the same error. Seems to be a problem with SVG handling. Can you take a look again?
What program do you use for SVG, or where did you take them from?
Best regards
I've tried multiple SVGs, some that I've downloaded, some that were created with Adobe Photoshop. But same result. Can you try adding an SVG an see if you get the same error?
Just checked and don't get any errors during svg upload.