Closed (outdated)
Project:
Drupal core
Version:
7.x-dev
Component:
simpletest.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
7 May 2013 at 08:52 UTC
Updated:
27 Jan 2017 at 17:52 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
pfrenssenThis problem is also present in D8, let's fix it there first.
Comment #3
pfrenssenComment #4
cyberwolf commentedAre backreferences starting with double slash handled as well (for example: \\1)? That also seems to be an issue.
Comment #5
pfrenssenGood catch, supported them in this patch, and followed your advice about using preg_replace_callback(). Also added a test to cover the double slash backreferences.
Comment #6
angel.hI've made the 7.x patch based on the patch 5 from the previous comment.
Comment #7
angel.hComment #8
cyberwolf commentedLooks good to me, thanks!
Comment #9
alexpottCommitted 43b389d and pushed to 8.x. Thanks!
Now #6 needs review for 7.x
Comment #10
damien tournoud commentedNeeds work for Drupal 7, as anonymous functions are only supported on PHP 5.3+ and Drupal 7 supports 5.2+.
Comment #11
angel.hComment #12
angel.hComment #12.0
angel.hsmall correction
Comment #13
pfrenssenIt's not possible to do this with preg_replace_callback() in PHP 5.2. You can only create anonymous functions using create_function() but this does not allow to pass variables from the current scope, like you can do with closures in PHP5.3.
Let's try it with the venerable str_replace() instead.
Comment #14
pfrenssenForgot to upload the test_only patch. This one should fail.
Comment #17
pfrenssenTests fail because str_replace() does not respect the word boundary as preg_replace('//\b/') does, it also replaces :date in "xsd:dateTime" below:
We have to respect these word boundaries.