ResponsiveFilemanager icon indicating copy to clipboard operation
ResponsiveFilemanager copied to clipboard

Upload error in PHP 8.1

Open seunex17 opened this issue 2 years ago • 8 comments

I am having problem uploading image in PHP 8.1 it works on older version. The main issue is i can not event see the actual error this is what i am getting.

image

seunex17 avatar Apr 08 '23 13:04 seunex17

I have same issue when upgrade php 8.2.0. hope fix it soon

junefw avatar May 09 '23 04:05 junefw

@seunex17 Hey, you can follow fixed this issue https://github.com/trippo/ResponsiveFilemanager/issues/673 reply by faisalrehmanlums

I have two step to fixed:

  1. At this file: /filemanager/config/config.php Replace mb_http_input('UTF-8') with mb_http_input();

  2. At saveImage function in this file: filemanager/include/php_image_magician.php Change: if ( ! is_resource($this->imageResized)) To: if ( ! is_resource($this->imageResized) && !($this->imageResized instanceof \GdImage))

*Note: enable GD extention extension=gd in php.ini Done.

junefw avatar May 09 '23 06:05 junefw

@junefw thanks

seunex17 avatar May 09 '23 13:05 seunex17

Same issue for PHP 8.2.5 Any updates ?

mcsaygili avatar May 14 '23 07:05 mcsaygili

Fixed.

  • dialog.php change str_replace(['[', ']'], ['\[', '\]'], $field_id'') to str_replace(['[', ']'], ['\[', '\]'], $field_id ?? '')

  • php_image_magician.php change $cropStartX = $cropArray['x']; $cropStartY = $cropArray['y']; to $cropStartX = (int)$cropArray['x']; $cropStartY = (int)$cropArray['y'];

  • UploadHandler.php add protected $response;

mcsaygili avatar May 14 '23 13:05 mcsaygili

it's works !! thank youu

satriags avatar Jun 08 '23 18:06 satriags

Fixed.

  • dialog.php change str_replace(['[', ']'], ['\[', '\]'], $field_id'') to str_replace(['[', ']'], ['\[', '\]'], $field_id ?? '')
  • php_image_magician.php change $cropStartX = $cropArray['x']; $cropStartY = $cropArray['y']; to $cropStartX = (int)$cropArray['x']; $cropStartY = (int)$cropArray['y'];
  • UploadHandler.php add protected $response;

Why don't you do pull request with those changes so that owner can merge it into master for others to use instead of applying manually? I can see owner merged some pull requests this year? Thanks

slaweknaczynski avatar Jul 20 '23 09:07 slaweknaczynski

Not yet fixed in the code here. Though there's fixes above the error is in /include/php_image_magician.php whereby the floating point parameters ($cropStartX & $cropStartY are not recommended for the imagecopyresampled() call. I simply added an '(int)' type cast to each parameter and the 'warning' no longer spits out which causes the above error. (See #718)

dleffler avatar Feb 01 '24 13:02 dleffler