Bug #53728 [NEW]: Recursive Reference or Repetition Don't Works
| From: | i at WalkinRaven dot name | Date: | Wed, 12 Jan 2011 17:25:28 +0000 |
| Subject: | Bug #53728 [NEW]: Recursive Reference or Repetition Don't Works | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-157861@lists.php.net to get a copy of this message | ||
From:
Operating system: Ubuntu 11.04
PHP version: 5.3SVN-2011-01-12 (SVN)
Package: PCRE related
Bug Type: Bug
Bug description:Recursive Reference or Repetition Don't Works
Description:
------------
PCRE 8.02 2010-03-19
I use the code below to validate domain names according to RFC 1034 3.5
http://www.rfc-editor.org/rfc/rfc1034.txt
This rules is:
<domain> ::=<subdomain> | " "
<subdomain> ::=<label> |<subdomain> "."<label>
<label> ::=<letter> [ [<ldh-str> ]<let-dig> ]
<ldh-str> ::=<let-dig-hyp> |<let-dig-hyp> <ldh-str>
<let-dig-hyp> ::=<let-dig> | "-"
<let-dig> ::=<letter> |<digit>
<letter> ::= any one of the 52 alphabetic characters A through Z in
upper case and a through z in lower case
<digit> ::= any one of the ten digits 0 through 9
I've checked my pattern many times, and guess there may something wrong
with PCRE.
Test script:
---------------
$domain = 'www.WalkinRaven.name';
$result = \preg_match
(
'/^
(?P<label>
(?P<letter>[a-z]) | # One-letter
domain name
(?P>letter) (?P<let_dig>[a-z 0-9]) | #
Two-letters domain name
(?P>letter) (?P<ldh_str>[a-z 0-9 \-]){1,61} (?P>let_dig) #
More-letters domain name
)
(\. (?P>label))*+ # More labels
\.? # Root domain name
$/Dix',
$domain
);
echo $result;
Expected result:
----------------
1
Actual result:
--------------
0
--
Edit bug report at http://bugs.php.net/bug.php?id=53728&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53728&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53728&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53728&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=53728&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53728&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=53728&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=53728&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=53728&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=53728&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=53728&r=support
Expected behavior: http://bugs.php.net/fix.php?id=53728&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=53728&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=53728&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=53728&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53728&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53728&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=53728&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=53728&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=53728&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=53728&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=53728&r=mysqlcfg