[TYPO3-core] RFC: Bug #0007295: Bogus check in handler_getFromTableList

Michael Stucki michael at typo3.org
Sun Feb 3 16:09:32 CET 2008


Hi Oliver,

> This is the original code:
> 
> [...]
> 
> So it seems that reading an uninitialized variable was intentional and
> not an error. This is bad (reading uninitialized variables) because
> people reading the code then could take this to be an error (like I
> did). I've appended a new patch that properly initializes the variable
> while keeping the old behavior.

I agree that it is bad, but I wonder what did not work in your installation?
Is it still a bug, or is it just a code cleanup?

Anyway, I agree to the change in the first hunk, but not with the second
one:

@@ -2034,7 +2035,7 @@
                                        $handlerKey = $this->table2handlerKeys[$vArray['table']] ? $this->table2handlerKeys[$vArray['table']] : '_DEFAULT';

                                                // In case of separate handler keys for joined tables:
-                                       if ($outputHandlerKey && $handlerKey != $outputHandlerKey)      {
+                                       if (($outputHandlerKey != '') && ($handlerKey != $outputHandlerKey)) {
                                                die('DBAL fatal error: Tables in this list "'.$tableList.'" didn\'t use the same DB handler!');
                                        }

First, I cannot check if $outputHandlerKey (although the name indicates it)
is always a string, so better just keep it as it is. It really does not
hurt).

Also, there is no need to wrap all comparisons in braces, so actually I still
prefer the way it was written before...

- michael
-- 
Use a newsreader! Check out
http://typo3.org/community/mailing-lists/use-a-news-reader/


More information about the TYPO3-team-core mailing list