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

Oliver Klee typo3-german-02 at oliverklee.de
Sun Feb 3 13:52:57 CET 2008


Hi,

thanks for the notes on code cleanup and creating patches.

Michael Stucki schrieb:
> So the check seems just fine: If $outputHandlerKey is not set, it is also not
> compared. I did not check this, but if my assumption is wrong, then the
> problem description is probably the same...

This is the original code:

	function handler_getFromTableList($tableList)	{

		$key = $tableList;

		if (!isset($this->cache_handlerKeyFromTableList[$key]))	{

				// Get tables separated:
			$_tableList = $tableList;
			$tableArray = $this->SQLparser->parseFromTables($_tableList);

				// If success, traverse the tables:
			if (is_array($tableArray) && count($tableArray))	{
				foreach($tableArray as $vArray)	{

						// Find handler key, select "_DEFAULT" if none is specifically
configured:
					$handlerKey = $this->table2handlerKeys[$vArray['table']] ?
$this->table2handlerKeys[$vArray['table']] : '_DEFAULT';

						// In case of separate handler keys for joined tables:
					if ($outputHandlerKey && $handlerKey != $outputHandlerKey)	{



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.

Regards,


Oliver
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbal.diff
Type: text/x-patch
Size: 1309 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20080203/b635b7eb/attachment.bin 


More information about the TYPO3-team-core mailing list