01131: input markup does not accept array operator '[]' characters as part of name

Summary: input markup does not accept array operator '[]' characters as part of name
Created: 2009-08-04 15:25
Status: Closed (added for 2.2.5)
Category: Bug
From: HansB
Assigned:
Priority: 5
Version: 2.2
OS:

Description: Since version 2.2 I think characters '[]' are disallowed in name values of input markup. This change cripples markup relying on such array operator characters. Input markup with names like name=chk[] was passed on in earlier versions, allowing php to construct an array. Most used with checkboxes and radio buttons.

This change did cripple recipe StarRater, and possibly applications of Fox.

I ask to make it possible again to use markup like

(:input checkbox chk[] value1:)
(:input checkbox chk[] value2:)
(:input checkbox chk[] value3:)

Can the [] characters be included in line 101 forms.php, i.e.

$opt['name'] = preg_replace('/[^-A-Za-z0-9:_.\[\]]+/', '_', $opt['name']);

See more info
http://stackoverflow.com/questions/1010941/html-input-arrays

This line follows the standard for Basic HTML data types: ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). (W3C Reference) so it is not a bug. I think however that we could add an exception. --Petko August 05, 2009, at 07:20 AM

Array
(
    [post_max_size] => 64M
    [$_POST keys] => 
    [$_REQUEST keys] => n
    [$_SERVER] => Array
        (
            [CONTEXT_DOCUMENT_ROOT] => /home/pmwiki/public_html
            [CONTEXT_PREFIX] => 
            [DOCUMENT_ROOT] => /home/pmwiki/public_html
            [GATEWAY_INTERFACE] => CGI/1.1
            [HTTPS] => on
            [HTTP_ACCEPT] => */*
            [HTTP_ACCEPT_ENCODING] => gzip, br, zstd, deflate
            [HTTP_HOST] => www.pmwiki.org
            [HTTP_REFERER] => http://www.pmwiki.org/wiki/PITS/01131
            [HTTP_USER_AGENT] => Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
            [HTTP_X_HTTPS] => 1
            [PATH] => /bin:/usr/bin
            [PHP_INI_SCAN_DIR] => /opt/cpanel/ea-php70/root/etc:/opt/cpanel/ea-php70/root/etc/php.d:.
            [QUERY_STRING] => n=PITS%2f01131
            [REDIRECT_HTTPS] => on
            [REDIRECT_QUERY_STRING] => n=PITS%2f01131
            [REDIRECT_SCRIPT_URI] => https://www.pmwiki.org/wiki/PITS/01131
            [REDIRECT_SCRIPT_URL] => /wiki/PITS/01131
            [REDIRECT_SSL_TLS_SNI] => www.pmwiki.org
            [REDIRECT_STATUS] => 200
            [REDIRECT_UNIQUE_ID] => afKoh0wJWzhkO8fC__-WjAAAAUo
            [REDIRECT_URL] => /wiki/PITS/01131
            [REMOTE_ADDR] => 216.73.216.31
            [REMOTE_PORT] => 58039
            [REQUEST_METHOD] => GET
            [REQUEST_SCHEME] => https
            [REQUEST_URI] => /wiki/PITS/01131
            [SCRIPT_FILENAME] => /home/pmwiki/public_html/index.php
            [SCRIPT_NAME] => /index.php
            [SCRIPT_URI] => https://www.pmwiki.org/wiki/PITS/01131
            [SCRIPT_URL] => /wiki/PITS/01131
            [SERVER_ADDR] => 23.254.203.248
            [SERVER_ADMIN] => webmaster@pmwiki.org
            [SERVER_NAME] => www.pmwiki.org
            [SERVER_PORT] => 443
            [SERVER_PROTOCOL] => HTTP/1.1
            [SERVER_SIGNATURE] => 
            [SERVER_SOFTWARE] => Apache
            [SSL_TLS_SNI] => www.pmwiki.org
            [TZ] => America/Los_Angeles
            [UNIQUE_ID] => afKoh0wJWzhkO8fC__-WjAAAAUo
            [PHP_SELF] => /index.php
            [REQUEST_TIME_FLOAT] => 1777510535.7142
            [REQUEST_TIME] => 1777510535
            [argv] => Array
                (
                    [0] => n=PITS%2f01131
                )

            [argc] => 1
        )

)