Polls: MySQL invalid date time

Created on 23 Oct 2020  路  20Comments  路  Source: nextcloud/polls

What is going wrong?

After checking "Anonymous poll" removing the check produce error like:

Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'UPDATE oc_polls_polls SET expire = ?, anonymous = ?, allow_maybe = ?, vote_limit = ?, deleted = ?, admin_access = ?, important = ? WHERE id = ?' with params [1603666557, false, 0, 0, 0, 1, 0, 6]: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for column nextcloud.oc_polls_polls.**anonymous** at row 1

Same for "Allow Admin to edit this poll", error:

Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'UPDATE oc_polls_polls SET expire = ?, anonymous = ?, allow_maybe = ?, vote_limit = ?, deleted = ?, admin_access = ?, important = ? WHERE id = ?' with params [1603666557, 1, 0, 0, 0, false, 0, 6]: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for column nextcloud.oc_polls_polls.**admin_access** at row 1

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Configuration' of a poll
  2. Check 'Anonymous poll'
  3. Un-Check 'Anonymous poll'
  4. See error pop-up and in NextCloud log

Expected behavior
Be able to Set/UnSet options "Anonymous poll" and "Allow Admin to edit this poll"

Information about your polls installation

1.5.4

updated from 1.4

Installed by Appstore

Information about your Instance of Nextcloud/ownCloud

Nextcloud or ownCloud? NextCloud

Nextcloud/ownCloud version: Nextcloud 17.0.10

Operating system: docker container

Web server:

Database: MySQL

bug

All 20 comments

Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'UPDATE oc_polls_polls SET expire = ?, anonymous = ?, allow_maybe = ?, vote_limit = ?, deleted = ?, admin_access = ?, important = ? WHERE id = ?' with params [1603666557, false, 0, 0, 0, 1, 0, 6]: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for column nextcloud.oc_polls_polls.**anonymous** at row 1

Same error as #1190

Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'UPDATE oc_polls_polls SET expire = ?, anonymous = ?, allow_maybe = ?, vote_limit = ?, deleted = ?, admin_access = ?, important = ? WHERE id = ?' with params [1603666557, 1, 0, 0, 0, false, 0, 6]: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for column nextcloud.oc_polls_polls.**admin_access** at row 1

This confuses me. The value for admin access is a boolean value, but the error say wrong date time.

I made a fix to force the boolean to be converted into an integer value. It works on my configuration. You can find it in the releases section (Version 1.5.6).

Can you publish on nextcloud app store this release ?

Unfortunately not. I have no access there, I have to rely on @v1r0x . And before the release, I would like to have a proof, that the fix solves the problem.

Do you have access to the file system of the server?

If yes:

  • Backup the apps/polls directory,
  • delete the content of the apps/polls directory and
  • unzip the content (polls folder) of the file polls-1.5.6.zip to the app/polls folder.

As there are no changes to the database, you can safely revert to the previous version by restoring the backup.

Tried this, probably nextcloud take some hash of this installed package, unzip crash web interfae returning HTTP STATUS 503, reverting to backup restored nextcloud working state

No, it doesn't. Be sure to not extract the in the zip file containing folder into the poll folder, but the contents. In the end the files must be inside of apps/polls/ and not apps/polls/polls/

You took this file? https://github.com/nextcloud/polls/releases/download/v1.5.6/polls-1.5.6.zip

We have a NextCloud docker installation, after a backup of the original dir (mv polls polls.orig), if I unzip 1.5.6 in

.../volumes/nextcloud_html/_data/custom_apps/polls/

(we know not to unzip in polls/polls :D)

we applied chown -R www-data:wwwdata on polls directory as other html contents
refreshing web page we get :

503 Service Unavailable
No server is available to handle this request.

reverting to original polls directory "1.5.4" (from backup: rm -rf polls && mv pools.orig polls) after a page refresh nextcloud works again.

Something in version 1.5.6 crash NextCloud. All we can see is this in container logs (apache error.log):

     ...
     "HEAD / HTTP/1.1" 302 1411 "-" "-"
     "GET /apps/polls/polls/list HTTP/1.1" 302 923 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0"
     "GET /apps/files/ HTTP/1.1" 200 9382 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0"
     "HEAD / HTTP/1.1" 302 1403 "-" "-"
     ...
-->  "HEAD / HTTP/1.1" 503 1417 "-" "-"
     "HEAD / HTTP/1.1" 503 1415 "-" "-"
     user1 [24/Oct/2020:08:35:46 +0000] "PROPFIND /remote.php/dav/files/.../ HTTP/1.1" 503 857 "-" "Mozilla/5.0 (Windows) mirall/3.0.2stable-Win64 (build 20200924) (Nextcloud)"
     "HEAD / HTTP/1.1" 503 1413 "-" "-"
     "HEAD / HTTP/1.1" 503 1417 "-" "-"
     "HEAD / HTTP/1.1" 503 1421 "-" "-"
     ...

Do you have static references to ...html/apps/polls ? or something else breaking nextcloud

First of all, thanks for your patience and support.

I am not familiar with the docker installation, but mv polls polls.orig sounds as if in the end there are two polls apps in the custom_apps folder.

Try to backup the original polls folder outside the custom_apps folder, delete the files inside the polls folder and replace them with the files in the zip.

Do you have static references to ...html/apps/polls ?

EDIT: No.

I think Docker version is same as not containerazied version in respect of dir struct and behavior.

Also doing what you ask step by step, leaving only one directory starting with polls I get same error, but when leaving multiple polls starting with polls but using 1.5.4 version this issue is not prasent anyway.

Can be NextCloud version we use (Nextcloud 17.0.10) ?

I am not sure, how the mounting works. So, it was a try.

Nextcloud 17 should be OK. Do you have any log entries in the console or in the Nextcloud log?

You can try to replace the following file from the zip:
/polls/lib/Db/Poll.php

There I added the type conversation.

I don't know if related, but on error i see lot of this errors in nextcloud.log, below for "calendar", but same error is reported for all apps, as if your code changes page routing/redirect behavior

{"reqId":"...","level":3,"time":"...","remoteAddr":"...","user":"--","app":"no app in context","method":"HEAD","url":"\/","message":{"Exception":"Symfony\\Component\\Routing\\Exception\\RouteNotFoundException","Message":"Unable to generate a URL for the named route \"calendar.view.index\" as such route does not exist.","Code":0,"Trace":[{"file":"\/var\/www\/html\/lib\/private\/Route\/Router.php","line":337,"function":"generate","class":"Symfony\\Component\\Routing\\Generator\\UrlGenerator","type":"->","args":["calendar.view.index",[],1]},{"file":"\/var\/www\/html\/lib\/private\/Route\/CachingRouter.php","line":60,"function":"generate","class":"OC\\Route\\Router","type":"->","args":["calendar.view.index",[],false]},{"file":"\/var\/www\/html\/lib\/private\/URLGenerator.php","line":79,"function":"generate","class":"OC\\Route\\CachingRouter","type":"->","args":["calendar.view.index",[]]},{"file":"\/var\/www\/html\/lib\/private\/NavigationManager.php","line":292,"function":"linkToRoute","class":"OC\\URLGenerator","type":"->","args":["calendar.view.index"]},{"file":"\/var\/www\/html\/lib\/private\/NavigationManager.php","line":113,"function":"init","class":"OC\\NavigationManager","type":"->","args":[]},{"file":"\/var\/www\/html\/apps\/theming\/lib\/ThemingDefaults.php","line":179,"function":"getAll","class":"OC\\NavigationManager","type":"->","args":["guest"]},{"file":"\/var\/www\/html\/lib\/private\/legacy\/defaults.php","line":259,"function":"getShortFooter","class":"OCA\\Theming\\ThemingDefaults","type":"->","args":[]},{"file":"\/var\/www\/html\/lib\/public\/Defaults.php","line":167,"function":"getLongFooter","class":"OC_Defaults","type":"->","args":[]},{"file":"\/var\/www\/html\/core\/templates\/layout.guest.php","line":55,"function":"getLongFooter","class":"OCP\\Defaults","type":"->","args":[]},{"file":"\/var\/www\/html\/lib\/private\/Template\/Base.php","line":178,"args":["\/var\/www\/html\/core\/templates\/layout.guest.php"],"function":"include"},{"file":"\/var\/www\/html\/lib\/private\/Template\/Base.php","line":150,"function":"load","class":"OC\\Template\\Base","type":"->","args":["\/var\/www\/html\/core\/templates\/layout.guest.php",null]},{"file":"\/var\/www\/html\/lib\/private\/legacy\/template.php","line":180,"function":"fetchPage","class":"OC\\Template\\Base","type":"->","args":[null]},{"file":"\/var\/www\/html\/lib\/private\/legacy\/template.php","line":211,"function":"fetchPage","class":"OC_Template","type":"->","args":[null]},{"file":"\/var\/www\/html\/lib\/private\/Template\/Base.php","line":131,"function":"fetchPage","class":"OC_Template","type":"->","args":[]},{"file":"\/var\/www\/html\/lib\/base.php","line":355,"function":"printPage","class":"OC\\Template\\Base","type":"->","args":[]},{"file":"\/var\/www\/html\/lib\/base.php","line":955,"function":"printUpgradePage","class":"OC","type":"::","args":[{"__class__":"OC\\SystemConfig"}]},{"file":"\/var\/www\/html\/index.php","line":42,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"\/var\/www\/html\/3rdparty\/symfony\/routing\/Generator\/UrlGenerator.php","Line":130,"CustomMessage":"--"},"userAgent":"--","version":"..."}

Hi @dartcafe ,
/polls/lib/Db/Poll.php subtitution works !

OK. Great. Let's wait for the new appstore release.

And if possible: Consider an update to the next or current NC version, as 17 is out of maintenance. Next polls version will support at least 18.

https://docs.nextcloud.com/server/latest/admin_manual/release_schedule.html

Thanks @dartcafe, we'll upgrade nextcloud as soon as possible !

There is Documentation of poll with descritption for each option ? It isn't so clear what every option do... if you used name used in doodle or other polls like apps can you map those options to that and point us to the right direction ?

@dartcafe You closed the other issue in favor of this one. I replied in the other issue, but I don't know, if you still watch closed issues, thus I paste it here as well:

When you create a new poll (or clone a poll), the Allow maybe vote option is set by default. You can uncheck it without getting an error and it says that it saved the change. However it does not stick.
I cannot remove the maybe vote option.

Console output:

Notifications permissions granted App.vue:242
Could not find capabilities initial state fall back to _oc_capabilities

GET https://****/apps/polls/subscription/10
404
Not Found

I released another version. The chosen approach did not work properly.
@Roxyrob I suggest to substitute the file again from the v1.5.7 package.
At the moment, there is no documentation. Sorry.

Sorry for inconvenience.

@tessus
The console log (subscription) is misleading and removed in version 1.6. This just indicates, that there is no active subscription.

@dartcafe seems to work. Haven't found any problems so far! 馃憤 Thank you.

Hi @dartcafe, v1.5.7 seems to work for me too. No issue found (used Poll.php only).

Not sure if this has anything to do with this release but the email notification includes a link that does not work:

https://****/index.php/apps/polls/vote/13

When I remove index.php all is good: https://****/apps/polls/vote/13

Not sure if this has anything to do with this release but the email notification includes a link that does not work:

see https://github.com/nextcloud/polls/issues/945#issuecomment-703895761

Please report there. Do you refer to the notification mail or the invitation mail.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BurtGummer picture BurtGummer  路  3Comments

dartcafe picture dartcafe  路  4Comments

nextgen-networks picture nextgen-networks  路  6Comments

brtptrs picture brtptrs  路  4Comments

CoreyBurger picture CoreyBurger  路  3Comments