On Thu, Jun 27, 2013 at 7:54 PM, Tjerk Anne Meesters <datib...@php.net>wrote:

>
>
>
> On Thu, Jun 27, 2013 at 4:42 PM, Kris Craig <kris.cr...@gmail.com> wrote:
>
>> On Thu, Jun 27, 2013 at 12:03 AM, Yasuo Ohgaki <yohg...@ohgaki.net>
>> wrote:
>>
>> >
>> > 2013/6/27 Kris Craig <kris.cr...@gmail.com>
>> >
>> >> I just noticed that htmlspecialchars_decode doesn't convert entities
>> like
>> >> &#10 and &#13.
>> >>
>> >
>> > I think htmlspecialchars_decode() only decodes
>> >
>> > ext/standard/html_tables.h
>> > static const entity_stage3_row stage3_table_be_apos_00000[] = {
>> >  {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, {
>> > {NULL, 0} } },
>> > {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, {
>> > {NULL, 0} } },
>> >  {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, {
>> > {NULL, 0} } },
>> > {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, {
>> > {NULL, 0} } },
>> >  {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, {
>> > {NULL, 0} } },
>> > {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, {
>> > {NULL, 0} } },
>> >  {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, {
>> > {NULL, 0} } },
>> > {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, {
>> > {NULL, 0} } },
>> >  {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"quot", 4} } }, {0, {
>> > {NULL, 0} } },
>> > {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"amp", 3} } }, {0, {
>> > {"apos", 4} } },
>> >  {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, {
>> > {NULL, 0} } },
>> > {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, {
>> > {NULL, 0} } },
>> >  {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, {
>> > {NULL, 0} } },
>> > {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, {
>> > {NULL, 0} } },
>> >  {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, {
>> > {NULL, 0} } },
>> > {0, { {"lt", 2} } }, {0, { {NULL, 0} } }, {0, { {"gt", 2} } }, {0, {
>> > {NULL, 0} } },
>> > };
>> >
>> > IIRC
>> > I may be wrong.
>> >
>> >
>> >> Is there a bitmask I'm missing or are those simply not
>> >> supported right now?  If the latter, any thoughts on adding something
>> >> along
>> >> the lines of ENT_ALL to convert all valid entities from/to their
>> >> respective
>> >> characters?
>> >>
>> >
>> > What you are looking for is html_entity_decode(), I think.
>> >
>> > $ php -n -r 'var_dump(html_entity_decode("&#10;&#61;"));'
>> > string(2) "
>> > ="
>> >
>> >
>> Yeah I tried html_entity_decode already, but it just returned NULL.  On
>> the
>> same input string, htmlspecialchars_decode returned the input string but
>> with *some* special characters decoded; 10 and 13 ("\r\n", I think) were
>>
>> left in their encoded state.  I'm not sure why there wouldn't be an option
>> to decode all html special characters.
>>
>
> The html_entity_decode() function shouldn't return NULL, but even an empty
> string sounds like a bug, could you file a report for this and provide a
> reproducible test code?
>

Yeah I admit it could be an empty string as opposed to NULL.  I wasn't
using a var_dump() so I just assumed.

I'll take another look at it and get those details.

--Kris

Reply via email to