Bug#923661: tt-rss: PHP Fatal error: Uncaught PDOException: SQLSTATE[22001]: String data, right truncated

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug#923661: tt-rss: PHP Fatal error: Uncaught PDOException: SQLSTATE[22001]: String data, right truncated

Helmut Grohne
Control: severity -1 serious

On Sun, Mar 03, 2019 at 01:33:36PM +0100, Stefan Fritsch wrote:

> after upgrading from 16.8+git20160826+dfsg-3 (which I had run under
> Debian stretch), tt-rss fails to display anything after the login page.
> There is this error:
>
> [Sun Mar 03 13:15:12.954927 2019] [php7:error] [pid 2055] [client XXX] PHP Fatal error:  Uncaught PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'context' at row 1 in /usr/share/tt-rss/www/classes/logger/sql.php:18
> Stack trace:
> #0 /usr/share/tt-rss/www/classes/logger/sql.php(18): PDOStatement->execute(Array)
> #1 /usr/share/tt-rss/www/classes/logger.php(28): Logger_SQL->log_error(8192, 'strpos(): Non-s...', 'vendor/JShrink/...', 184, '1. vendor/JShri...')
> #2 /usr/share/tt-rss/www/include/errorhandler.php(43): Logger->log_error(8192, 'strpos(): Non-s...', 'vendor/JShrink/...', 184, '1. vendor/JShri...')
> #3 [internal function]: ttrss_error_handler(8192, 'strpos(): Non-s...', 'vendor/JShrink/...', 184, '1. vendor/JShri...')
> #4 /usr/share/tt-rss/www/vendor/JShrink/Minifier.php(184): strpos('(-+{[@', false)
> #5 /usr/share/tt-rss/www/vendor/JShrink/Minifier.php(144): JShrink\\Minifier->loop()
> #6 /usr/share/tt-rss/www/vendor/JShrink/Minifier.php(110): JShrink\\Minifier->minifyDirectToOutput('/* global dijit...', Array)
> #7 /usr/share/tt-rss/www/include/functions.php in /usr/share/tt-rss/www/classes/logger/sql.php on line 18, referer: https://XXX
>
>
> I have then changed LOG_DESTINATION to syslog in config.php and it
> worked again. In syslog, I see this message:

Given this workaround, the package is not entirely useless. "Only" the
default installation does not work. Thus severity grave is not
reasonable. Still something should be done about this in buster, which
is why I won't downgrade it below rc.

> php: [tt-rss] E_DEPRECATED (8192) (vendor/JShrink/Minifier.php:184) strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior
>
>
> If no other fix is possible in time for buster release, maybe the default for LOG_DESTINATION
> could be changed?

Thank you for the detailed analysis. The actual failure we see here is
secondary. It tries to log an error and fails. Changing the
LOG_DESTINATION fixes the secondary error. The primary cause seems to
live in JShrink though and I guess that this commit fixes it:

https://github.com/tedious/JShrink/pull/78/commits/91105810dafedba0390608d7465abd602beb6410

JShrink is a vendored library and is installed to
/usr/share/tt-rss/www/vendor/JShrink/Minifier.php. You can apply the
above commit to a live installation without rebuilding the package.  Can
any of the reporters try applying it and tell whether it fixes tt-rss?

Likely, the logger should be fixed as well. In the absence of a fix
there, I second the suggestion to log to syslog as that's where system
services usually log on Debian and I'd prefer that default, but it is
not up to me to decide.

Helmut

Reply | Threaded
Open this post in threaded view
|

Bug#923661: tt-rss: PHP Fatal error: Uncaught PDOException: SQLSTATE[22001]: String data, right truncated

Stefan Fritsch
Hi Helmut,

Am 08.05.19 um 19:23 schrieb Helmut Grohne:

> Thank you for the detailed analysis. The actual failure we see here is
> secondary. It tries to log an error and fails. Changing the
> LOG_DESTINATION fixes the secondary error. The primary cause seems to
> live in JShrink though and I guess that this commit fixes it:
>
> https://github.com/tedious/JShrink/pull/78/commits/91105810dafedba0390608d7465abd602beb6410
>
> JShrink is a vendored library and is installed to
> /usr/share/tt-rss/www/vendor/JShrink/Minifier.php. You can apply the
> above commit to a live installation without rebuilding the package.  Can
> any of the reporters try applying it and tell whether it fixes tt-rss?

Yes, using the Minifier.php from the above commit fixes the issue (and
another php warning that appeared in apache error log). In order to test
it, one needs to delete the files from /var/cache/tt-rss/js/* first, or
the minifier won't be called again.

Cheers,
Stefan

Reply | Threaded
Open this post in threaded view
|

Bug#923661: tt-rss: PHP Fatal error: Uncaught PDOException: SQLSTATE[22001]: String data, right truncated

Sebastian Reichel-2
Hi,

On Mon, May 20, 2019 at 05:59:05PM +0200, Helmut Grohne wrote:

> Control: tags -1 + patch
>
> Hi Sebastian and Marcelo,
>
> On Sat, May 11, 2019 at 10:41:48AM +0200, Stefan Fritsch wrote:
> > Yes, using the Minifier.php from the above commit fixes the issue (and
> > another php warning that appeared in apache error log). In order to test it,
> > one needs to delete the files from /var/cache/tt-rss/js/* first, or the
> > minifier won't be called again.
>
> Thank you, Stefan.
>
> I've attached a .debdiff that fixes jshrink and changes the default log
> destination to syslog (as this avoids the other bug). What do you think?
> Only fix the jshrink part? Do both?
Did you forgot to add the attachment? FWIW both changes are with me.

-- Sebastian

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Bug#923661: tt-rss: PHP Fatal error: Uncaught PDOException: SQLSTATE[22001]: String data, right truncated

Helmut Grohne
Hi Sebastian,

On Mon, May 20, 2019 at 06:51:57PM +0200, Sebastian Reichel wrote:
> Did you forgot to add the attachment? FWIW both changes are with me.

Yes, sorry. I intend to move foward with a "maintainer acknowledged NMU"
if you lack time for doing the upload.

Helmut

tt-rss_18.12+dfsg-1.1.debdiff (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Bug#923661: tt-rss: PHP Fatal error: Uncaught PDOException: SQLSTATE[22001]: String data, right truncated

Sebastian Reichel-2
Hi Helmut,

On Mon, May 20, 2019 at 08:33:10PM +0200, Helmut Grohne wrote:
> On Mon, May 20, 2019 at 06:51:57PM +0200, Sebastian Reichel wrote:
> > Did you forgot to add the attachment? FWIW both changes are with me.
>
> Yes, sorry. I intend to move foward with a "maintainer acknowledged NMU"
> if you lack time for doing the upload.

Instead of creating an extra patch for the config change I would
prefer to have config.php-dist.patch updated. Regarding the NMU:
Please go ahead.

-- Sebastian

> diff --minimal -Nru tt-rss-18.12+dfsg/debian/changelog tt-rss-18.12+dfsg/debian/changelog
> --- tt-rss-18.12+dfsg/debian/changelog 2019-02-06 00:04:47.000000000 +0100
> +++ tt-rss-18.12+dfsg/debian/changelog 2019-05-20 17:53:54.000000000 +0200
> @@ -1,3 +1,11 @@
> +tt-rss (18.12+dfsg-1.1) UNRELEASED; urgency=medium
> +
> +  * Non-maintainer upload.
> +  * Cherry pick JShrink PHP 7.3 compatibility patch. (Closes: #923661)
> +  * Default to using syslog as log backend rather than sql.
> +
> + -- Helmut Grohne <[hidden email]>  Mon, 20 May 2019 17:53:54 +0200
> +
>  tt-rss (18.12+dfsg-1) unstable; urgency=medium
>  
>    * New upstream release
> diff --minimal -Nru tt-rss-18.12+dfsg/debian/patches/default_to_syslog.patch tt-rss-18.12+dfsg/debian/patches/default_to_syslog.patch
> --- tt-rss-18.12+dfsg/debian/patches/default_to_syslog.patch 1970-01-01 01:00:00.000000000 +0100
> +++ tt-rss-18.12+dfsg/debian/patches/default_to_syslog.patch 2019-05-20 17:53:47.000000000 +0200
> @@ -0,0 +1,11 @@
> +--- tt-rss-18.12+dfsg.orig/config.php-dist
> ++++ tt-rss-18.12+dfsg/config.php-dist
> +@@ -166,7 +166,7 @@
> + // Disabling auth_internal in this list would automatically disable
> + // reset password link on the login form.
> +
> +- define('LOG_DESTINATION', 'sql');
> ++ define('LOG_DESTINATION', 'syslog');
> + // Error log destination to use. Possible values: sql (uses internal logging
> + // you can read in Preferences -> System), syslog - logs to system log.
> + // Setting this to blank uses PHP logging (usually to http server
> diff --minimal -Nru tt-rss-18.12+dfsg/debian/patches/jshrink_php7.3_fix.patch tt-rss-18.12+dfsg/debian/patches/jshrink_php7.3_fix.patch
> --- tt-rss-18.12+dfsg/debian/patches/jshrink_php7.3_fix.patch 1970-01-01 01:00:00.000000000 +0100
> +++ tt-rss-18.12+dfsg/debian/patches/jshrink_php7.3_fix.patch 2019-05-20 17:49:53.000000000 +0200
> @@ -0,0 +1,32 @@
> +From 91105810dafedba0390608d7465abd602beb6410 Mon Sep 17 00:00:00 2001
> +From: Sergei Morozov <[hidden email]>
> +Date: Fri, 14 Sep 2018 19:55:03 -0700
> +Subject: [PATCH] Fixed test failures on PHP 7.3
> +
> +1. continue in break shoud target the while loop directly (php/php-src@04e3523).
> +2. strpos() doesn't longer accept non-string needles (https://wiki.php.net/rfc/deprecations_php_7_3#string_search_functions_with_integer_needle).
> + src/JShrink/Minifier.php | 4 ++--
> + 2 files changed, 4 insertions(+), 3 deletions(-)
> +
> +diff --git a/src/JShrink/Minifier.php b/src/JShrink/Minifier.php
> +index 8103452..ad8157f 100644
> +--- a/vendor/JShrink/Minifier.php
> ++++ b/vendor/JShrink/Minifier.php
> +@@ -183,7 +183,7 @@ protected function loop()
> +                 // new lines
> +                 case "\n":
> +                     // if the next line is something that can't stand alone preserve the newline
> +-                    if (strpos('(-+{[@', $this->b) !== false) {
> ++                    if ($this->b !== false && strpos('(-+{[@', $this->b) !== false) {
> +                         echo $this->a;
> +                         $this->saveString();
> +                         break;
> +@@ -231,7 +231,7 @@ protected function loop()
> +                             // check for some regex that breaks stuff
> +                             if ($this->a === '/' && ($this->b === '\'' || $this->b === '"')) {
> +                                 $this->saveRegex();
> +-                                continue;
> ++                                continue 3;
> +                             }
> +
> +                             echo $this->a;
> diff --minimal -Nru tt-rss-18.12+dfsg/debian/patches/series tt-rss-18.12+dfsg/debian/patches/series
> --- tt-rss-18.12+dfsg/debian/patches/series 2019-02-06 00:04:47.000000000 +0100
> +++ tt-rss-18.12+dfsg/debian/patches/series 2019-05-20 17:52:00.000000000 +0200
> @@ -1,3 +1,5 @@
>  config.php-dist.patch
>  remove-tt-rss-layer.patch
>  fix-db-updater-script.patch
> +jshrink_php7.3_fix.patch
> +default_to_syslog.patch


signature.asc (849 bytes) Download Attachment