Bug #20390
closedWarning is issued when creating first template
0%
Description
When creating the very first template a warning is issued (at least when Oracle is used):
Warning: Invalid argument supplied for foreach() in /var/www/typo3_src-trunk/t3lib/cache/backend/class.t3lib_cache_backend_dbbackend.php on line 170
Example how to reproduce:
- Have a blank website
- Create a page under root
- Click Web > Template
- Click button "Create template for a new site"
Solution:
Test that the returned value from $GLOBALS['TYPO3_DB']->exec_SELECTgetRows is an array before trying to iterate over it.
(issue imported from #M11027)
Files
Updated by Xavier Perseguers about 14 years ago
Quoting Rupert in Core mailing list:
the problem you described was caused by a tcemain action (saving a
tstemplate record) which called flushByTag() to clear a nonexisting
page_cache entry.
flushByTag() looked like this until #20581 was commited:
....
public function flushByTag($tag) {
foreach ($this->findIdentifiersByTag($tag) as $entryIdentifier) {
$this->remove($entryIdentifier);
}
}
now it looks like this:
public function flushByTag($tag) {
$GLOBALS['TYPO3_DB']->exec_DELETEquery(
$this->cacheTable,
$this->getListQueryForTag($tag)
);
}
this works way faster and should fix also #20581, because
findIdentifiersByTag() is not called anymore.