[TYPO3-Solr] tslib_cObj exception in Template.php

Jan Slusarczyk jan.slusarczyk at gmail.com
Wed Jun 17 13:22:00 CEST 2015


After upgrading to typo3 6.2.13 I've noticed that search (solr 3.1.0 dev 
from git) stopped working and throws the following exception:

#1: PHP Catchable Fatal Error: Argument 1 passed to 
Tx_Solr_Template::__construct() must be an instance of tslib_cObj, 
instance of TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer 
given, called in 
/var/www/typo3_src-6.2.13/typo3/sysext/core/Classes/Utility/GeneralUtility.php 
on line 4442 and defined in typo3conf/ext/solr/Classes/Template.php line 
61 (More information)

TYPO3\CMS\Core\Error\Exception thrown in file
/typo3_src-6.2.13/typo3/sysext/core/Classes/Error/ErrorHandler.php in 
line 101.

27 TYPO3\CMS\Core\Error\ErrorHandler::handleError(4096, "Argument 1 
passed to Tx_Solr_Template::__construct…tility/GeneralUtility.php on 
line 4442 and defined", "typo3conf/ext/solr/Classes/Template.php", 61, 
array)

typo3conf/ext/solr/Classes/Template.php:
00059:   * @param string name of the subpart to work on
00060:   */
00061:  public function __construct(tslib_cObj $contentObject, 
$templateFile, $subpart) {
00062:   $this->cObj = $contentObject;
00063:   $this->templateFile = $templateFile;


I am far from calling myself a programmer but compared the __construct 
function with other extensions and changed line 61 from:

lines 54 - 61
	/**
	 * Constructor for the html marker template engine.
	 *
	 * @param	tslib_cObj	content object
	 * @param	string	path to the template file
	 * @param	string	name of the subpart to work on
	 */
	public function __construct(tslib_cObj $contentObject, $templateFile, 
$subpart) {


to:

lines 54 - 61
/**
* Constructor for the html marker template engine.
*
* @param tslib_cObj content object
* @param string path to the template file
* @param string name of the subpart to work on
*/
public function __construct( $contentObject, $templateFile, $subpart) {

by removing the type in function parameters. The search seems to be 
working great. Did I introduce any potential problems? Does it make any 
sense?

I'm on php 5.5 and ubuntu 14.04 lts...
Regards
Jan


More information about the TYPO3-project-solr mailing list