Skip to content
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

Exception when inputting large texts into short fields #9988

Open
jonasraoni opened this issue May 24, 2024 · 2 comments
Open

Exception when inputting large texts into short fields #9988

jonasraoni opened this issue May 24, 2024 · 2 comments
Labels
Enhancement:1:Minor A new feature or improvement that can be implemented in less than 3 days.
Milestone

Comments

@jonasraoni
Copy link
Contributor

jonasraoni commented May 24, 2024

Describe the bug
When trying to enter more characters than I'm allowed to, I receive an error message. In general all text fields that have limits should receive a max length limiter to help the user understand what's happening.

Another alternative would be to setup the database to cutoff the rest, but as a user, I wouldn't like it.

PHP Fatal error:  Uncaught PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'mailing_address' at row 1 in /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php:570
Stack trace:
    #0 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(570): PDOStatement->execute()
#1 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(753): Illuminate\Database\Connection->Illuminate\Database\{closure}('update `users` ...', Array)
#2 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(720): Illuminate\Database\Connection->runQueryCallback('update `users` ...', Array, Object(Closure))
#3 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(577): Illuminate\Database\Connection->run('update `users` ...', Array, Object(Closure))
#4 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(510): Illuminate\Database\Connection->affectingStatement('update `users` ...', Array)
#5 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3357): Illuminate\Database\Connection->update('update `users` ...', Array)
#6 /var/www/html/lib/pkp/classes/core/EntityDAO.php(196): Illuminate\Database\Query\Builder->update(Array)
#7 /var/www/html/lib/pkp/classes/user/DAO.php(270): PKP\core\EntityDAO->_update(Object(PKP\user\User))
#8 /var/www/html/lib/pkp/classes/user/Repository.php(121): PKP\user\DAO->update(Object(PKP\user\User))
#9 /var/www/html/lib/pkp/classes/user/form/BaseProfileForm.php(64): PKP\user\Repository->edit(Object(PKP\user\User))
#10 /var/www/html/lib/pkp/classes/user/form/ContactForm.php(137): PKP\user\form\BaseProfileForm->execute(emailUpdated: false)
#11 /var/www/html/lib/pkp/controllers/tab/user/ProfileTabHandler.php(124): PKP\user\form\ContactForm->execute()
#12 [internal function]: PKP\controllers\tab\user\ProfileTabHandler->saveContact(Array, Object(APP\core\Request))
#13 /var/www/html/lib/pkp/classes/core/PKPRouter.php(334): call_user_func(Array, Array, Object(APP\core\Request))
#14 /var/www/html/lib/pkp/classes/core/PKPComponentRouter.php(291): PKP\core\PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(APP\core\Request), Array)
#15 /var/www/html/lib/pkp/classes/core/Dispatcher.php(165): PKP\core\PKPComponentRouter->route(Object(APP\core\Request))
#16 /var/www/html/lib/pkp/classes/core/PKPApplication.php(388): PKP\core\Dispatcher->dispatch(Object(APP\core\Request))
#17 /var/www/html/index.php(21): PKP\core\PKPApplication->execute()
#18 {main}

To Reproduce

  1. Enter more data than you're allowed to (normally 255 for simple text fields)
  2. Attempt to save

What application are you using?
OJS 3.4

@jonasraoni jonasraoni added the Enhancement:1:Minor A new feature or improvement that can be implemented in less than 3 days. label May 24, 2024
@jonasraoni jonasraoni added this to the 3.4.0-x milestone May 24, 2024
@asmecher
Copy link
Member

VARCHAR(255) in MySQL means 255 bytes 😑

Are you sure? Looking at MySQL documentation for 8.0...

For definitions of character string columns (CHAR, VARCHAR, and the TEXT types), MySQL interprets length specifications in character units.

Maybe this changed at some point?

@jonasraoni
Copy link
Contributor Author

Yep, this behavior was modified a long time ago, I'll update the description 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement:1:Minor A new feature or improvement that can be implemented in less than 3 days.
Projects
None yet
Development

No branches or pull requests

2 participants