Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003314 [Quercus] minor always 02-02-09 08:17 02-02-09 20:34
Reporter tlandmann View Status public  
Assigned To nam
Priority normal Resolution fixed  
Status closed   Product Version 3.2.1
Summary 0003314: html_entity_decode() not Unicode-compatible
Description The source code of the function is as follows:

--------------------

public static StringValue html_entity_decode(Env env,
                           StringValue string,
                           @Optional int quoteStyle,
                           @Optional String charset)
  {
    if (string.length() == 0)
      return env.getEmptyString();

    Iterator<Map.Entry<Value,Value>> iter;

    if (env.isUnicodeSemantics())
      iter = HTML_ENTITIES_ARRAY_UNICODE.getIterator(env); // LINE 380
    else
      iter = HTML_ENTITIES_ARRAY.getIterator(env);

    while (iter.hasNext()) {
      Map.Entry<Value,Value> entry = iter.next();
      StringValue key = entry.getKey().toStringValue();
      StringValue value = entry.getValue().toStringValue();

      string = RegexpModule.ereg_replace(env,
                                         value,
                                         key,
                                         string).toStringValue();
    }

    return string;
  }

--------------------

Line 380 (iter = HTML_ENTITIES_ARRAY_UNICODE.getIterator(env);) causes a NullPointerException because HTML_ENTITIES_ARRAY_UNICODE is not set.

Temporary workaround: Call htmlentities(" ") once right before using html_entity_decode() for the first time. This helps because htmlentities(), unlike html_entity_decode(), initializes the array if it still equals null (line 319).

However, I'd be happy if the problem could be fixed soon.
Additional Information
Attached Files

- Relationships

- Notes
(0003797)
nam
02-02-09 20:34

At the moment, using unicode.semantics="true" is not recommended.

php/0jl0
 

- Issue History
Date Modified Username Field Change
02-02-09 08:17 tlandmann New Issue
02-02-09 15:21 nam Status new => assigned
02-02-09 15:21 nam Assigned To  => nam
02-02-09 20:34 nam Status assigned => closed
02-02-09 20:34 nam Note Added: 0003797
02-02-09 20:34 nam Resolution open => fixed
02-02-09 20:34 nam Fixed in Version  => 4.0.0


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
29 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker