Title: PHP8 Fix
Last modified: August 3, 2023

---

# PHP8 Fix

 *  Resolved [Fixmysite](https://wordpress.org/support/users/newtlabs/)
 * (@newtlabs)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/php8-fix/)
 * Updating from PHP7.4 to PHP8 and beyond gives the following error:
   **Fatal error**:
   Uncaught TypeError: Unsupported operand types: string / string in /wp-content/
   plugins/wp-video-lightbox/misc_functions.php:114
 * Here is the proposed fix:
 * The error message `Unsupported operand types: string / string` at the line `$
   aspect_ratio = $height/$width;` implies that the operation is attempting to divide
   two string values, which is not a valid operation in PHP.
 * In the context of your `wp_vid_lightbox_youtube_handler` function, the `$width`
   and `$height` variables are being assigned values from an associative array (`
   $atts`), which are initially being passed as strings. In PHP, you cannot perform
   mathematical operations on strings directly without converting them to numbers.
 * To fix this error, you can convert these string values to integers or floats 
   before the division operation. Here’s how you can do this:
 * Change this line:
 * phpCopy code
 * `$aspect_ratio = $height/$width;`
 * to:
 * phpCopy code
 * `$aspect_ratio = (float)$height / (float)$width;`
 * The `(float)` before `$height` and `$width` casts these variables to float numbers
   before the division operation is performed. This should help you eliminate the
   fatal error. However, you should ensure that your width and height parameters
   are always numeric and not zero to avoid division by zero errors.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Support [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * (@mbrsolution)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/php8-fix/#post-16945703)
 * Thank you for reaching out to us and sharing your solution. I have submitted 
   a message to the developers to investigate further your findings.
 * Kind regards.
 *  Plugin Author [wptipsntricks](https://wordpress.org/support/users/wptipsntricks/)
 * (@wptipsntricks)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/php8-fix/#post-16946389)
 * [@newtlabs](https://wordpress.org/support/users/newtlabs/), Thanks for the feedback.
   We have just released an update to fix the issue.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘PHP8 Fix’ is closed to new replies.

 * ![](https://ps.w.org/wp-video-lightbox/assets/icon-128x128.png?rev=981252)
 * [WP Video Lightbox](https://wordpress.org/plugins/wp-video-lightbox/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-video-lightbox/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-video-lightbox/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-video-lightbox/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-video-lightbox/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-video-lightbox/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [wptipsntricks](https://wordpress.org/support/users/wptipsntricks/)
 * Last activity: [2 years, 10 months ago](https://wordpress.org/support/topic/php8-fix/#post-16946389)
 * Status: resolved