sprinit Weirdness

    Date: 11/01/05 (PHP Community)    Keywords: php, linux

    Well, I was coding a BBCode Parser (rather unconventional because the parser will allow multiple attributes to a BBCode tag like [tag attrib1="" attrib2=""]...[/tag])

    Anyway, I was coding to allow escaped characters to appear inside the attribute values and I came across this weird sprintf behaviour which I wonder if it's a PHP bug.
    code:

    PHP Code:
        die(sprintf('%1$s
    ',"ABC",' style=".\"." class="class"'));
    ?>

    Expected Output:
    Code:
    ABC
    Output:
    Code:
    ABC

    It looks like sprintf doesn't like escaped quotes or something. If you add any character after the missing quote, it will appear but the quote will not.

    I tested this on PHP 5.0.4 on Windows and Linux. Can anyone confirm this problem?

    Source: http://www.livejournal.com/community/php/362176.html

« lend a hand with regular... || Quick question »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home