Automatically inserts linebreaks when editing long strings

Issue #177 resolved
Former user created an issue

Originally reported on Google Code with ID 177

What steps will reproduce the problem?
1. Create table with a single text field.
2. Insert a long string like 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
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.

Reported by kgerbil on 2013-02-15 03:19:42

Comments (5)

  1. Former user Account Deleted
    I have found that the textarea used for submitting edits has attribute wrap="hard".
    I am not sure if this was intentional.
    

    Reported by kgerbil on 2013-02-15 03:29:18

  2. Christopher Kramer
    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.
    

    Reported by crazy4chrissi on 2013-02-15 13:55:19 - Status changed: Accepted

  3. Christopher Kramer
    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.
    

    Reported by crazy4chrissi on 2013-02-15 14:12:13

  4. Christopher Kramer
    This issue was closed by revision r337.
    

    Reported by crazy4chrissi on 2013-02-15 14:29:15 - Status changed: Fixed

  5. Christopher Kramer
    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!
    

    Reported by crazy4chrissi on 2013-02-15 14:32:28

  6. Log in to comment