Bug #42749

Broken ImageConverter for PHP 5.3

Added by Karsten Dambekalns over 2 years ago. Updated over 2 years ago.

Status:Resolved Start date:2012-11-07
Priority:Should have Due date:
Assigned To:Karsten Dambekalns % Done:

100%

Category:-
Target version:Base Distribution - Sprint February 2013

Description

The use of isset() on a string leads to wrong results:

$source = 'someString';
$set = isset($source['__identity'])
// set is TRUE now, because of type juggling, in PHP 5.3

See http://ci.typo3.robertlemke.net/job/TYPO3-Neos-Commit/6670/console for an example :)


Related issues

related to TYPO3.Media - Bug #37230: Image TypeConverter does not allow to map Image by Identity Resolved 2012-05-16

Associated revisions

Revision 86f4144a
Added by Karsten Dambekalns over 2 years ago

[BUGFIX] Fix array key check in ImageConverter

Using isset() to check for array keys may fail when used on strings.
This changes uses array_key_exists().

Change-Id: I9ffc5154d85990485c78cafe111d5d64e01ea42b
Fixes: #42749

History

#1 Updated by Gerrit Code Review over 2 years ago

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16248

#2 Updated by Adrian Föder over 2 years ago

but since the sourceType of the TypeConverter is fixed set to array, the mentioned case must never occur. That's why I abstained from adding an additional "is_array()"....
But I agree that the Test is wrongly written (with providing a string), and I fell prey to PHP 5.4 usage...

#3 Updated by Karsten Dambekalns over 2 years ago

Adrian Föder wrote:

but since the sourceType of the TypeConverter is fixed set to array

Well, but the signature of canConvertFrom() advertises mixed, so…

#4 Updated by Gerrit Code Review over 2 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16248

#5 Updated by Karsten Dambekalns over 2 years ago

  • Status changed from Accepted to Under Review

#6 Updated by Karsten Dambekalns over 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF