PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Images » Image_Canvas » Bug #6769

ImageMap.php doesnot check for boolean false with strpos

Details

Submitted2006-02-13 15:44 UTC
Frompeter at jingo dot com
Assignednosey
StatusClosed
PackageImage_Canvas
PHP Version5.1.0
OSRed Hat
Roadmaps(Not assigned)

Comments

[2006-02-13 15:44 UTC] peter at jingo dot com

Description:
------------
the function _addMapTag($shape, $coords, $params) contains a check for double quotes when generating the image map.

The check (which returns true even if no double quotes are used) is:

if (strpos($value, '"') >= 0) {
$tags .= $key . '=\'' . $value . '\'';
} else {
$tags .= $key . '="' . $value . '"';
}

Test script:
---------------
the fix is:

if (strpos($value, '"') === false) {
$tags .= $key . '="' . $value . '"';
} else {
$tags .= $key . '=\'' . $value . '\'';
}

Expected result:
----------------

<area shape="circle" coords="75,72,2" href="#test" target="_blank" alt="test" title="test">