Project

General

Profile

Actions

Bug #24539

closed

ExtDirect in frontend generates php warnings

Added by Jacob Rasmussen over 13 years ago. Updated about 13 years ago.

Status:
Closed
Priority:
Should have
Category:
Communication
Target version:
-
Start date:
2011-01-13
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

In class.tslib_extdirecteid.php the language object is instantiated without a language key, and as a result the error log gets filled with messages like this one:

Core: Error handler (FE): PHP Warning: Missing argument 1 for language::init(), called in /var/www/typo3_src/typo3_src-4.5.svn/typo3/sysext/cms/tslib/class.tslib_extdirecteid.php on line 51 and defined in /var/www/typo3_src/typo3_src-4.5.svn/typo3/sysext/lang/lang.php line 130

(issue imported from #M16994)


Files

Actions #1

Updated by Steffen Gebert over 13 years ago

Jacob, could you provide some code / test extension to reproduce?

Actions #2

Updated by Jacob Rasmussen over 13 years ago

Hi Steffen,

Of course :-)

I have created a small extension in order to try out the new Extbase and ExtJS ExtDirect functionalities - so in my ext_localconf.php I have the following line, to enable my ExtDirect handler:

$TYPO3_CONF_VARS['SC_OPTIONS']['ExtDirect']['TYPO3.LbInquiry.Form'] = 'EXT:lbinquiry/Classes/Ajax/class.tx_lbinquiry_extdirect.php:tx_LbInquiry_extdirect';

And in my index controller of the test extension:

$GLOBALS['TSFE']->getPageRenderer()->addJsFile('?eID=ExtDirect&action=getAPI&namespace=TYPO3.LbInquiry', NULL, FALSE);

Which initializes tslib_ExtDirectEid->routeAction. In this method $GLOBALS['LANG'] are instantiated and initialized through the init() method, but the init() method requires a language key - which isn't supplied, nor is it possible from the frontend to send a language key, so unless the site only uses one language - it will be impossible to guess which language is needed.

A solution could be to take the same approach as tslib_eidtools::initLanguage() which supplies the string 'default' as default - although it would be nice to send some parameter to the ExtDirect router, which initializes the right language based on the page which is currently displayed.

The problem doesn't show up when using ExtDirect in backend modules, as it doesn't use the eID call, but instead the ajax.php script.

I have used the following wikipost as an inspiration: http://wiki.typo3.org/wiki/ExtDirect

Actions #3

Updated by Steffen Gebert over 13 years ago

Maybe you could attach that extension? Sorry for lazyness, I didn't dig into FE-ExtDirect, yet.

Actions #4

Updated by Jacob Rasmussen over 13 years ago

Sure - although I'll just make another sample, as this extension have dependencies to an unreleased extension

Actions #5

Updated by Jacob Rasmussen over 13 years ago

I've just uploaded a very simple example, it should be enough for testing

Actions #6

Updated by Steffen Gebert over 13 years ago

Acknowledged. There's no error visible (and no output except the <script> in the header), but the error is visible in TYPO3's Log.

Actions #7

Updated by Stefan Galinski over 13 years ago

The attached patch should fix the issue, but the language is still initialized with the default language. Please report your test results and afterwards I will add this patch to the core list.

Actions #8

Updated by Jacob Rasmussen over 13 years ago

I thought about a solution last night, and I think the best way to go, is to let the developer call tslib_eidtools::initLanguage() in the extdirect handler script instead of in the routeAction method.
By doing so, the developer has the freedom to select which language it going to be initialized - if he/she needs the language object.

Actions #9

Updated by Stefan Galinski over 13 years ago

AFAIK this must be initialized in an early state, because something in the initialization requires the language object. I will check that this night again and if it's like this, I will add the patch to the core list.

Actions #10

Updated by Stefan Galinski over 13 years ago

The initial patch is on the core list now. At least it will fix the warning for now. Any other improvements for the language detection can be added later on. However you always can reinstantiate the language object with the correct language in your own code for now.

Actions #11

Updated by Ernesto Baschny over 13 years ago

Committed to rev. 10219.

Actions #12

Updated by Susanne Moog about 13 years ago

  • Target version deleted (4.5.0)
Actions

Also available in: Atom PDF