From 569a001959f65aea2c0e7cd3dd5b541cac0e9e58 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Fri, 26 Mar 2010 14:10:46 +0100 Subject: Fix and simplify p_get_metadata key looping explode converts $string (false) to string ("") and returns it if $delimiter is not found, therefor looking for the key "" in metadata array. --- inc/parserutils.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'inc/parserutils.php') diff --git a/inc/parserutils.php b/inc/parserutils.php index cb8bc079d..4bec3ab1d 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -244,8 +244,7 @@ function p_get_metadata($id, $key='', $render=false){ $val = $meta['current']; // filter by $key - foreach(explode(' ', trim($key), 2) as $cur_key) { - $cur_key = trim($cur_key); + foreach(preg_split('/\s+/', $key, 2, PREG_SPLIT_NO_EMPTY) as $cur_key) { if (!isset($val[$cur_key])) { return null; } -- cgit v1.2.3