Bug #18761

"ADMCMD command could not be executed!" after preview link expired

Added by Christian Hennecke over 10 years ago. Updated about 1 year ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
Workspaces
Target version:
Start date:
2008-05-08
Due date:
% Done:

0%

TYPO3 Version:
4.2
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

I generate a preview link from a workspace and visited that link. After the link expired and the content was published, I got the following error on trying to access the live site:

"ADMCMD command could not be executed!"

Removing the cookies for the site solved the problem.

(issue imported from #M8352)


Related issues

Duplicated by TYPO3 Core - Bug #77569: Workspaces PReview Links: Live-Website is not shown anymore after ADMCMD_prev cookie is set once New 2016-08-22

History

#1 Updated by Tolleiv Nietsch over 7 years ago

  • Status changed from New to Needs Feedback
  • Target version deleted (0)

What's the actual issue? That the link was expired or that you saw a page even after the link expired?

#2 Updated by Christian Hennecke over 7 years ago

Tolleiv Nietsch wrote:

What's the actual issue? That the link was expired or that you saw a page even after the link expired?

The problem is that I get an error message when visiting a page of the LIVE site that had been edited in a workspace before. The expected behaviour would be that the system displays the live version.

#3 Updated by Martin Holtz over 7 years ago

i just had the same issue in a test installation (4.5.3).
A few days ago i tried different settings with the workspaces. Today i logged in, just tried to show the page and got that error.

Sorry, i did not checked the cookie, just deleted it. Now everything works fine.

#4 Updated by Tolleiv Nietsch almost 7 years ago

Sorry I'm not able to reproduce this - is this still valid?

#5 Updated by Jan Boysen over 6 years ago

Tolleiv Nietsch wrote:

Sorry I'm not able to reproduce this - is this still valid?

Hi..

I just was able to reproduce it ( at least some kind as the error is different, but seems related to it ).
( Typo3 version 4.6.7 )
Here are the steps:

- Created a new Workspace
- Modified some things in the workspace
- Generated a preview link for that workspace
- After the Link has expired the entire frontend just shows "Oops, an error occurred!"
- Removing the coockie named ADMCMD_prev everything is ok again.

The coockie:
Name: ADMCMD_prev
Content: 5868c49194cb392b306678d1a51a6b6f
Domain: ********
Path: /
Send For: Any kind of connection
Accessible to Script: Yes
Created: Sunday, April 8, 2012 5:06:59 PM
Expires: When I close my browser

So the bugfix in my eyes would be so set a specific expiredate for the coockie and not "When I close my browser" as I did not close my entire Browser, which in real happens maybe once a week or even more seldom.

#6 Updated by Lars Houmark almost 6 years ago

Still a problem with 4.7.x and I can confirm the same symptoms as prior comments.

After deleting the cookie, the site works again.

A solution could be to either put the expiry time on the cookie to be the same as the preview link or a better verification of the cookie by TYPO3 when it's evaluation it.

This is some advanced ** but hopefully I can look into a patch soon. Anyone else wants to help out?

#7 Updated by Martin Terber over 5 years ago

Got that error in 4.5.29, Chrome 19, but not n Firefox. Same symptoms as above. Removing cookies solved the problem.

#8 Updated by Christoph Holtermann about 5 years ago

I got the same problem today.

Chrome works ( 30.0.1553.0 (209444), there was no cookie set )
Firefox ( 24.0 ) does not.

Typo3 4.7.15

Steps: Installing workspaces extension, followed a preview link some days ago. Afterwards
regular browsing of the site without using that link again.

Cookie ADMCMD_prev. Removal led to normal function.

-> Why does a cookie change the behaviour of my browser when I just visit the same
site ?

debug log:

13-10-17 21:00:45 FATAL    Core: Exception handler (WEB) Uncaught TYPO3 Exception: #1294585192: ADMCMD command could not be executed! (No keyword configuration found) | Exception thrown in file /var/www/web0/html/Typo3/typo3_src-4.7.15/typo3/sysext/version/Classes/Preview.php in line 226. Requested URL: http://www.jungmedizinerforum.org/
    TYPO3_MODE => FE
    backtrace => array (
       0 => array (
          file => /var/www/web0/html/Typo3/typo3_src-4.7.15/typo3/sysext/version/Classes/Preview.php
          line => 64

          function => getPreviewConfiguration
          class => Tx_Version_Preview
          type => ->
          args => array (
          )
       )
       1 => array (
          function => checkForPreview
          class => Tx_Version_Preview
          type => ->
          args => array (
             0 => array (
                pObj => object: tslib_fe
             )
             1 => object: tslib_fe
          )
       )
       2 => array (
          file => /var/www/web0/html/Typo3/typo3_src-4.7.15/t3lib/class.t3lib_div.php
          line => 4668
          function => call_user_func_array
          args => array (
             0 => array (
                0 => object: Tx_Version_Preview
                1 => checkForPreview
             )
             1 => array (
                0 => array (
                   pObj => object: tslib_fe
                )
                1 => object: tslib_fe
             )
          )
       )
       3 => array (
          file => /var/www/web0/html/Typo3/typo3_src-4.7.15/typo3/sysext/cms/tslib/class.tslib_fe.php
          line => 389
          function => callUserFunction
          class => t3lib_div

          type => ::
          args => array (
             0 => EXT:version/Classes/Preview.php:Tx_Version_Preview->checkForPreview
             1 => array (
                pObj => object: tslib_fe
             )
             2 => object: tslib_fe
          )
       )
       4 => array (
          file => /var/www/web0/html/Typo3/typo3_src-4.7.15/typo3/sysext/cms/tslib/index_ts.php
          line => 185
          function => connectToDB
          class => tslib_fe
          type => ->
          args => array (
          )
       )
       5 => array (
          file => /var/www/web0/html/Typo3/typo3_src-4.7.15/index.php
          line => 76
          args => array (
             0 => /var/www/web0/html/Typo3/typo3_src-4.7.15/typo3/sysext/cms/tslib/index_ts.php
          )
          function => require
       )
    )

#9 Updated by Michael Stucki about 5 years ago

  • Category set to Workspaces

#10 Updated by Michael Stucki about 5 years ago

  • Project changed from Workspaces & Versioning to TYPO3 Core
  • Category changed from Workspaces to Workspaces

#11 Updated by Andreas Siegel almost 5 years ago

I just had the same issue with TYPO3 6.1.7 and workspaces 6.1.0.

As in the other cases, removing the cookies solved the problem, but before the entire website was not available for about one day.

#12 Updated by Alexander Opitz almost 5 years ago

  • Status changed from Needs Feedback to New
  • Is Regression set to No

#13 Updated by Markus Timtner over 4 years ago

Still present in 6.2.*

The expected behaviour should be:
if hte cookie is not valid anymore,
just show the live site instead!

#14 Updated by Markus Timtner over 4 years ago

This fixes the problem, but I honestly don't know if this could have unwanted sideeffects:

typo3/sysext/version/Classes/Hook/PreviewHook.php
#198ff

            } else {
+                if (isset($_COOKIE['ADMCMD_prev'])) {
+                    unset($_COOKIE['ADMCMD_prev']);
+                }
-                // throw new \Exception('ADMCMD command could not be executed! (No keyword configuration found)', 1294585192);
            }

#15 Updated by Gerrit Code Review over 4 years ago

  • Status changed from New to Under Review

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30091

#16 Updated by Gerrit Code Review over 4 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30091

#17 Updated by Teamgeist Medien about 4 years ago

The above fix solves the problem for me. Thanks.

#18 Updated by Mathias Schreiber almost 4 years ago

  • Target version set to 7.5

#19 Updated by Benni Mack about 3 years ago

  • Target version changed from 7.5 to 7 LTS

#20 Updated by Gerrit Code Review about 3 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/30091

#21 Updated by Gerrit Code Review almost 3 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30091

#22 Updated by Robert Vock over 2 years ago

We added a hook to our base-setup to fix this issue until this bug gets fixed.

ext_localconf.php:

// **************
// Expired Preview links throw an exception. The only solution is to delete the cookie
// This is really user-unfriendly
// @see https://forge.typo3.org/issues/18761
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('version')) {
    array_unshift($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['connectToDB'], 'Vierwd\\VierwdBase\\Hooks\\VersioningHooks->removeExpiredPreviewCookie');
}

VersioningHooks.php

public function removeExpiredPreviewCookie() {
    if (isset($_COOKIE['ADMCMD_prev'])) {
        // check if the cookie is valid. if not, delete it
        $inputCode = $_COOKIE['ADMCMD_prev'];
        $where = 'keyword=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($inputCode, 'sys_preview') . ' AND endtime>' . $GLOBALS['EXEC_TIME'];
        $previewData = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'sys_preview', $where);
        if (!$previewData) {
            // remove cookie
            unset($_COOKIE['ADMCMD_prev']);
            setcookie('ADMCMD_prev', '', 0, GeneralUtility::getIndpEnv('TYPO3_SITE_PATH'));
        }
    }
}

#23 Updated by Gerrit Code Review about 2 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30091

#24 Updated by Gerrit Code Review almost 2 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30091

#25 Updated by Gerrit Code Review almost 2 years ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30091

#26 Updated by Jens Engelmann about 1 year ago

Is there any progress on that issue? We still experience the behaviour on 8.7 LTS installations.

Also available in: Atom PDF