12543[BUGFIX] Illegal string offsets in t3lib_stdgraphic
Commit message
Review
-
Code review CR +2
- Christian Kuhn +2
- Stefan Neufeind +1
-
Verified V +2
- Christian Kuhn +2
Files 5
- typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php+10 −10
- typo3/sysext/core/Tests/Unit/Imaging/GraphicalFunctionsTest.phpnew+133 −0
- typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php+2 −2
- typo3/sysext/frontend/Classes/Controller/ShowImageController.php+1 −1
- typo3/sysext/install/Classes/Installer.php+8 −8
Review log 25
-
Stefan Neufeind commented on patch set 1 11/02/12, 13:16
Looks good to me, but someone else must approve no-brainer? -
Stefan Neufeind uploaded patch set 2 11/02/12, 13:16
-
Stefan Neufeind commented on patch set 2 11/02/12, 13:16
Looks good to me, but someone else must approve adapted to current master; used !empty as Philipp suggested (thanks) -
Oliver Klee commented on patch set 1 11/02/12, 13:16
Looks good to me, but someone else must approve -
Christian Kuhn commented on patch set 2 11/02/12, 13:16
The root of all evil is actually: - With php 5.4 warnings are thrown, if you access a string(!) offset with something that can not be interpreted as integer, eg. word "maxH" - This happens in getImageScale(), if $options is not given as array, but as string. So, imho the signature of getImageScale should be changed to array $options = array() (maybe same for imageMagickConvert), and then look in core for all usages of getImageScale() and imageMagickConvert() where $options is given as string and fix this to leave out the parameter or make sure an array is given. Maybe, for b/w compat, the array type hint should be left out, and instead a guard clause testing is_array() should throw a deprecation, so the type hint can be added two versions later leading to a parse error if it is no array. -
Christian Kuhn commented on patch set 2 11/02/12, 13:16
So, while the current patch looks ok so far by sanitizing the values, the "real" solution is to fix the method so they do not accept wrong types of $options anymore ... and while we are at it, we could look at the other input parameters, too, and see if they can / should be checked for proper types as well. -
Christian Kuhn commented on patch set 2 11/02/12, 13:16
so, we could maybe merge this one here, even if it only suppresses the effect of wrong method usage, and is no real cure. But we should at least add an issue about the 'real' fix. Other opinions? -
Christian Kuhn commented on patch set 2 11/02/12, 13:16
Ah, and could we maybe have a test for the getImageScale that feeds the methods with some input and checks the output? This would help to actually document, what the method is supposed to do ... this could be done with this patch set here, too. -
Philipp Gampe commented on patch set 1 11/02/12, 13:16
I would prefer that you didn't submit thisclass.t3lib_stdgraphic.php:2215this is wrong! it must be "!empty", because isset() only evaluates NULL to false, otherwise it always returns TRUE, even if the variable is $arr['key'] = 0class.t3lib_stdgraphic.php:2414this is a change in behavior, although it looks correct here, same belowclass.t3lib_stdgraphic.php:2493this is the correct usage of isset() -
Andy Grunwald commented on patch set 1 11/02/12, 13:16
Looks good to me, but someone else must approve -
Mr. Jenkins commented on patch set 1 11/02/12, 13:16
Build Successful https://ci.typo3.org/job/typo3-v4-core-gerrit/4716/ : SUCCESS -
Mr. Jenkins commented on patch set 2 11/02/12, 13:16
Build Successful https://ci.typo3.org/job/typo3-v4-core-gerrit/6428/ : SUCCESS -
Christian Kuhn commented on patch set 3 11/02/12, 13:16
+1 on first glance, still a basic unit test for getImageScale would be nice. -
Mr. Jenkins commented on patch set 3 11/02/12, 13:16
Build Successful https://ci.typo3.org/job/typo3-v4-core-gerrit/6431/ : SUCCESS -
Wouter Wolters uploaded patch set 3 11/02/12, 13:16
-
Andy Grunwald uploaded patch set 5 11/02/12, 13:16
-
Stefan Neufeind commented on patch set 6 11/02/12, 13:16
Looks good to me, but someone else must approve sidenote: in forge there are two other "illegal string offset"-issues linked to this one, which recently got mentioned on the german mailinglist ... -
Andy Grunwald uploaded patch set 6 11/02/12, 13:16
-
Andy Grunwald commented on patch set 6 11/02/12, 13:16
So. I`ve converted the windows linebreaks to unix linebreaks in the unit test. Please be so nice to configure your IDE to use UNIX linebreaks (\n) only. Jenkins is happy now :) -
Mr. Jenkins commented on patch set 4 11/02/12, 13:16
Fails; I would prefer that you didn't submit this Build Failed https://ci.typo3.org/job/typo3-v4-core-gerrit/6442/ : FAILURE -
Mr. Jenkins commented on patch set 5 11/02/12, 13:16
Fails; I would prefer that you didn't submit this Build Failed https://ci.typo3.org/job/typo3-v4-core-gerrit/6443/ : FAILURE -
Mr. Jenkins commented on patch set 6 11/02/12, 13:16
Build Successful https://ci.typo3.org/job/typo3-v4-core-gerrit/6444/ : SUCCESS -
Wouter Wolters uploaded patch set 4 11/02/12, 13:16
-
Christian Kuhn commented on patch set 6 V 0 11/02/12, 13:16
by team member; Looks good to me, approved Very good work. I will merge this now and will create the backports. Thanks. -
Christian Kuhn merged patch set 6 11/02/12, 13:16