php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76861 Delimiter Bug using <
Submitted: 2018-09-11 09:37 UTC Modified: 2018-09-11 09:46 UTC
From: christian dot engelbert at googlemail dot com Assigned:
Status: Not a bug Package: *Regular Expressions
PHP Version: 7.0.31 OS: Linux 3.13.0-93-generic Ubuntu
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
19 + 36 = ?
Subscribe to this entry?

 
 [2018-09-11 09:37 UTC] christian dot engelbert at googlemail dot com
Description:
------------
If the character '<' is used as a delimitier preg_replace forces the character '>' as ending delimiter. '<' is not working in this case. While using '>' as starting delimiter for the RegEx '>' is awaited to be used as the ending delimiter also.

Test script:
---------------
preg_replace('<p<', '', 'Apple');


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-09-11 09:41 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2018-09-11 09:41 UTC] requinix@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

http://php.net/manual/en/regexp.reference.delimiters.php
 [2018-09-11 09:42 UTC] peehaa@php.net
-Status: Not a bug +Status: Open
 [2018-09-11 09:42 UTC] peehaa@php.net
Several delimiters are special cased:

> It is also possible to use bracket style delimiters where the opening and closing brackets are the starting and ending delimiter, respectively. (), {}, [] and <> are all valid bracket style delimiter pairs. 

https://secure.php.net/manual/en/regexp.reference.delimiters.php
 [2018-09-11 09:43 UTC] peehaa@php.net
-Status: Open +Status: Not a bug
 [2018-09-11 09:43 UTC] peehaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php
 [2018-09-11 09:44 UTC] peehaa@php.net
Eeeek sorry for reopening.

I got ninja'd on this one.
 [2018-09-11 09:46 UTC] requinix@php.net
Add that to the list of things to be fixed with the next version of bugs.php.net...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 00:01:27 2024 UTC