Skip to content

Commit

Permalink
Fixing bug when using a 0 in paths passed to url_for [#44 state:resol…
Browse files Browse the repository at this point in the history
…ved]
  • Loading branch information
Fabrice Luraine committed Aug 5, 2010
1 parent 360c9b4 commit 90b2fd0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/limonade.php
Expand Up @@ -1598,7 +1598,7 @@ function url_for($params = null)
$p = explode('/',$param);
foreach($p as $v)
{
if(!empty($v)) $paths[] = str_replace('%23', '#', rawurlencode($v));
if($v != "") $paths[] = str_replace('%23', '#', rawurlencode($v));
}
}

Expand Down
3 changes: 3 additions & 0 deletions tests/main.php
Expand Up @@ -182,6 +182,9 @@ function test_main_url_for()
assert_equal(url_for('mañana'), '/'.rawurlencode("mañana"));
assert_equal(url_for('test', 1, 2), '/test/1/2');
assert_equal(url_for('one', 'two', 'three'), '/one/two/three');
assert_equal(url_for('one', 0, 'three'), '/one/0/three');
assert_equal(url_for('one', '', 'three'), '/one/three');
assert_equal(url_for('one', null, 'three'), '/one/three');
assert_equal(url_for('my/hash#test'), '/my/hash#test');
$site_url = 'http://www.limonade-php.net';
assert_true((bool) filter_var_url($site_url));
Expand Down

0 comments on commit 90b2fd0

Please sign in to comment.