Bug #59070

Bootstrap Invalid cache identifier

Added by Dirk Wenzel over 5 years ago. Updated about 5 years ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2014-05-23
Due date:
% Done:

0%

TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

After updating a TYPO3 instance from version 6.1.8 to 6.2.3 a call to \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadConfigurationAndInitialize() in a custom Ajax dispatcher crashes with the following debug message.

#1233057752: "" is not a valid cache entry identifier.

InvalidArgumentException thrown in file
/usr/local/share/php/typo3/typo3_src-6.2.3/typo3/sysext/core/Classes/Cache/Frontend/StringFrontend.php in line 73.

7 TYPO3\CMS\Core\Cache\Frontend\StringFrontend::get(NULL)

/usr/local/share/php/typo3/typo3_src-6.2.3/typo3/sysext/core/Classes/Package/PackageManager.php:

00258: $GLOBALS['TYPO3_currentPackageManager'] = $this;
00259: // Strip off PHP Tags from Php Cache Frontend

00260: $packageObjects = substr(substr($this->coreCache->get($packageCache['packageObjectsCacheEntryIdentifier']), 6), 0, -2);

00261: $this->packages = unserialize($packageObjects);
00262: foreach ($packageCache['activePackageKeys'] as $activePackageKey) {

6 TYPO3\CMS\Core\Package\PackageManager::loadPackageManagerStatesFromCache()

/usr/local/share/php/typo3/typo3_src-6.2.3/typo3/sysext/core/Classes/Package/PackageManager.php:

00125: $loadedFromCache = FALSE;
00126: try {

00127: $this->loadPackageManagerStatesFromCache();

00128: $loadedFromCache = TRUE;
00129: } catch (Exception\PackageManagerCacheUnavailableException $exception) {

5 TYPO3\CMS\Core\Package\PackageManager::initialize(TYPO3\CMS\Core\Core\Bootstrap)

/usr/local/share/php/typo3/typo3_src-6.2.3/typo3/sysext/core/Classes/Core/Bootstrap.php:

00312: $packageManager->injectCoreCache($this->getEarlyInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')->getCache('cache_core'));
00313: $packageManager->injectDependencyResolver(Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Package\\DependencyResolver'));

00314: $packageManager->initialize($this);

00315: Utility\GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Core\\Package\\PackageManager', $packageManager);
00316: return $this;

4 TYPO3\CMS\Core\Core\Bootstrap::initializePackageManagement("TYPO3\CMS\Core\Package\PackageManager")

/usr/local/share/php/typo3/typo3_src-6.2.3/typo3/sysext/core/Classes/Core/Bootstrap.php:

00231: $this->initializeCachingFramework()
00232: ->initializeClassLoaderCaches()

00233: ->initializePackageManagement($packageManagerClassName)

00234: ->initializeRuntimeActivatedPackagesFromConfiguration();
00235:

3 TYPO3\CMS\Core\Core\Bootstrap::loadConfigurationAndInitialize()

[...]typo3conf/ext/placements/Classes/Utility/EidDispatcher.php:

00109: $TSFE->initTemplate();
00110: $TSFE->getConfigArray();

00111: \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadConfigurationAndInitialize();

History

#1 Updated by Philipp Gampe over 5 years ago

  • Status changed from New to Needs Feedback

Please specify your PHP version and server OS. Did you reload the webserver to avoid any OpCode caches?

#2 Updated by Dirk Wenzel over 5 years ago

System: Debian Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.57-3+deb7u1 x86_64
PHP-Version: 5.4.4-14+deb7u9
Webserver: Apache 2.2.22
OpCode Cache: There is an XCache Modul (Version 2.0.0). The cache has been initialized. A reload of the webserver did not change anything either.
Disabled PHP functions: pcntl_alarm pcntl_fork pcntl_waitpid pcntl_wait pcntl_wifexited pcntl_wifstopped pcntl_wifsignaled pcntl_wexitstatus pcntl_wtermsig pcntl_wstopsig pcntl_signal pcntl_signal_dispatch pcntl_get_last_error pcntl_strerror pcntl_sigprocmask pcntl_sigwaitinfo pcntl_sigtimedwait pcntl_exec pcntl_getpriority pcntl_setpriority

I also cleared the PHP opcode cache via install tool.

#3 Updated by Klaus no-lastname-given over 5 years ago

I can confirm this behaviour.

If you set in Core/Bootstrap.php $allowCaching to FALSE instead of TRUE (line 225)

public function loadConfigurationAndInitialize($allowCaching = FALSE, ...

it will work.

a function call with

\TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadConfigurationAndInitialize(FALSE, 'TYPO3\\CMS\\Core\\Package\\PackageManager');

will not help.

I've seen also the function annotation '@internal This is not a public API method, do not use in own extensions' ;) But how to build an eID Dispatcher without bootstrap??

#4 Updated by Thomas no-lastname-given over 5 years ago

Same here, I tried this: http://stackoverflow.com/questions/21139769/typo3-extbase-ajax-without-page-typenum

It works if I change allowCaching to TRUE as mentioned above.

public function loadConfigurationAndInitialize($allowCaching = FALSE, ...

But then, I had to change it back because I couldn't open the Install Tool (Lock Cache Error or smth.).

#5 Updated by Klaus no-lastname-given over 5 years ago

If I change the code in the dispatcher from

\TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadConfigurationAndInitialize

to

\TYPO3\CMS\Core\Core\Bootstrap::getInstance()

it works for me. Can someone confirm this?

#6 Updated by Dirk Wenzel over 5 years ago

Hi Klaus,
I can confirm that this

\TYPO3\CMS\Core\Core\Bootstrap::getInstance()

works!

Thank you very much.

By the way: I guess that the script which I am using is yours (Extbase Dispatcher for Ajax Calls TYPO3 6.1 namespaces from Klaus Heuer). If this is the case - why does it work without (...)->loadConfigurationAndInitialize? Are there any pitfalls omitting it?

And for the records:
There is a warning

PHP Warning: Invalid argument supplied for foreach() in /usr/local/share/php/typo3/typo3_src-6.2.3/typo3/sysext/core/Classes/Utility/RootlineUtility.php line 269

when the Dispatcher is called directly after clearing General and Frontend Cache. It occurs on
$TSFE->determineId();

But this is probably off topic.

Cheers
Dirk

#7 Updated by Klaus no-lastname-given over 5 years ago

Hi Dirk and all,

thank for confirmation - and yes, the script you mentioned is from me ;)

As far as see, there are not any pitfalls, but I didn't tested it in detail until now. However, some other things can be cleared up (e.g. a conect to DB is with 6.1/6.2 not neccessary as I understood) and maybe we have a chance to work now even with mapped tables - which failed in the past. But I think this will be offtopic here...

Adressed to Phillip:
I think we can close this here. But I'm still a litle bit wondering, than an eID Ajax dispatcher (which is widely used) not described in any core documents (as far as I know). Developers have to pick-it-up at stackoverflow or on private blogs but not in the typo3 docs. I'm not a core developer, I write extensions, but if someone with a 'core-background' can assist, my help is shure and maybe we have some days an proved, offical ajax eID solution ;)

PS: I'm not a ghostwriter here, I just didn't find a profil edit function to edit an last name;)

Greetings
Klaus

#8 Updated by Dirk Wenzel over 5 years ago

Hi Klaus, hi all,
thank you again for your quick assistance.
I would gladly help testing and improving your eID Ajax dispatcher solution.
I had to set it up in a number of projects and each time I had to search the internet for a solution.

My proposal:
Let's implement a working eID Ajax dispatcher as an extension. This extension could even be included as sys extension but not installed per default.

There is quite a good solution in pt_extbase already (which is running under TYPO3 v6.2). As far as I can see it consists in only two scripts. But I hesitate to use it in my projects since pt_extbase brings a lot more stuff (which can break).

Cheers
Dirk

#9 Updated by Helmut Hummel about 5 years ago

Klaus no-lastname-given wrote:

I've seen also the function annotation '@internal This is not a public API method, do not use in own extensions' ;) But how to build an eID Dispatcher without bootstrap??

You don't do it ;)

#10 Updated by Helmut Hummel about 5 years ago

  • Status changed from Needs Feedback to Rejected

Klaus no-lastname-given wrote:

I think we can close this here. But I'm still a litle bit wondering, than an eID Ajax dispatcher (which is widely used) not described in any core documents (as far as I know). Developers have to pick-it-up at stackoverflow or on private blogs but not in the typo3 docs. I'm not a core developer, I write extensions, but if someone with a 'core-background' can assist, my help is shure and maybe we have some days an proved, offical ajax eID solution ;)

This is not "official" and not "eID", but a solution far superior to "manual eID dispatching":

http://typo3.helmut-hummel.de/post/90365109335/out-of-bound-typoscript-rendering
http://typo3.helmut-hummel.de/post/93417538000/ajax-examples-for-out-of-bound-typoscript-rendering
http://typo3.helmut-hummel.de/post/93491210285/url-generation-and-plugin-rendering-in-typo3-cms
http://typo3.helmut-hummel.de/post/93861037135/the-tale-of-eid-performance

The basic concept I present there by using a hook would work with TYPO3 versions at least down to 4.0
(It currently does not because I use namespaces and rely on cHash for "authenticating" the request).

No usage of private API, and even improved performance over eID for the use case described here.
I could imagine that this (or something similar) could end up in the core, but you can use it now as is and it will continue working in future TYPO3 versions without (or with very few adaptation).

I will close this ticket now as suggested.

PS: I'm not a ghostwriter here, I just didn't find a profil edit function to edit an last name;)

You can edit your profile on http://typo3.org/my-account/edit-personal-data/ (First name and last name are taken from the name field)
Then log out and log into forge again.

#11 Updated by Dirk Wenzel about 5 years ago

Helmut Hummel wrote:

Klaus no-lastname-given wrote:

I've seen also the function annotation '@internal This is not a public API method, do not use in own extensions' ;) But how to build an eID Dispatcher without bootstrap??

You don't do it ;)

This annotation is not reflected in the public available API documentation under api.typo3.org (http://typo3.org/api/typo3cms/class_t_y_p_o3_1_1_c_m_s_1_1_core_1_1_core_1_1_bootstrap.html#a3967ec2bccd66f3a9de5bcb7ec32dee3). I.e. as a developer I will have to lookup each method in the source code... Umh!

Anyway - thank you all for digging into this and especially to Helmut for providing so much further information.
Cheers Dirk

#12 Updated by Helmut Hummel about 5 years ago

Dirk Wenzel wrote:

This annotation is not reflected in the public available API documentation under api.typo3.org I.e. as a developer I will have to lookup each method in the source code... Umh!

I agree, that official API has to be documented better. We are getting better in that, but there is still a lot of legacy code where it is not clear, what is internal and what public API

Also available in: Atom PDF