[BUGFIX] Call to stdWrap() of non-existant $this->cObj in GifBuilder
authorSteffen Gebert <steffen.gebert@typo3.org>
Mon, 18 Apr 2011 20:19:06 +0000 (22:19 +0200)
committerSteffen Gebert <steffen.gebert@typo3.org>
Sun, 31 Jul 2011 18:43:23 +0000 (20:43 +0200)
A PHP Fatal Error occurs in tslib_gifBuilder::checkTextObj(), because
$this->cObj is not set, however this->cObj->stdWrap() is called.

A few lines later, a local variable $cObj is initialized. This
initialization should be moved before the stdWrap() call.

Change-Id: I1ee8a8ecc4245af49e4f698734b66d95a835d57d
Resolves: #26091
Reviewed-on: http://review.typo3.org/3948
Reviewed-by: Steffen Gebert
Tested-by: Steffen Gebert
typo3/sysext/cms/tslib/class.tslib_gifbuilder.php

index 653605d..61db43e 100644 (file)
@@ -565,11 +565,14 @@ class tslib_gifBuilder extends t3lib_stdGraphic {
         * @access private
         */
        function checkTextObj($conf)    {
+               $cObj = t3lib_div::makeInstance('tslib_cObj');
+               $cObj->start($this->data);
+
                $isStdWrapped = array();
                foreach($conf as $key => $value) {
                        $parameter = rtrim($key,'.');
                        if(!$isStdWrapped[$parameter] && isset($conf[$parameter.'.'])) {
-                               $conf[$parameter] = $this->cObj->stdWrap($conf[$parameter], $conf[$parameter.'.']);
+                               $conf[$parameter] = $cObj->stdWrap($conf[$parameter], $conf[$parameter . '.']);
                                $isStdWrapped[$parameter] = 1;
                        }
                }
@@ -581,8 +584,6 @@ class tslib_gifBuilder extends t3lib_stdGraphic {
                        $conf['angle']=0;
                }
                if (!isset($conf['antiAlias'])){$conf['antiAlias']=1;}
-               $cObj =t3lib_div::makeInstance('tslib_cObj');
-               $cObj->start($this->data);
 
                $conf['fontColor'] = trim($conf['fontColor']);
                        // Strip HTML