PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_Template_Sigma » Bug #1840

stripslashes needed in _buildFunctionlist()

Details

Submitted2004-07-11 02:25 UTC
Fromspam at nickm dot org
Assignedavb
StatusClosed
PackageHTML_Template_Sigma
PHP Version4.3.7
OSFreeBSD
Roadmaps(Not assigned)

Comments

[2004-07-11 02:25 UTC] spam at nickm dot org

Description:
------------
The _getToken function deals properly with escaped quotes inside of quoted strings when dealling with callback functions. It retrieves everything until it meets an unquoted quote matching the beginning quote or the end of line. The only problem is that when the string is displayed, it still prints the backslash. This is likely the intended behavior if the atrribute was given without quotes, since it allows you to write backslashes without having to worry about escaping them. But when you've quoted the attribute, escaping any quotes inside is necessary, but not desired when printed.

Reproduce code:
---------------
func_callback ('Nixon\'s cool.')

This can be fixed by adding the stripslashes by replacing this line inside _buildFunctionlist():

$funcData['args'][] = ('"' == $arg2{0} || "'" == $arg2{0}) ? substr($arg2, 1, -1) : $arg2;

with:

$funcData['args'][] = ('"' == $arg2{0} || "'" == $arg2{0}) ? stripslashes(substr($arg2, 1, -1)) : $arg2;

Expected result:
----------------
Nixon's cool.

Actual result:
--------------
Nixon\'s cool.