Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004805 [Quercus] minor always 10-13-11 12:26 01-05-13 22:06
Reporter lolharuki View Status public  
Assigned To nam
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 4.0.34 Product Version 4.0.22
  Product Build
Summary 0004805: Regex
Description I'm trying to run the following code:

<?php
     $pattern = '~^(([^:@]*)(:([^@]*))?@)?((?(?=[[])[[][^]]+[]]|[^:]+))(:(.*) )?$~';
     $status = @preg_match($pattern, 'www.google.com', $matches);
 
     echo ($status? 'win' : 'fail');
?>

$ php foo.php
win

But when I request /app/foo.php, it prints 'fail'.
Steps To Reproduce
Additional Information
Attached Files

- Relationships
related to 0003879closed nam vBulletin 4.0.1 - invalid conditional regexp 

- Notes
(0005708)
nemostein
03-09-12 14:06

This pattern should work:
$pattern = '~^(([^:@]*)(:([^@]*))?@)?((?:(?=[[])[[][^]]+[]]|[^:]+))(:(.*) )?$~';

For some reason, PHP accepts hidden groups to be declared like this (? ... ), but Quercus requires a colons (like PCRE specs) after the question mark, like this (?: ... ).
 
(0006144)
nam
01-05-13 22:06

php/4eh[4-b]

Fixed for 4.0.34. Conditionals now work with lookahead/lookbehind assertions.
 

- Issue History
Date Modified Username Field Change
10-13-11 12:26 lolharuki New Issue
10-19-11 11:14 ferg Project Resin => Quercus
03-09-12 14:06 nemostein Note Added: 0005708
01-05-13 22:05 nam Status new => assigned
01-05-13 22:05 nam Assigned To  => nam
01-05-13 22:05 nam Relationship added related to 0003879
01-05-13 22:06 nam Status assigned => closed
01-05-13 22:06 nam Note Added: 0006144
01-05-13 22:06 nam Resolution open => fixed
01-05-13 22:06 nam Fixed in Version  => 4.0.34


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
37 total queries executed.
31 unique queries executed.
Powered by Mantis Bugtracker