Skip to content
This repository has been archived by the owner on Oct 13, 2020. It is now read-only.

Update wpthumb.background-fill.php #89

Closed
wants to merge 1 commit into from
Closed

Update wpthumb.background-fill.php #89

wants to merge 1 commit into from

Conversation

jgalea
Copy link

@jgalea jgalea commented Oct 20, 2013

To fix warnings in PHP

@@ -73,7 +73,7 @@ private function fill_color( array $colors ) {

} elseif ( $current_size['height'] != $size['height'] ) {

$colorToPaint = imagecolorallocatealpha( $new_image, substr( $colors['top'], 0, 3 ), substr( $colors['top'], 3, 3 ), substr( $colors['top'], 6, 3 ), substr( $colors['left'], 9, 3 ) );
$colorToPaint = imagecolorallocatealpha( $new_image, substr( $colors['top'], 0, 3 ) + 0, substr( $colors['top'], 3, 3 ) + 0, substr( $colors['top'], 6, 3 ) + 0, substr( $colors['left'], 9, 3 ) + 0 );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a more explicit solution here would be to just cast the substr return values directly to a float. Something like

$colorToPaint = imagecolorallocatealpha( $new_image, (float) substr( $colors['top'], 0, 3 ), (float) substr( $colors['top'], 3, 3 ), (float) substr( $colors['top'], 6, 3 ), (float) substr( $colors['left'], 9, 3 ) );

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be an int, but yes, should be cast rather than adding 0 to make it an int

@willmot willmot assigned joehoyle and unassigned mattheu Feb 25, 2014
@joehoyle
Copy link
Member

This also ails 4 unit tests. If you wan to get the test running locally to find out why they are failing that would be great. However, it might be a bug in the tests

@jgalea jgalea closed this by deleting the head repository Aug 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants