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
Editing a result replaces \r\n by \n #12918
Comments
Why is this a problem for you? |
Because, in some of my PHP scripts, I do treatments on carriage returns and line feed (replace, split, preg...) and it doesn't work anymore for datas which have been edited with PMA. Since PHP 5.x, PHP offers the right way to manipulate new lines universally on all architectures (the constant PHP_EOL). It's strange that a famous application like PHPMyAdmin doesn't uses it ! PHPMyAdmin doesn't have to force the use of \n in my point of view. It should use either the server configuration (affected by PHP in the constant) or at least the client configuration (\r\n for Windows user agents, \n for Linux etc.). Hope my request will be taken into account. Thanks. |
Wouldn't it be better to have your code support both EOL styles? |
I use only \r\n (with the PHP_EOL constant) in all my code so no, I will not modify and complex all my code just to satisfy PMA editing compatibility. It's would not a reflexive solution. In my case, \r\n treatments are only done on the private dashboard part and we control the clients type. Never used only \n on Windows. It is not the default usage. If rare users want to use \n on Windows, ok free to them, but by default, PMA shoud use the default PHP_EOL value for majority of users. It is a matter of common sense and the good practice I think. |
Perhaps, you could also offer a new option variable in the PMA config file to let the user choose the new line representation. |
phpMyAdmin just uses data you've sent with your browser and stores them in the database. So you can as well claim that it is bug in your browser that it silently changed the textarea content. Anyway from phpMyAdmin point of view, I really don't see reason for rewriting the user posted content before passing it to the database. |
I've looked a bit deeper and the HTML specification is a bit inconsistent in this:
As result phpMyAdmin is inconsistent whether you use inline editor or full page editor... |
I was persuaded that the "conversion" was done by phpMyAdmin, not by the browser. Thank you for your fix and for the reactivity !! |
Hello,
I have observed that when fast editing (AJAX ?) a text result (mediumtext for example) of a select SQL request, the \r\n (CRLF) characters are replaced by simple \n (LF). It's a problem for me.
The PHP_EOL constant should be used instead of a \n
Thanks
Julien
Steps to reproduce
Server configuration
Windows Server 2012
PHP 7.1.1 x64 NTS
PHPMyAdmin 4.6.5.2
MySQL 5.7.17 x64
Client configuration
Windows 7
IE11
The text was updated successfully, but these errors were encountered: