Skip to content

Getting a crash (HTTP ERROR 500) when trying to edit page with WP Bakery and Cloudinary plugin activated #863

Closed

Description

@ioannisth

Bug Description

When I am trying to edit a page with WP Bakery on a live site (running on OpenLiteSpeed web server) with the cloudinary plugin activated, I get HTTP ERROR 500

Expected Behaviour

I should be able to enter the WP Bakery Visual Composer. The default WP editor works fine

Steps to reproduce

  1. Go to pages
  2. Click on a page, then click edit
  3. See error

Screenshots

Additional context

  • WordPress version: 6.1.1
  • Plugin version: 3.0.9
  • Gutenberg plugin version (if applicable):
  • PHP version: 8.0.7
  • OpenLiteSpeed log during the crash:

[3910065] [162.158.86.84:18486-2#wordpress] [STDERR] PHP Fatal error: Uncaught DivisionByZeroError: Division by zero in /var/www/html/wp-content/plugins/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-delivery.php:1282
Stack trace:
#0 [internal function]: Cloudinary\Delivery->parse_element()
#1 /var/www/html/wp-content/plugins/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-delivery.php(919): array_map()
#2 /var/www/html/wp-content/plugins/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-delivery.php(1742): Cloudinary\Delivery->convert_tags()
#3 /var/www/html/wp-includes/class-wp-hook.php(308): Cloudinary\Delivery->catch_urls()
#4 /var/www/html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#5 /var/www/html/wp-includes/plugin.php(517): WP_Hook->do_action()
#6 /var/www/html/wp-content/plugins/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-string-replace.php(270): do_action()
#7 /var/www/html/wp-content/plugins/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-string-replace.php(296): Cloudinary\String_Replace->prime_replacements()
#8 [internal function]: Cloudinary\String_Replace->replace_strings()
#9 {main}
thrown in /var/www/html/wp-content/plugins/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-delivery.php on line 1282

Activity

  1. ioannisth commented on Feb 16, 2023

    @ioannisth
    Author

    Inside wp-content/plugins/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-delivery.php, line 1282 tries to divide by $has_size[1] merely by checking if $has_size is not an empty array not checking for zero values, either for $has_size[1] or $item['height']

    if ( ! empty( $has_size ) ) { $file_ratio = round( $has_size[0] / $has_size[1], 2 ); $original_ratio = round( $item['width'] / $item['height'], 2 ); if ( $file_ratio !== $original_ratio ) { $attributes['data-crop'] = $file_ratio; } }

  2. pereirinha commented on Feb 16, 2023

    @pereirinha
    Contributor

    Hi @ioannisth

    Thank you for raising this issue. Fortunately, this has already been identified, and we have a patch.
    We are currently in the last tests before we roll out 3.1.0, which will fix this issue.

    We are expecting to release the new version shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions