[TYPO3-core] RFC: Bug #11166: loadPrototype() called in frontend editing without a valid doc instance.
Jeff Segars
jsegars at alumni.rice.edu
Wed May 27 22:10:42 CEST 2009
Hey guys,
This is a SVN patch request.
Type: Bugfix
Bugtracker reference: http://bugs.typo3.org/view.php?id=11166
Branch: trunk
Problem:
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 0010764: Use new JS-function for loading
prototype/scriptaculous/extJS which references $GLOBALS['SOBE']->doc
directly in tceforms. TCEForms may be used in the frontend or the
backend so when edit forms appear in a frontend context,
$GLOBALS['SOBE']->doc does not exist at all.
Solution:
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 (see
loadJavascriptLib). In this case, there's more logic in the actual
loading of prototype, scriptcaulous, and extJS 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.
Thanks,
Jeff
More information about the TYPO3-team-core
mailing list