The Name displayed is corrupted when the fields that compose the realname contains apostrophe: i.e. Olga D'Amico
It display Olga D'Amico

Comments

angelopc’s picture

That looks correct, to me.

miky_italy’s picture

To me it display:

Olga D & # 0 3 9 ; Amico

without spaces between the D and the following A.

nancydru’s picture

Status: Active » Postponed (maintainer needs more info)

Yes, this is an ongoing argument with the core developers and arises out of the need to protect you from hackers.

Right now, my code is being updated for another issue, so I can't commit this fix yet, but it does seem to fix it (and I think gives me an idea for a core patch). In "function realname_make_name", on approximately line 319, you will find

        $stuff['%'. $i] = check_plain($account->$name);

Change that line to

        $stuff['%'. $i] = drupal_validate_utf8($account->$name) ? htmlspecialchars($account->$name, ENT_COMPAT) : '';

And let me know if that solves the problem.

nancydru’s picture

Assigned: Unassigned » nancydru
Status: Postponed (maintainer needs more info) » Fixed

Fix committed to 6.x only.

miky_italy’s picture

Verified for the 5.x and your patch works correctly!
Thank you,
Michele

heine’s picture

Status: Fixed » Active

The suggested fix is wrong.

The appearance of &039; means that the name is passed twice through check_plain. The realname in realname_make_name should be treated as the plain text data it is; and escaped upon using it in another context. This means that you need to escape the name with check_plain the moment it is used in an HTML context.

As you can see from the theme_username documentation, it too treats the username as plaintext and escapes it upon output (either via l() or check_plain).

Please read Safe String Theory for the web and Handle text in a secure fashion for background.

My suggestion is to treat the name as plaintext in realname_make_name (do not use check_plain), and review the uses of the name elsewhere in the module for the need for escaping.

nancydru’s picture

Status: Active » Fixed

Thank you, Heine. I have read those references several times, which is why I use check_plain. Perhaps I use it too liberally.

I have removed the check_plain/htmlspecialchars entirely. Committed to both branches.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.