Hello,

I get the following warning: preg_replace() [function.preg-replace]: Empty regular expression in ...... on line 32

line 32

$route= $path[0];

My code is

$path = array_keys($_GET);
		$config = loader::load("config");
		if (!isset($path[0]))
			{
				$default_controller = $config->default_controller;
				if (!empty($default_controller))
				$path[0] = $default_controller;
				else
			$path[0] = "index";
			}

	$route= $path[0];
	$sanitzing_pattern = $config->allowed_url_chars;
	$route = preg_replace($sanitzing_pattern, "", $route);
	$route = str_replace("^","",$route);
	$this->route = $route;
	$routeParts = split( "/",$route);
	$this->controller=$routeParts[0];
	$this->action=isset($routeParts[1])? $routeParts[1]:"base";
	array_shift($routeParts);
	array_shift($routeParts);
	$this->params=$routeParts;

Any idea?

    What is the value of $config->allowed_url_chars ? Is it empty?

      You would also need to ensure that the value contained within $config->allowed_url_chars contains proper opening and closing delimiters, as you are plugging this variable's value as the pattern within preg.

        $routeParts = split( "/",$route); 

        On a tangent, this ought to be [man]explode[/man] (see the [man]split[/man] page to see why).

          Write a Reply...