Bug #20489

loadPrototype() called in frontend editing without a valid doc instance.

Added by Jeff Segars almost 12 years ago. Updated over 10 years ago.

Should have
Target version:
Start date:
Due date:
% Done:


Estimated time:
TYPO3 Version:
PHP Version:
Is Regression:
Sprint Focus:


When using frontend editing with the edit forms appearing directly on the page (and not in a popup) the following fatal error is generated.

PHP Fatal error: Call to a member function loadPrototype() on a non-object in /Users/jsegars/Sites/typo3_src/trunk/t3lib/class.t3lib_tceforms.php on line 5136

This was caused by RFC #20229: Use new JS-function for loading prototype/scriptaculous/extJS which references $GLOBALS['SOBE']->doc directly in tceforms, which may be used in the frontend or the backend. When edit forms appear directly on the page, $GLOBALS['SOBE']->doc does not exist at all.

The most obvious solution was to add wrapper for the offending calls in t3lib_tceforms_fe as we've done in the past to handle the different methods of loading Javascript in the frontend and backend. In this case, there's more logic in the actual loading so a simple wrapper isn't the best solution.

We've seen this sort of problem pop up several times now, so I think the best solution is create a dummy instance of $GLOBALS['SOBE']->doc in the frontend context so that we don't have to worry about frontend or backend when using tceforms. The attached patch adds a new tsfeDoc to typo3/template.php and creates a dummy version of $GLOBALS['SOBE'] within tceforms_fe.

The only potential compatibility issue is that tceforms no longer includes tceforms_fe. This inclusion was for compatibility reasons, as tceforms and tceforms_fe used to be a part of the same file. Keeping the inclusion meant tceforms_fe was always included in the backend context and defining $GLOBALS['SOBE'] there caused lots of errors. With the addition of the autoloader recently, this change may not even be the minor issue that I originally thought it was :)

(issue imported from #M11166)


0011166.diff (3.32 KB) 0011166.diff Administrator Admin, 2009-05-22 17:11
0011166_v2.diff (2.73 KB) 0011166_v2.diff Administrator Admin, 2009-05-27 22:07
0011166_v3.patch (3.08 KB) 0011166_v3.patch Administrator Admin, 2009-05-28 08:36

Related issues

Related to TYPO3 Core - Bug #20229: Use new JS-function for loading prototype/scriptaculous/extJSClosedSteffen Kamper2009-03-23


Updated by Jeff Segars almost 12 years ago

Added v2 patch that applies cleanly to trunk. The concerns above about removing tceforms_fe inclusion within tceforms are no longer valid thanks to the autoloader.


Updated by Jeff Segars almost 12 years ago

Committed Olly's v3 patch to trunk in r5513.

Also available in: Atom PDF