php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #73221 Callback for PHP URL rewriter
Submitted: 2016-10-01 20:10 UTC Modified: -
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: josh dot kelly27 at outlook dot com Assigned:
Status: Open Package: Unknown/Other Function
PHP Version: 7.1.0RC3 OS: Ubuntu 16.04.1LTS
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-10-01 20:10 UTC] josh dot kelly27 at outlook dot com
Description:
------------
Hi there,
I need to use PHP's URL rewriter for sessions with a built-in web client that cannot support cookies but also has 'special' HREF attributes on certain tags, such as href="*title".

While I admit that this is certainly quite an edge case, I could certainly see many uses for a callback for the PHP URL rewriter function (passes original URL and what PHP would rewrite the URL to, function returns new URL to replace the original), for validation and such :-)

Test script:
---------------
<?php
function url_footobar($original, $rewritten) {
    return str_replace('foo', 'bar', $rewritten);
}
url_rewriter_callback('url_footobar()');
?>
<a href="http://foo.com/foo.php">foo</a>

Expected result:
----------------
<a href="http://bar.com/bar.php">foo</a>


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Aug 23 14:01:27 2019 UTC