Wordpress Plugin: OAM Upload Failed

Hello @Daniel

Wordpress officially recommend 8.1, but the plugins not compatible with php8.1 and php8.2, and please check the following info:

PHP Fatal error:  Uncaught TypeError: round(): Argument #1 ($num) must be of type int|float, string given in /var/www/mysite.com/htdocs/wp-content/plugins/tumult-hype-animations/includes/variables.php:32
Stack trace:
#0 /var/www/mysite.com/htdocs/wp-content/plugins/tumult-hype-animations/includes/variables.php(32): round()
#1 /var/www/mysite.com/htdocs/wp-content/plugins/tumult-hype-animations/includes/variables.php(10): parse_size()
#2 /var/www/mysite.com/htdocs/wp-content/plugins/tumult-hype-animations/includes/variables.php(5): upload_mb()
#3 /var/www/mysite.com/htdocs/wp-content/plugins/tumult-hype-animations/hypeanimations.php(19): include('...')
#4 /var/www/mysite.com/htdocs/wp-settings.php(453): include_once('...')
#5 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1349): require('...')
#6 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1267): WP_CLI\Runner->load_wordpress()
#7 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#8 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(83): WP_CLI\Bootstrap\LaunchRunner->process()
#9 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap()
#10 phar:///usr/local/bin/wp/php/boot-phar.php(20): include('...')
#11 /usr/local/bin/wp(4): include('...')
#12 {main}
  thrown in /var/www/mysite.com/htdocs/wp-content/plugins/tumult-hype-animations/includes/variables.php on line 32
Fatal error: Uncaught TypeError: round(): Argument #1 ($num) must be of type int|float, string given in /var/www/mysite.com/htdocs/wp-content/plugins/tumult-hype-animations/includes/variables.php:32
Stack trace:
#0 /var/www/mysite.com/htdocs/wp-content/plugins/tumult-hype-animations/includes/variables.php(32): round()
#1 /var/www/mysite.com/htdocs/wp-content/plugins/tumult-hype-animations/includes/variables.php(10): parse_size()
#2 /var/www/mysite.com/htdocs/wp-content/plugins/tumult-hype-animations/includes/variables.php(5): upload_mb()
#3 /var/www/mysite.com/htdocs/wp-content/plugins/tumult-hype-animations/hypeanimations.php(19): include('...')
#4 /var/www/mysite.com/htdocs/wp-settings.php(453): include_once('...')
#5 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1349): require('...')
#6 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1267): WP_CLI\Runner->load_wordpress()
#7 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#8 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(83): WP_CLI\Bootstrap\LaunchRunner->process()
#9 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap()
#10 phar:///usr/local/bin/wp/php/boot-phar.php(20): include('...')
#11 /usr/local/bin/wp(4): include('...')
#12 {main}
  thrown in /var/www/mysite.com/htdocs/wp-content/plugins/tumult-hype-animations/includes/variables.php on line 32
Error: There has been a critical error on this website.Learn more about troubleshooting WordPress. There has been a critical error on this website.

Could you please update and make it compatible with Php8.1?

Hello @Daniel

Sorry for mislead you, and just tested it with Php74, but it seems same issue.

So, mostly it is not compatible with wp-cli but not php version.

Thanks

It looks like for some reason your server is returning a string instead of a number for maximum upload values. Could you try replacing the contents of variables.php with this code?

Hi Alex,

I realize that my function to determine the maximum upload size might not be taking all the potential values in the PHP configuration into account. Can you make a php file on your server called test.php and run it to see what the values are set in your configuration?

The function essentially looks at the smallest of these three values to figure out how large of an OAM can be uploaded:

  1. upload_max_filesize
  2. post_max_size
  3. memory_limit

This can be called test.php:

<?php

// Getting ini configuration for 'upload_max_filesize'
$upload_max_filesize = ini_get('upload_max_filesize');
echo 'upload_max_filesize: ' . $upload_max_filesize . "<br/>";

// Getting ini configuration for 'post_max_size'
$post_max_size = ini_get('post_max_size');
echo 'post_max_size: ' . $post_max_size . "<br/>";

// Getting ini configuration for 'memory_limit'
$memory_limit = ini_get('memory_limit');
echo 'memory_limit: ' . $memory_limit . "<br/>";

?>

Helle @Daniel ,

Sorry for missing your post, and here is what I test:

upload_max_filesize: 100M
post_max_size: 100M
memory_limit: 5220M

Lightshot screenshot

Should there be anything that I can help, please let me know.

For now, please allow me delete that test.php file.

Thanks

Do you expect I still try this code ? or should I wait for your update please?

Yes, please give it a shot

Hi @Daniel ,

Just did a test upon the file on github:

Yes, no error logged for now.

Thanks

Hello @Daniel ,

Please check the post at Issue when using Wp-cli | WordPress.org

When I tried use wp-cli, there is some relevant error log.

Thanks for reporting -- Please try again with the latest (v 1.9.9).

2 Likes

Hello @Daniel ,

Great work. Thanks so much for quick fix. There is no any issue now.:slight_smile:

2 Likes

Hello,
I have a couple WP sites on a new VM and find that if PHP 8.3.1 is used the upload fails. PHP 8.1.27 works though... This is using the latest plugin (1.9.13)

Can you tell me a bit more about your development environment? 8.3.4 is the current stable version, are you able to upgrade to that latest point release of 8.3?

Do you see any errors in the WP_debug log? Here's how to turn that on: Debugging in WordPress – Advanced Administration Handbook | Developer.WordPress.org

I have a new Virtual Machine in Azure Cloud (Windows Server).

The error report is as follows:
Error Details

An error of type E_ERROR was caused in line 757 of the file C:\inetpub\wwwroot\casatoucana.com\wordpress-6.4.2\wordpress\wp-content\plugins\tumult-hype-animations\includes\adminpanel.php. Error message: Uncaught Error: Class "ZipArchive" not found in C:\inetpub\wwwroot\casatoucana.com\wordpress-6.4.2\wordpress\wp-content\plugins\tumult-hype-animations\includes\adminpanel.php:757
Stack trace:
#0 C:\inetpub\wwwroot\casatoucana.com\wordpress-6.4.2\wordpress\wp-content\plugins\tumult-hype-animations\includes\adminpanel.php(32): is_zip_clean()
#1 C:\inetpub\wwwroot\casatoucana.com\wordpress-6.4.2\wordpress\wp-includes\class-wp-hook.php(324): hypeanimations_panel_upload()
#2 C:\inetpub\wwwroot\casatoucana.com\wordpress-6.4.2\wordpress\wp-includes\class-wp-hook.php(348): WP_Hook->apply_filters()
#3 C:\inetpub\wwwroot\casatoucana.com\wordpress-6.4.2\wordpress\wp-includes\plugin.php(517): WP_Hook->do_action()
#4 C:\inetpub\wwwroot\casatoucana.com\wordpress-6.4.2\wordpress\wp-admin\includes\menu.php(161): do_action()
#5 C:\inetpub\wwwroot\casatoucana.com\wordpress-6.4.2\wordpress\wp-admin\menu.php(422): require_once('...')
#6 C:\inetpub\wwwroot\casatoucana.com\wordpress-6.4.2\wordpress\wp-admin\admin.php(158): require('...')
#7 {main}
thrown

It looks like your server is missing the standard php-zip module. Can you check that it was installed?

Yes, you are correct... PHP 8.1.27 does have Zip installed by default. PHP 8.3.1 does not. Both installs were using default settings with minor changes for MySQL ports but I have never had to do anything with zip on any PHP installs to date. It's might be a new default from the PHP folks.

Update ""As of PHP 8.2.0, php_zip.dll DLL must be enabled in php.ini. Previously, this extension was built-in. ""

UPDATE 2 : enabling the Zip extension in PHP now allows the OAM Upload feature to work

2 Likes

My guess is that Azure cloud is trying to be as lean as possible here. For the most optimized Wordpress instance, I would use this one: Microsoft Azure Marketplace

The PHP lack of Zip is a PHP specific change from the team that manages PHP.

Regarding Azure, I run a VM which is the cloud version of a Dedicated Server. This means I control all aspects and the only limitation from MS is they stopped allowing SMTP on port 25 out to curb spammers.

Glad it's working again! I just wanted to add that Wordpress considers itself 'beta' under PHP 8.2 and 8.3 based on this chart: PHP Compatibility and WordPress Versions – Make WordPress Core. (This was news to me until a little while ago).

While I haven't experienced issues under 8+, there are issues listed under PHP 8+ here. Security releases for 8.1 (that last version not under that 'beta support' category) ends in 7 months on 2024-11-25T05:00:00Z. All that is to say, you may hit weird edge cases in WP core itself if you are on the bleeding edge of PHP.