Cubus Arts Blog

/ javascript
Andreas Philippi

Typo3 TMENU_LAYERS generates endless recursion loop

Andreas Philippi

What happens?

You have a typo3-template which uses TMENU_LAYERS. You may notice that you’ll get “too much recursion” javascript-errors on all browsers.

microtime is not enough :)

This errors happens because of a unique-ID-generating-function uses microtime. On some machines the microtime-based function does not provide unique IDs.

Under certain conditions, when using TMENU_LAYERS the layers containing the navigation items get non-unique IDs.

We noticed this error after migrating several sites in a virtualized environment on a very fast machine.

our solution

To correct this error we used the php-function uniqid to give us unique ids.

We proceeded this way:

  • locate the file /typo3/sysext/cms/tslib/media/scripts/tmenu_layers.php
  • search for the string: substr(md5(microtime()),0,6);
  • replace the string using: str_replace(‘.’,‘’,uniqid(‘’,true));

We also filed a bug