Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imagecopyresized() error message refers to the wrong argument as problematic #8848

Closed
ErikRoelofs opened this issue Jun 23, 2022 · 1 comment

Comments

@ErikRoelofs
Copy link

ErikRoelofs commented Jun 23, 2022

Description

The following code:

<?php
$image1 = imagecreatetruecolor(1,1);
$image2 = imagecreatetruecolor(1,1);
imagecopyresized($image1, $image2, 1, 1, 1, 1, 0, 0, 1, 1);

Resulted in this output:

Uncaught ValueError: imagecopyresized(): Argument #3 ($dst_x) must be greater than 0 in php shell code:1

But I expected this output instead:

Uncaught ValueError: imagecopyresized(): Argument #7 ($dst_width) must be greater than 0 in php shell code:1

Note that the same applies to argument 8, if you set $dst_width to 1 but keep $dst_height at 0, then it says Argument #4 instead o Argument #8 in the error message.

PHP Version

8.0.20

Operating System

Ubuntu 20.04

@cmb69
Copy link
Contributor

cmb69 commented Jun 23, 2022

Indeed! Apparently, that function has just too many parameters. ;)

@cmb69 cmb69 self-assigned this Jun 23, 2022
cmb69 added a commit that referenced this issue Jun 23, 2022
* PHP-8.0:
  Fix GH-8848: imagecopyresized() error refers to the wrong argument
@cmb69 cmb69 closed this as completed in 9405f43 Jun 23, 2022
cmb69 added a commit that referenced this issue Jun 23, 2022
* PHP-8.1:
  Fix GH-8848: imagecopyresized() error refers to the wrong argument
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants