Yourls: Error on long referrer

Created on 19 May 2018  Â·  6Comments  Â·  Source: YOURLS/YOURLS

Technical details regarding my environment

  • YOURLS version: 1.7.3

    • Plugins enabled: Allow hyphens in short urls (but I think the problem isn't caused by that)

  • PHP version: 7.1.14

Bug description

What is the current behavior?
When redirected from a super long(>200 chars, I guess) URL, the program encounters an error

This is a bug because it does not redirect the browser do the long URL.

What is the expected or desired behavior?
It should redirect to the long URL.

Reproducible bug summary

  1. Create some link.
  2. Navigate to it using a super long url (I have used this)
  3. It reports an error:

Fatal error: Uncaught PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'referrer' at row 1 in /data/dy-pages/store-1/704/2049704/www/includes/vendor/aura/sql/src/ExtendedPdo.php:748 Stack trace: #0 /data/dy-pages/store-1/704/2049704/www/includes/vendor/aura/sql/src/ExtendedPdo.php(748): PDOStatement->execute() #1 /data/dy-pages/store-1/704/2049704/www/includes/vendor/aura/sql/src/ExtendedPdo.php(306): Aura\Sql\ExtendedPdo->perform('INSERT INTO `yo...', Array) #2 /data/dy-pages/store-1/704/2049704/www/includes/functions.php(869): Aura\Sql\ExtendedPdo->fetchAffected('INSERT INTO `yo...', Array) #3 /data/dy-pages/store-1/704/2049704/www/yourls-go.php(27): yourls_log_redirect('1') #4 /data/dy-pages/store-1/704/2049704/www/index.php(37): require_once('/data/dy-pages/...') #5 {main} thrown in /data/dy-pages/store-1/704/2049704/www/includes/vendor/aura/sql/src/ExtendedPdo.php on line 748


That's it.

bug core database

Most helpful comment

Yep. The same problem would happen with really long user-agents, except those are truncated in yourls_get_user_agent(). YOURLS should probably do the same with the referrer, if not widen the referrer database column…

All 6 comments

Yep. The same problem would happen with really long user-agents, except those are truncated in yourls_get_user_agent(). YOURLS should probably do the same with the referrer, if not widen the referrer database column…

Anyone fix it? Sadly I don't know much php.

I have same problem.
Just go to the database and change the length of referrer.
ALTER TABLE yourls_log MODIFY referrer VARCHAR(1000)

I think this has been fixed somewhere along the road. Closing.

I am not so sure it has. I'm running 1.7.4 though (and have been since deployment 2019 Q4) so unless the scripts that make the tables have been changed since then, then it's not fixed. Just had a user report this error yesterday and going in the table to update the referrer field manually now

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LeoColomb picture LeoColomb  Â·  3Comments

dylanh724 picture dylanh724  Â·  6Comments

ozh picture ozh  Â·  3Comments

LaughterOnWater picture LaughterOnWater  Â·  5Comments

wefixit-AT picture wefixit-AT  Â·  5Comments