Permalink
Browse files

Init strings before concatenation. Props devil1591. fixes #3457

git-svn-id: http://svn.automattic.com/wordpress/trunk@4634 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
1 parent 7b5a395 commit 49565cf6089a43d798ab28da57bc067cc0db2935 markjaquith committed Dec 9, 2006
Showing with 6 additions and 4 deletions.
  1. +3 −2 wp-includes/category.php
  2. +3 −2 wp-includes/query.php
View
@@ -169,8 +169,9 @@ function get_category_by_path($category_path, $full_match = true, $output = OBJE
$category_paths = '/' . trim($category_path, '/');
$leaf_path = sanitize_title(basename($category_paths));
$category_paths = explode('/', $category_paths);
- foreach($category_paths as $pathdir)
- $full_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir);
+ $full_path = '';
+ foreach ( (array) $category_paths as $pathdir )
+ $full_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title($pathdir);
$categories = $wpdb->get_results("SELECT cat_ID, category_nicename, category_parent FROM $wpdb->categories WHERE category_nicename = '$leaf_path'");
View
@@ -819,8 +819,9 @@ function &get_posts() {
$cat_paths = '/' . trim(urldecode($q['category_name']), '/');
$q['category_name'] = sanitize_title(basename($cat_paths));
$cat_paths = explode('/', $cat_paths);
- foreach($cat_paths as $pathdir)
- $cat_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir);
+ $cat_path = '';
+ foreach ( (array) $cat_paths as $pathdir )
+ $cat_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title($pathdir);
//if we don't match the entire hierarchy fallback on just matching the nicename
if ( empty($reqcat) )

0 comments on commit 49565cf

Please sign in to comment.