Dolphiq / craft-plugin-redirect

Craft 3 redirect plugin provides an easy way to enter and maintain 301 and 302 redirects and 404 pages. The plugin provides a clear user interface for admin and non-admin users.
MIT License
54 stars 34 forks source link

Integrity constraint violation #106

Open abinggeli opened 4 years ago

abinggeli commented 4 years ago

Hi,

Thank you for providing this plugin for free. After upgrading Craft CMS from version 3.1.x to 3.3.16.3 it seems that the plugin is no longer working properly. When updating an existing entry it throws an integrity constraint violation. When adding a new entry I get the message that the entry was successfully saved, but it doesn't appear in the list. No log entry could be found in this case. Existing redirect entries are still working.

Additional Info:

Craft CMS: 3.3.16.3 PRO Redirect plugin for Craft 3: 1.0.23 MySQL: 5.7.26

Stacktrace

2019-12-03 14:13:44 [-][1][pv875binuo8c8tp5n9h64a9p1m][error][yii\db\IntegrityException] PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'uid' cannot be null in /var/www/craft-prod/vendor/yiisoft/yii2/db/Command.php:1290 Stack trace:

0 /var/www/craft-prod/vendor/yiisoft/yii2/db/Command.php(1290): PDOStatement->execute()

1 /var/www/craft-prod/vendor/yiisoft/yii2/db/Command.php(1091): yii\db\Command->internalExecute('UPDATE `element...')

2 /var/www/craft-prod/vendor/yiisoft/yii2/db/ActiveRecord.php(332): yii\db\Command->execute()

3 /var/www/craft-prod/vendor/yiisoft/yii2/db/BaseActiveRecord.php(810): yii\db\ActiveRecord::updateAll(Array, Array)

4 /var/www/craft-prod/vendor/yiisoft/yii2/db/ActiveRecord.php(676): yii\db\BaseActiveRecord->updateInternal(NULL)

5 /var/www/craft-prod/vendor/yiisoft/yii2/db/BaseActiveRecord.php(681): yii\db\ActiveRecord->update(false, NULL)

6 /var/www/craft-prod/vendor/craftcms/cms/src/services/Elements.php(1960): yii\db\BaseActiveRecord->save(false)

7 /var/www/craft-prod/vendor/craftcms/cms/src/services/Elements.php(525): craft\services\Elements->_saveElementInternal(Object(dolphiq\redirect\elements\Redirect), true, false)

8 /var/www/craft-prod/vendor/dolphiq/redirect/src/controllers/SettingsController.php(337): craft\services\Elements->saveElement(Object(dolphiq\redirect\elements\Redirect), true, false)

9 [internal function]: dolphiq\redirect\controllers\SettingsController->actionSaveRedirect()

10 /var/www/craft-prod/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)

11 /var/www/craft-prod/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)

12 /var/www/craft-prod/vendor/craftcms/cms/src/web/Controller.php(187): yii\base\Controller->runAction('save-redirect', Array)

13 /var/www/craft-prod/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('save-redirect', Array)

14 /var/www/craft-prod/vendor/craftcms/cms/src/web/Application.php(299): yii\base\Module->runAction('redirect/settin...', Array)

15 /var/www/craft-prod/vendor/craftcms/cms/src/web/Application.php(565): craft\web\Application->runAction('redirect/settin...', Array)

16 /var/www/craft-prod/vendor/craftcms/cms/src/web/Application.php(278): craft\web\Application->_processActionRequest(Object(craft\web\Request))

17 /var/www/craft-prod/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))

18 /var/www/craft-prod/web/index.php(21): yii\base\Application->run()

19 {main}

roberttolton commented 4 years ago

Am also seeing this issue

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'uid' cannot be null in /vagrant/vendor/yiisoft/yii2/db/Command.php:1290
Stack trace:
#0 /vagrant/vendor/yiisoft/yii2/db/Command.php(1290): PDOStatement->execute()
#1 /vagrant/vendor/yiisoft/yii2/db/Command.php(1091): yii\db\Command->internalExecute()
#2 /vagrant/vendor/yiisoft/yii2/db/ActiveRecord.php(332): yii\db\Command->execute()
#3 /vagrant/vendor/yiisoft/yii2/db/BaseActiveRecord.php(810): yii\db\ActiveRecord::updateAll()
#4 /vagrant/vendor/yiisoft/yii2/db/ActiveRecord.php(676): yii\db\BaseActiveRecord->updateInternal()
#5 /vagrant/vendor/yiisoft/yii2/db/BaseActiveRecord.php(681): yii\db\ActiveRecord->update()
#6 /vagrant/vendor/craftcms/cms/src/services/Elements.php(1964): yii\db\BaseActiveRecord->save()
#7 /vagrant/vendor/craftcms/cms/src/services/Elements.php(529): craft\services\Elements->_saveElementInternal()
#8 /vagrant/vendor/dolphiq/redirect/src/controllers/SettingsController.php(337): craft\services\Elements->saveElement()
#9 [internal function]: dolphiq\redirect\controllers\SettingsController->actionSaveRedirect()
#10 /vagrant/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#11 /vagrant/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams()
#12 /vagrant/vendor/craftcms/cms/src/web/Controller.php(187): yii\base\Controller->runAction()
#13 /vagrant/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction()
#14 /vagrant/vendor/craftcms/cms/src/web/Application.php(299): yii\base\Module->runAction()
#15 /vagrant/vendor/craftcms/cms/src/web/Application.php(565): craft\web\Application->runAction()
#16 /vagrant/vendor/craftcms/cms/src/web/Application.php(278): craft\web\Application->_processActionRequest()
#17 /vagrant/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest()
#18 /vagrant/web/index.php(23): yii\base\Application->run()
#19 {main}

Next yii\db\IntegrityException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'uid' cannot be null
The SQL being executed was: UPDATE `craft_elements` SET `enabled`=1, `archived`=0, `dateUpdated`='2020-01-16 15:32:44', `uid`=NULL WHERE `id`=30179 in /vagrant/vendor/yiisoft/yii2/db/Schema.php:674
Stack trace:
#0 /vagrant/vendor/yiisoft/yii2/db/Command.php(1295): yii\db\Schema->convertException()
#1 /vagrant/vendor/yiisoft/yii2/db/Command.php(1091): yii\db\Command->internalExecute()
#2 /vagrant/vendor/yiisoft/yii2/db/ActiveRecord.php(332): yii\db\Command->execute()
#3 /vagrant/vendor/yiisoft/yii2/db/BaseActiveRecord.php(810): yii\db\ActiveRecord::updateAll()
#4 /vagrant/vendor/yiisoft/yii2/db/ActiveRecord.php(676): yii\db\BaseActiveRecord->updateInternal()
#5 /vagrant/vendor/yiisoft/yii2/db/BaseActiveRecord.php(681): yii\db\ActiveRecord->update()
#6 /vagrant/vendor/craftcms/cms/src/services/Elements.php(1964): yii\db\BaseActiveRecord->save()
#7 /vagrant/vendor/craftcms/cms/src/services/Elements.php(529): craft\services\Elements->_saveElementInternal()
#8 /vagrant/vendor/dolphiq/redirect/src/controllers/SettingsController.php(337): craft\services\Elements->saveElement()
#9 [internal function]: dolphiq\redirect\controllers\SettingsController->actionSaveRedirect()
#10 /vagrant/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#11 /vagrant/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams()
#12 /vagrant/vendor/craftcms/cms/src/web/Controller.php(187): yii\base\Controller->runAction()
#13 /vagrant/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction()
#14 /vagrant/vendor/craftcms/cms/src/web/Application.php(299): yii\base\Module->runAction()
#15 /vagrant/vendor/craftcms/cms/src/web/Application.php(565): craft\web\Application->runAction()
#16 /vagrant/vendor/craftcms/cms/src/web/Application.php(278): craft\web\Application->_processActionRequest()
#17 /vagrant/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest()
#18 /vagrant/web/index.php(23): yii\base\Application->run()
#19 {main}
Additional Information:
Array
(
    [0] => 23000
    [1] => 1048
    [2] => Column 'uid' cannot be null
)
anchovy commented 4 years ago

Having the same issue.

mijewe commented 4 years ago

Likewise. I'm able to create new entries, but not resave existing ones.

anchovy commented 4 years ago

Was just creating a pull request for this but see this issue was fixed in v1.0.24 (#99 about 5 months ago) but this version isn't available via composer, latest available version is 1.0.23?

composer require dolphiq/redirect:1.0.24

  [InvalidArgumentException]                                            
  Could not find package dolphiq/redirect in a version matching 1.0.24  
superpikar commented 4 years ago

@anchovy it seems this plugin is unmaintained