Edit report at http://bugs.php.net/bug.php?id=53728&edit=1

 ID:                 53728
 Comment by:         i at WalkinRaven dot name
 Reported by:        i at WalkinRaven dot name
 Summary:            Recursive Reference or Repetition Don't Works
 Status:             Bogus
 Type:               Bug
 Package:            PCRE related
 Operating System:   Ubuntu 11.04
 PHP Version:        5.3SVN-2011-01-12 (SVN)
 Block user comment: N
 Private report:     N

 New Comment:

No, I think this is a bug, for if you just remove all references, like
changing regular expression to:



/^

    (

      [a-z] |                                      # One-letter domain
name

      [a-z] [a-z 0-9] |                     # Two-letters domain name

      [a-z] ([a-z 0-9 \-]){1,61} [a-z 0-9] # More-letters domain name

)

(\. (

      [a-z] |                                      # One-letter domain
name

      [a-z] [a-z 0-9] |                     # Two-letters domain name

      [a-z] ([a-z 0-9 \-]){1,61} [a-z 0-9] # More-letters domain name

))*?  # More labels

\.?                # Root domain name

$/Dix



All others are not changed, you will get the right result.



P.S. in original I've written a mistake for "(\. (?P>label))*+  # More
labels" should be "(\. (?P>label))*?  # More labels".


Previous Comments:
------------------------------------------------------------------------
[2011-01-12 22:55:40] [email protected]

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.



------------------------------------------------------------------------
[2011-01-12 18:25:27] i at WalkinRaven dot name

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 this bug report at http://bugs.php.net/bug.php?id=53728&edit=1

Reply via email to