Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.2.1] Deleting new entry crashes w/404 #4557

Closed
narration-sd opened this issue Jul 13, 2019 · 4 comments
Closed

[3.2.1] Deleting new entry crashes w/404 #4557

narration-sd opened this issue Jul 13, 2019 · 4 comments

Comments

@narration-sd
Copy link
Contributor

Description

This appears it may be quite related to #4554

Steps to reproduce

  1. devMode true, to observe trace
  2. Create a New entry
  3. Go immediately to the pencil icon, and chose to delete it
  4. get 404 Stack trace as follows:
1. in /home/vagrant/lv-ngatsby/vendor/craftcms/cms/src/controllers/EntriesController.phpat line 562
553554555556557558559560561562563564565566567568569570571                $variables['entry'] = Entry::find()
                    ->id($variables['entryId'])
                    ->structureId($structureId)
                    ->siteId($site->id)
                    ->anyStatus()
                    ->one();
            }
 
            if (!$variables['entry']) {
                throw new NotFoundHttpException('Entry not found');
            }
        }
 
        // Determine whether we're showing the site label & site-specific entry status
        // ---------------------------------------------------------------------
 
        // Show the site label in the revision menu as long as the section is enabled for multiple sites,
        // even if the entry itself is only enabled for one site
        $variables['showSiteLabel'] = (
2. in /home/vagrant/lv-ngatsby/vendor/craftcms/cms/src/controllers/EntriesController.php at line 81– craft\controllers\EntriesController::_prepEditEntryVariables(['sectionHandle' => 'cheesePlates', 'entryId' => 352, 'draftId' => null, 'revisionId' => null, ...])
75767778798081828384858687 
            if (!$variables['site']) {
                throw new NotFoundHttpException('Invalid site handle: ' . $siteHandle);
            }
        }
 
        $this->_prepEditEntryVariables($variables);
 
        $this->getView()->registerAssetBundle(EditEntryAsset::class);
 
        /** @var Site $site */
        $site = $variables['site'];
        /** @var Entry $entry */
3. craft\controllers\EntriesController::actionEditEntry('cheesePlates', 352, null, null, ...)
4. in /home/vagrant/lv-ngatsby/vendor/yiisoft/yii2/base/InlineAction.php at line 57– call_user_func_array([craft\controllers\EntriesController, 'actionEditEntry'], ['cheesePlates', '352', null, null, ...])
5. in /home/vagrant/lv-ngatsby/vendor/yiisoft/yii2/base/Controller.php at line 157– yii\base\InlineAction::runWithParams(['section' => 'cheesePlates', 'entryId' => '352', 'slug' => ''])
6. in /home/vagrant/lv-ngatsby/vendor/craftcms/cms/src/web/Controller.php at line 187– yii\base\Controller::runAction('edit-entry', ['section' => 'cheesePlates', 'entryId' => '352', 'slug' => ''])
181182183184185186187188189190191192193    /**
     * @inheritdoc
     */
    public function runAction($id, $params = [])
    {
        try {
            return parent::runAction($id, $params);
        } catch (\Throwable $e) {
            if (Craft::$app->getRequest()->getAcceptsJson()) {
                Craft::$app->getErrorHandler()->logException($e);
                if (!YII_DEBUG && !$e instanceof UserException) {
                    $message = Craft::t('app', 'An unknown error occurred.');
                } else {
7. in /home/vagrant/lv-ngatsby/vendor/yiisoft/yii2/base/Module.php at line 528– craft\web\Controller::runAction('edit-entry', ['section' => 'cheesePlates', 'entryId' => '352', 'slug' => ''])
8. in /home/vagrant/lv-ngatsby/vendor/craftcms/cms/src/web/Application.php at line 298– yii\base\Module::runAction('entries/edit-entry', ['section' => 'cheesePlates', 'entryId' => '352', 'slug' => ''])
292293294295296297298299300301302303304     * @param string $route
     * @param array $params
     * @return Response|null The result of the action, normalized into a Response object
     */
    public function runAction($route, $params = [])
    {
        $result = parent::runAction($route, $params);
 
        if ($result !== null) {
            if ($result instanceof Response) {
                return $result;
            }
 
9. in /home/vagrant/lv-ngatsby/vendor/yiisoft/yii2/web/Application.php at line 103– craft\web\Application::runAction('entries/edit-entry', ['section' => 'cheesePlates', 'entryId' => '352', 'slug' => ''])
10. in /home/vagrant/lv-ngatsby/vendor/craftcms/cms/src/web/Application.php at line 283– yii\web\Application::handleRequest(craft\web\Request)
277278279280281282283284285286287288289        if (($response = $this->_processActionRequest($request)) !== null) {
            return $response;
        }
 
        // If we're still here, finally let Yii do it's thing.
        try {
            return parent::handleRequest($request);
        } catch (\Throwable $e) {
            $this->_unregisterDebugModule();
            throw $e;
        }
    }
 
11. in /home/vagrant/lv-ngatsby/vendor/yiisoft/yii2/base/Application.php at line 386– craft\web\Application::handleRequest(craft\web\Request)
12. in /home/vagrant/lv-ngatsby/web/index.php at line 21– yii\base\Application::run()
15161718192021    (new Dotenv\Dotenv(CRAFT_BASE_PATH))->load();
}
 
// Load and run Craft
define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production');
$app = require CRAFT_VENDOR_PATH.'/craftcms/cms/bootstrap/web.php';
$app->run();
$_COOKIE = [
    'CRAFT_CSRF_TOKEN' => '44581235d47e9dad0ac84055b28ca9d82ebff44adea3e15ad93cbbb2c8b6f9d7a:2:{i:0;s:16:"CRAFT_CSRF_TOKEN";i:1;s:208:"6gpwoOB9YsRmf_IWW1TUbTx3XYBmbyJp9yelFlpL|ac0b7a2295d1043c6f7ab7a054d15b6c6ea580568c33e7bf4c61b6b3c914f1636gpwoOB9YsRmf_IWW1TUbTx3XYBmbyJp9yelFlpL|1|$2y$13$zvXfvDDXj.BP7WLnBDZT6utGx8sJBt5a.GcCfYSUbrpnNKudGathS";}',
    '1031b8c41dfff97a311a7ac99863bdc5_username' => '7ed8423d1b27863dda5bcdb49d6a15966f0b582e133896937de3b224332f2a2ca:2:{i:0;s:41:"1031b8c41dfff97a311a7ac99863bdc5_username";i:1;s:5:"admin";}',
    'CraftSessionId' => '40gb7fp3oa0kq9m6ufjfclovq4',
    '1031b8c41dfff97a311a7ac99863bdc5_identity' => 'f9bd4c250f9f44218a6f9935e4f34914d6ef8171151abb97f0a89d2946251e47a:2:{i:0;s:41:"1031b8c41dfff97a311a7ac99863bdc5_identity";i:1;s:242:"["1","[\\"6RbYMAh7hBn83Ux_fOGEWbLnm5woxYEhwcJXpUEKT9K23BhLD5nznl4xW0N_Cap6mYyPjfdy5M_qwBg8MghCJ7aMN6TvTdXM4mND\\",null,\\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3852.0 Safari/537.36\\"]",3600]";}',
    '__stripe_mid' => '5127394b-9cf0-4812-befa-3d89c82e7351',
    '__stripe_sid' => '4afae3fa-4e55-4388-8b8e-9d2426adbed2',
];

$_SESSION = [
    'bd62416aa8538ede709019a5e113eea5__flash' => [
        'notice' => -1,
    ],
    '1031b8c41dfff97a311a7ac99863bdc5__token' => '6RbYMAh7hBn83Ux_fOGEWbLnm5woxYEhwcJXpUEKT9K23BhLD5nznl4xW0N_Cap6mYyPjfdy5M_qwBg8MghCJ7aMN6TvTdXM4mND',
    '1031b8c41dfff97a311a7ac99863bdc5__id' => '1',
    '1031b8c41dfff97a311a7ac99863bdc5__expire' => 1563055409,
    'bd62416aa8538ede709019a5e113eea5__auth_access' => [
        'previewElement:19',
        'saveAssetInVolume:1',
        'previewDraft:114',
        'previewDraft:115',
        'previewDraft:116',
    ],
    'notice' => 'Draft deleted',
];
Yii Framework
2019-07-13, 14:03:29

nginx/1.15.8

Yii Framework/2.0.21

Additional info

PHP version 7.1.28
OS version Linux 4.15.0-47-generic
Database driver & version MySQL 5.7.25
Image driver & version GD 7.1.28
Craft edition & version Craft Pro 3.2.1
Yii version 2.0.21
Twig version 2.11.3
Guzzle version 6.3.3
Imagine version 0.7-dev
CraftQL 1.3.2
Element API 2.5.4
Redactor 2.3.3.2
@brandonkelly
Copy link
Member

The Delete link shouldn’t have been there in the first place, when editing an unsaved draft. Until you click “Save entry”, the draft you are editing is ephemeral, so there’s no need to explicitly delete it.

@narration-sd
Copy link
Contributor Author

Quite so, and thanks for fix.

I'll move composer over to dev-master to start picking these up, as it helps on the other factor.

@narration-sd
Copy link
Contributor Author

narration-sd commented Jul 14, 2019

A smaller thing here, unless you want a separate issue for it:

  • the 'saved' little green checkmark comes on for a new entry, as soon as you type a first letter of content into it; no preview needed for this one.

[deleted]

@narration-sd
Copy link
Contributor Author

narration-sd commented Jul 14, 2019

Ach, writing too fast while thinking of other things - only one minor issue remains, edited out the extra duplication just now...I need to get on that dev-master so I don't see these things, fast as you fix'em ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants