[TYPO3-core] RFC #16970: Backwards compatibility in PHP_SCRIPT and accessing $this-> methods

Ernesto Baschny [cron IT] ernst at cron-it.de
Tue Jan 11 18:57:16 CET 2011


Hi,

This is a SVN patch request.

Type: Bugfix (backwards compatibility)

BT reference: http://bugs.typo3.org/view.php?id=16970

Branches: trunk

Problem:
Older sites might include PHP_SCRIPT cObject accessing cObject methods
and properties through $this, expecting the current context to be "cObject".

Since the PHP_SCRIPT object was moved to its own class, the old methods
will stop working (e.g. older "languageMenu.php" or stuff like
http://www.sk-typo3.de/awstats-Zaehlen-von-Dateidownloads.55.0.html).

Solution:
Solution is to add a __call() and __get() catch-all to PHP_SCRIPT
intercepting those calls and passing them to $this->cObj, while making a
note of it in deprecation log.

How to test:

Create a fileadmin/test.php:

<?
$content .= '<pre>'.print_r($this->align, true).'</pre>';
$content .= $this->typolink('Link', array('parameter' =>
$GLOBALS['TSFE']->id));
?>

Access it through TypoScript with something like:

page.10 = PHP_SCRIPT
page.10.file = fileadmin/test.php

See if fail with current trunk (Call to undefined method
tslib_content_PhpScript::typolink()). See it work again with the patch
applied.

Cheers,
Ernesto

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 16970.diff
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20110111/c170b141/attachment-0001.txt>


More information about the TYPO3-team-core mailing list