Closed (fixed)
Project:
ImageAPI
Version:
6.x-1.3
Component:
ImageAPI Imagick
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Feb 2009 at 22:43 UTC
Updated:
26 Feb 2009 at 16:50 UTC
Jump to comment: Most recent file
Comments
Comment #1
drewish commentedwhat about checking for is_numeric() then casting to an int?
Comment #2
kaareis_numeric()returns true for all number literals as strings in php. That is, it will return true for all these cases:This means that the test
is_numeric()also accept colors specified as hex string ('0xRRGGBB'). Now, casting this value (same asintval()) will return 0 (This is what PHP does internally with the argument todechex()). Assuming you know it's a hex string, you can runhexdec(), but there is no point in that, as you want a hex representation of the color as a string.I'd like to think that if you get a color, and it already is an integer, it's because it has been specified as PHP hex literals or that it already has been run through
hexdec(). Is it a string, well, then it's in hex of some sort ('#RGB', '0xRRGGBB', 'RGB').Now, as the comment in
imageapi_image_rotate()says, the color parameter should be a hex integer. If it's a string, everything is ok, just strip the '0x' or '#' part in the beginning. If it's a hex literal as integer, test whether it's an integer and rundechex()and everything is ok.Comment #3
drewish commentedthanks for clarifying that. committed to HEAD and DRUPAL-6--1. attaching a clean re-roll.