You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2011-05-18 21:38:07

Maska
Guest
Registered: 2009-07-17
Posts: 13

Bug: doesn't add ticket when the char №70 is a new line

When users try to add a new ticket where no title, and in description char 70 is the new line is SQL-error and the new ticket isn't added.
The problem in regular expressions to convert the description in the title.

File inc/ticket.class.php:

      // No name set name
      if (empty($input["name"])) {
         $input["name"] = preg_replace('/\r\n/',' ',$input['content']);
         $input["name"] = preg_replace('/\n/',' ',$input['name']);
         $input["name"] = utf8_substr($input['name'],0,70);
      }

For example, add a ticket with the following description:

123456789012345678901234567890123456789012345678901234567890123456789<new line>

Before if we have in string $input['content'] (length 73):

123456789012345678901234567890123456789012345678901234567890123456789\r\n

After if in $input["name"]:

123456789012345678901234567890123456789012345678901234567890123456789\

Of course, this line causes an error when adding to the database. This error is observed in the current version (0.78.5) and previous.

Regular expressions are used now do not work for strings, when the \r\n is 4 symbols, they are written for strings in which \r\n is 1 char.
Example of fix, we changed the following lines:

      // No name set name
      if (empty($input["name"])) {
         $input["name"] = preg_replace('/\\\r\\\n/',' ',$input['content']);
         $input["name"] = preg_replace('/\\\n/',' ',$input['name']);
         $input["name"] = utf8_substr($input['name'],0,70);
      }

Please fix it.

Offline

#2 2011-05-19 17:36:57

Maska
Guest
Registered: 2009-07-17
Posts: 13

Re: Bug: doesn't add ticket when the char №70 is a new line

Oh, sorry. Please replace topic in forum "English speaking users".

Offline

Board footer

Powered by FluxBB