#40637 [NEW]: strip_tags does not handle single quotes correctly (regression)

Ask a Question related to PHP Bugs, Design and Development.

  1. #1

    Default #40637 [NEW]: strip_tags does not handle single quotes correctly (regression)

    From: email at steffenweber dot net
    Operating system: Linux
    PHP version: 5.2.1
    PHP Bug Type: Strings related
    Bug description: strip_tags does not handle single quotes correctly (regression)

    Description:
    ------------
    The fix for bug #40432 ([url]http://bugs.php.net/bug.php?id=40432[/url]) seems to
    have broken the strip_tags function.

    I'm using PHP 5.2.1 and have additionally applied this patch:
    [url]http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.39&r2=1.445.2.14.2.40&vie w=patch[/url]

    Reproduce code:
    ---------------
    <?php
    $html = '<span title="Bug \' Trigger">Text</span>';
    var_dump(strip_tags($html));
    ?>

    Expected result:
    ----------------
    Prints "Text".

    Actual result:
    --------------
    Prints the empty string.

    Notice that the following slightly modified code correctly prints "Text":

    <?php
    $html = '<span title="Foo">Text</span>';
    var_dump(strip_tags($html));
    ?>

    --
    Edit bug report at [url]http://bugs.php.net/?id=40637&edit=1[/url]
    --
    Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=40637&r=trysnapshot44[/url]
    Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=40637&r=trysnapshot52[/url]
    Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=40637&r=trysnapshot60[/url]
    Fixed in CVS: [url]http://bugs.php.net/fix.php?id=40637&r=fixedcvs[/url]
    Fixed in release: [url]http://bugs.php.net/fix.php?id=40637&r=alreadyfixed[/url]
    Need backtrace: [url]http://bugs.php.net/fix.php?id=40637&r=needtrace[/url]
    Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=40637&r=needscript[/url]
    Try newer version: [url]http://bugs.php.net/fix.php?id=40637&r=oldversion[/url]
    Not developer issue: [url]http://bugs.php.net/fix.php?id=40637&r=support[/url]
    Expected behavior: [url]http://bugs.php.net/fix.php?id=40637&r=notwrong[/url]
    Not enough info: [url]http://bugs.php.net/fix.php?id=40637&r=notenoughinfo[/url]
    Submitted twice: [url]http://bugs.php.net/fix.php?id=40637&r=submittedtwice[/url]
    register_globals: [url]http://bugs.php.net/fix.php?id=40637&r=globals[/url]
    PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=40637&r=php3[/url]
    Daylight Savings: [url]http://bugs.php.net/fix.php?id=40637&r=dst[/url]
    IIS Stability: [url]http://bugs.php.net/fix.php?id=40637&r=isapi[/url]
    Install GNU Sed: [url]http://bugs.php.net/fix.php?id=40637&r=gnused[/url]
    Floating point limitations: [url]http://bugs.php.net/fix.php?id=40637&r=float[/url]
    No Zend Extensions: [url]http://bugs.php.net/fix.php?id=40637&r=nozend[/url]
    MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=40637&r=mysqlcfg[/url]
    email at steffenweber dot net Guest

  2. Similar Questions and Discussions

    1. #40704 [NEW]: strip_tags does not handle single quotes correctly (another regression)
      From: email at steffenweber dot net Operating system: Linux PHP version: 5.2.1 PHP Bug Type: Strings related Bug...
    2. cfquery not escaping single quotes correctly
      It seems as if two single quotes together do not get escaped. <!--- This code works in CF5 with the proper Data OK message. It does not work on...
    3. Single Quotes vs Double Quotes
      With all that's been said in mind ('$var' unparsed "$var" parsed). The rule of thumb I follow is, if it needs to be parsed (has a $variable or \n...
    4. [PHP] Single Quotes vs Double Quotes
      Hi, Tuesday, September 9, 2003, 2:03:34 PM, you wrote: mb> Hi everyone, mb> Could somebody please explain to me the difference mb> between...
    5. Recommend pse: Quotes, Single Quotes, etc. basics
      I've been fooling with this stuff for awhile and I still have problems with quotes, double quotes, etc. I have no programming or database...
  3. #2

    Default #40637 [Opn->Asn]: strip_tags does not handle single quotes correctly (regression)

    ID: 40637
    Updated by: [email]tony2001@php.net[/email]
    Reported By: email at steffenweber dot net
    -Status: Open
    +Status: Assigned
    Bug Type: Strings related
    Operating System: Linux
    PHP Version: 5.2.1
    -Assigned To:
    +Assigned To: iliaa


    Previous Comments:
    ------------------------------------------------------------------------

    [2007-02-26 09:51:22] email at steffenweber dot net

    Description:
    ------------
    The fix for bug #40432 ([url]http://bugs.php.net/bug.php?id=40432[/url]) seems to
    have broken the strip_tags function.

    I'm using PHP 5.2.1 and have additionally applied this patch:
    [url]http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.39&r2=1.445.2.14.2.40&vie w=patch[/url]

    Reproduce code:
    ---------------
    <?php
    $html = '<span title="Bug \' Trigger">Text</span>';
    var_dump(strip_tags($html));
    ?>

    Expected result:
    ----------------
    Prints "Text".

    Actual result:
    --------------
    Prints the empty string.

    Notice that the following slightly modified code correctly prints
    "Text":

    <?php
    $html = '<span title="Foo">Text</span>';
    var_dump(strip_tags($html));
    ?>


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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=40637&edit=1[/url]
    tony2001@php.net Guest

  4. #3

    Default #40637 [Asn->Csd]: strip_tags does not handle single quotes correctly (regression)

    ID: 40637
    Updated by: [email]iliaa@php.net[/email]
    Reported By: email at steffenweber dot net
    -Status: Assigned
    +Status: Closed
    Bug Type: Strings related
    Operating System: Linux
    PHP Version: 5.2.1
    Assigned To: iliaa
    New Comment:

    This bug has been fixed in CVS.

    Snapshots of the sources are packaged every three hours; this change
    will be in the next snapshot. You can grab the snapshot at
    [url]http://snaps.php.net/[/url].

    Thank you for the report, and for helping us make PHP better.




    Previous Comments:
    ------------------------------------------------------------------------

    [2007-02-26 09:51:22] email at steffenweber dot net

    Description:
    ------------
    The fix for bug #40432 ([url]http://bugs.php.net/bug.php?id=40432[/url]) seems to
    have broken the strip_tags function.

    I'm using PHP 5.2.1 and have additionally applied this patch:
    [url]http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.39&r2=1.445.2.14.2.40&vie w=patch[/url]

    Reproduce code:
    ---------------
    <?php
    $html = '<span title="Bug \' Trigger">Text</span>';
    var_dump(strip_tags($html));
    ?>

    Expected result:
    ----------------
    Prints "Text".

    Actual result:
    --------------
    Prints the empty string.

    Notice that the following slightly modified code correctly prints
    "Text":

    <?php
    $html = '<span title="Foo">Text</span>';
    var_dump(strip_tags($html));
    ?>


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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=40637&edit=1[/url]
    iliaa@php.net Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139