Skip to content
This repository has been archived by the owner on Nov 15, 2024. It is now read-only.

Upload error in PHP 8.1 #709

Open
seunex17 opened this issue Apr 8, 2023 · 8 comments
Open

Upload error in PHP 8.1 #709

seunex17 opened this issue Apr 8, 2023 · 8 comments

Comments

@seunex17
Copy link

seunex17 commented Apr 8, 2023

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

@junefw
Copy link

junefw commented May 9, 2023

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

@junefw
Copy link

junefw commented May 9, 2023

@seunex17 Hey, you can follow fixed this issue #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.

@seunex17
Copy link
Author

seunex17 commented May 9, 2023

@junefw thanks

@mcsaygili
Copy link

Same issue for PHP 8.2.5
Any updates ?

@mcsaygili
Copy link

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;

@satriags
Copy link

satriags commented Jun 8, 2023

it's works !! thank youu

@slaweknaczynski
Copy link

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

@dleffler
Copy link

dleffler commented Feb 1, 2024

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)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants