Welcome Guest, Not a member yet? Register   Sign In
Anchor function in v3 throws an error if uri is an array
#1

Hello team,

this error can easily be fixed in url_helper.php (around line 160) by adding brackets around the preg_match expression like this

Code:
$site_url = is_array($uri)
           ? site_url($uri)
           : ( preg_match('#^(\w+:)?//#i', $uri) ? $uri : site_url($uri) );


Thank you
Lenny
Reply
#2

But the docs say that $uri should be a string, so you shouldn't be passing an array:

http://www.codeigniter.com/user_guide/he...tml#anchor
Quote:anchor($uri = '', $title = '', $attributes = '')

Parameters:
$uri (string) – URI string
$title (string) – Anchor title
$attributes (mixed) – HTML attributes
Reply
#3

@cronix:  This is not correct. Take a closer look at the docs please. Above your quote it says that segments can be an array too. This does not work in v3 but it worked in v2. From the docs:


Code:
The first parameter can contain any segments you wish appended to the URL. As with the site_url() function above, segments can be a string or an array.
Reply
#4

Thanx for the piece of advice (y)
Reply
Reply




Theme © iAndrew 2016 - Forum software by © MyBB