• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Setting redirection in Config/Routes.php seems to be broken

Suppose I have these route definitions in Config/Routes.php:

PHP Code:

* --------------------------------------------------------------------
* Route Definitions
* --------------------------------------------------------------------

// We get a performance increase by specifying the default
// route since we don't have to scan directories.

$routes->addRedirect('OldStuff/PHP/API/Synchronization.php',        'Apps/NewStuff/synchronize'); 

The old stuff does not exist anymore (none of it) but is coming from an old implementation of the website. Now, if somebody is entering in the browser


this leads to a PHP error when throwing an exception in CodeIgniter. So, two errors at once!


Router::checkRoutes is checking if the uri (OldStuff/PHP/API/Synchronization.php) can be found in the existing routes. This is obviously the case because the regular expression

PHP Code:
preg_match('#^' $key '$#'$uri$matches
 is true. And this is also the purpose.
If this is true the next statement checks if it is a redirection. Also this is true. Then, a RedirectException is thrown. Why is the exception thrown at all?
Unfortunately, the RedirectException is also called with the wrong parameters and therefore a PHP error occurs.

PHP Code:
throw new RedirectException(key($val), $this->collection->getRedirectCode($key)); 
$val is a simple value and not an array!  Sad

Anyway, the problem is: how do I do redirections in Config/Routes.php if not as shown? Huh

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.