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

Error on long referrer #2398

Open
Alan-Liang opened this Issue May 19, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@Alan-Liang

Alan-Liang commented May 19, 2018

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.

@dgw dgw added the database label May 19, 2018

@dgw

This comment has been minimized.

Collaborator

dgw commented May 19, 2018

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…

@dgw dgw added bug core labels May 19, 2018

@Alan-Liang

This comment has been minimized.

Alan-Liang commented Jun 18, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment