Bug #25402

PHP Catchable Fatal Error: t3lib_iconWorks::mapRecordTypeToSpriteIconName()

Added by Sven Luzar over 6 years ago. Updated over 6 years ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2011-03-27
Due date:
% Done:

100%

TYPO3 Version:
4.6
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

The hook in line 865 passes an array to call a user function, but the method t3lib_div::callUserFunction needs a variable passed by reference. An easy fix is possible:

change line

$recordType6 = t3lib_div::callUserFunction($GLOBALS['TCA'][$table]['ctrl']['typeicon_classes']['userFunc'], array('row' => $row), $ref);

to lines

$param = array('row' => $row);
$recordType6 = t3lib_div::callUserFunction($GLOBALS['TCA'][$table]['ctrl']['typeicon_classes']['userFunc'], $param, $ref);

Stacktrace:

Fatal error: Cannot pass parameter 2 by reference in /usr/share/typo3/typo3_src-4.5.0/t3lib/class.t3lib_iconworks.php on line 853 Call Stack: 0.0035 655032
1. {main}() /usr/share/typo3/typo3_src-4.5.0/typo3/mod.php:0 0.2960 10854440
2. require('/usr/share/typo3/typo3_src-4.5.0/typo3/sysext/recordlist/mod1/index.php') /usr/share/typo3/typo3_src-4.5.0/typo3/mod.php:51 0.3188 12451960
3. SC_db_list->main() /usr/share/typo3/typo3_src-4.5.0/typo3/sysext/recordlist/mod1/index.php:514 0.3558 13210152
4. recordList->generateList() /usr/share/typo3/typo3_src-4.5.0/typo3/sysext/recordlist/mod1/index.php:310 0.4306 14338728
5. localRecordList->getTable() /usr/share/typo3/typo3_src-4.5.0/typo3/class.db_list.inc:303 0.4334 14379688 
6. localRecordList->renderListRow() /usr/share/typo3/typo3_src-4.5.0/typo3/class.db_list_extra.inc:553 0.4337 14381744
7. t3lib_iconWorks::getSpriteIconForRecord() /usr/share/typo3/typo3_src-4.5.0/typo3/class.db_list_extra.inc:670 0.4339 14382864
8. t3lib_iconWorks::mapRecordTypeToSpriteIconClass() /usr/share/typo3/typo3_src-4.5.0/t3lib/class.t3lib_iconworks.php:764 0.4339 14382864
9. t3lib_iconWorks::mapRecordTypeToSpriteIconName() /usr/share/typo3/typo3_src-4.5.0/t3lib/class.t3lib_iconworks.php:791

(issue imported from #M18046)

Associated revisions

Revision 191aa8ce (diff)
Added by Sven Luzar over 6 years ago

[BUGFIX] Fix PHP Catchable Fatal Error in t3lib_iconWorks

The hook in t3lib_iconWorks::mapRecordTypeToSpriteIconName() passes an
array to call a user function, but the method t3lib_div::callUserFunction
expects a variable being passed by reference.

Assigning the array to a variable fixes this error.

Thanks to Haymo Meran (Gentics) for sponsoring this fix with 80 beers
at the bug auction at T3BOARD11.

Change-Id: I445ae05aa79913cb152da06cc66941db3fdf9227
Resolves: #25402
Reviewed-on: http://review.typo3.org/1290
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader

Revision 48029690 (diff)
Added by Sven Luzar over 6 years ago

[BUGFIX] Fix PHP Catchable Fatal Error in t3lib_iconWorks

The hook in t3lib_iconWorks::mapRecordTypeToSpriteIconName() passes an
array to call a user function, but the method t3lib_div::callUserFunction
expects a variable being passed by reference.

Assigning the array to a variable fixes this error.

Thanks to Haymo Meran (Gentics) for sponsoring this fix with 80 beers
at the bug auction at T3BOARD11.

Change-Id: Ib0c0b2bd504fdbc346e8f70009bb60e82a66d8b0
Resolves: #25402
Reviewed-on: http://review.typo3.org/1378
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader

History

#1 Updated by Steffen Gebert over 6 years ago

Sven, can you provide an example how to reproduce this?

Review:
master: https://review.typo3.org/1290

#2 Updated by Sven Luzar over 6 years ago

First create a plugin. Add the following class:

class tx_my_typeicon {
public function main($row, $ref){
return "test";
}
}

and register the class in tca.php:

$TCA['tt_content']['ctrl']['typeicon_classes']['userFunc'] = 'EXT:myext/class.tx_my_typeicon.php:tx_my_typeicon->main';

#3 Updated by Steffen Gebert over 6 years ago

  • Target version deleted (0)

#4 Updated by Mr. Hudson over 6 years ago

Patch set 4 of change I445ae05aa79913cb152da06cc66941db3fdf9227 has been pushed to the review server.
It is available at http://review.typo3.org/1290

#5 Updated by Mr. Hudson over 6 years ago

Patch set 1 of change Ib0c0b2bd504fdbc346e8f70009bb60e82a66d8b0 has been pushed to the review server.
It is available at http://review.typo3.org/1378

#6 Updated by Mr. Hudson over 6 years ago

Patch set 5 of change I445ae05aa79913cb152da06cc66941db3fdf9227 has been pushed to the review server.
It is available at http://review.typo3.org/1290

#7 Updated by Mr. Hudson over 6 years ago

Patch set 6 of change I445ae05aa79913cb152da06cc66941db3fdf9227 has been pushed to the review server.
It is available at http://review.typo3.org/1290

#8 Updated by Mr. Hudson over 6 years ago

Patch set 2 of change Ib0c0b2bd504fdbc346e8f70009bb60e82a66d8b0 has been pushed to the review server.
It is available at http://review.typo3.org/1378

#9 Updated by Sven Luzar over 6 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF