März 9, 2010

TYPO3 4.3 deprecated methods

Filed under: Typo3 — Schlagwörter: — paddy @ 6:55 pm

Upgrading to TYPO3 4.3 causes typo3 to write every call to a deprecated method to a file called deprecation_XXXXXXXXXX.log in the typo3conf folder. This kind of sucks and the file gets quite long. I found that main cause for this annoying behaviour are two function calls from extensions: »makeInstanceClassName« and »GPvar«. Either you upgrade all your extensions hoping the upgrade fixes the Problem or just perform the following in your ext folder. Make sure you backup all your extensions before you just copy paste!

grep -rl makeInstanceClassName * | grep ‚\.php$‘ | grep -v ‚/\.svn/‘ | xargs sed -i -e „s/makeInstanceClassName/makeInstance/g“
grep -rl GPvar * | grep ‚\.php$‘ | grep -v ‚/\.svn/‘ | xargs sed -i -e „s/GPvar/_GP/g“

If you want to make sure not to break anything just dry run the following two lines and read the output before you perform the two lines mentioned above:

grep -r makeInstanceClassName * | grep ‚\.php$‘ | grep -v ‚/\.svn/‘
grep -r GPvar * | grep ‚\.php$‘ | grep -v ‚/\.svn/‘

3 Kommentare »

  1. Hi,

    usually you’d like to keep compatibility with older TYPO3 versions – therefore replacing the makeInstanceClassName directly with makeInstance might not be the best choice.

    I’d suggest to transform such blocks:

    $className = t3lib_div::makeInstanceClassName(‘tx_myext_class’);
    $object = new $className($arg1, $arg2);

    into something like this:

    if (version_compare(TYPO3_version,'4.3','>')) {
      $object = t3lib_div::makeInstance('tx_myext_class', $arg1, $arg2);
    } else {
      $className = t3lib_div::makeInstanceClassName('tx_myext_class');
      $object = new $className($arg1, $arg2);

    This way you make sure that the deprecation.log doesn’t fill up and you can still use this extension for older TYPO3 versions.


    Kommentar by Tolleiv — April 2, 2010 @ 4:38 pm

  2. In most cases the workaround of Tolleiv is not necessary t3 moves forward not backward and I experienced 99,9% failsafeness doing so. Mark my words Make a backup!. In case you face difficulties you should seriously consider to get rid of the extension you are using (to say it might have other lacks also including security).

    Kommentar by paddy — April 2, 2010 @ 5:27 pm

  3. use insted of

    if (version_compare(TYPO3_version,’4.3′,’>‘)) {

    if (version_compare(TYPO3_version,’4.3′,’>=‘)) {

    Kommentar by informant — April 14, 2011 @ 4:22 pm

RSS-Feed für Kommentare zu diesem Artikel. TrackBack URL

Schreib einen Kommentar