sapioit / phpliteadmin

Automatically exported from code.google.com/p/phpliteadmin
1 stars 0 forks source link

Automatically inserts linebreaks when editing long strings #177

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create table with a single text field.
2. Insert a long string like 
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaa'
3. Browse to the edit screen for the newly created and save changes without 
editing the field.

What is the expected output? What do you see instead?

I expect the single field to be updated to exactly the same string it was 
previously. Instead it is is updated to 
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaa' where the spaces are 
presumably separated by the number of characters in a line of the textbox used 
for editing the field.

What version of the product are you using? On what operating system? Which
Database Extension (PDO/SQLiteDatabase/SQLiteDatabase3 - see Database
structure-tab in phpLiteAdmin)?

phpLiteAdmin version 1.9.3.3
SQLite version: 3.7.7.1
SQLite extension: PDO
PHP version: 5.3.20

Please provide any additional information below.

Original issue reported on code.google.com by kger...@gmail.com on 15 Feb 2013 at 3:19

GoogleCodeExporter commented 9 years ago
I have found that the textarea used for submitting edits has attribute 
wrap="hard". I am not sure if this was intentional.

Original comment by kger...@gmail.com on 15 Feb 2013 at 3:29

GoogleCodeExporter commented 9 years ago
Thanks for submitting the issue.

I can confirm the issue in Chrome 24, not in Firefox 18, testet with 
phpLiteAdmin 1.9.4 r335.

"wrap" is a non-standard attribute for "textarea" introduced with Netscape 2.
As common with non-standard attributes, the possible values are 
supported/interpreted differently by different browsers.

I think wrap=hard was introduced here to make sure linebreaks entered by the 
user are submitted as well. This works in some browsers as expected, i.e. in 
Firefox. But other browsers have a different understanding of the attribute 
that introduce unexpected linebreaks. Wrap=hard clearly seems to be the wrong 
choice here. We could set wrap=off, which is commonly understood by (modern) 
browsers and will show everything as entered, i.e. producing scrollbars if no 
linebreak is entered.
Or we could remove the attribute altogether, which would be the same as using 
wrap=soft. But we should make sure it is still possible to enter linebreaks 
manually that also end up in the value (in all browsers of interest).

I will first have a look into phpLiteAdmin repo history to figure out why 
wrap=hard was introduced in the first place.

Original comment by crazy4ch...@gmail.com on 15 Feb 2013 at 1:55

GoogleCodeExporter commented 9 years ago
Okay, wrap=hard dates back to the very first version of phpliteadmin that has 
been committed to svn (in revision 2), so we probably cannot find the 
motivation of introducing this in the repo history.

Original comment by crazy4ch...@gmail.com on 15 Feb 2013 at 2:12

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r337.

Original comment by crazy4ch...@gmail.com on 15 Feb 2013 at 2:29

GoogleCodeExporter commented 9 years ago
Okay, I just committed a fix to svn that removes wrap=hard (i.e. wrap=soft by 
default).
I tested this in a couple of browsers and it works as expected.
In contrast to setting wrap to any value manually (like "off"), this also has 
the advantage that it's valid XHTML.

You can find the development version in svn that fixes this issue:
https://phpliteadmin.googlecode.com/svn/source/1.9.4/phpliteadmin.php

In case you or somebody else sees any problem with my fix, please comment here 
or open a new issue.

Thanks for your contribution!

Original comment by crazy4ch...@gmail.com on 15 Feb 2013 at 2:32