Skip to content

Commit 6e86f9e

Browse files
committed
Lib: Fixed one field return, fixed encoding
- Executing a DoQuery with a single field results in the field array not being an array of fields and their values, but an array of that single field. If this is detected, it imposes another array as if there were more than one field. - Removed htmlspecialchars() from arr2Xml. This may cause issues downstream, but we will see...
1 parent ea95042 commit 6e86f9e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

quickbase.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class QuickBaseQuery {
105105

106106
protected $payload = '';
107107
protected $xmlResponse = array();
108-
108+
109109
public function __construct(&$parent, $action = '', $options = array()){
110110
$this->parent = $parent;
111111
$this->action = $action;
@@ -281,14 +281,14 @@ final protected static function arr2Xml($arr, &$xml){
281281
foreach($arr as $key => $value){
282282
if($key === '$'){
283283
foreach($value as $attr => $attrValue){
284-
$xml->addAttribute($attr, htmlspecialchars($attrValue));
284+
$xml->addAttribute($attr, $attrValue);
285285
}
286286

287287
continue;
288288
}
289289

290290
if($key === '_'){
291-
$xml[0] = htmlspecialchars($value);
291+
$xml[0] = $value;
292292

293293
continue;
294294
}
@@ -312,7 +312,7 @@ final protected static function arr2Xml($arr, &$xml){
312312
self::arr2Xml($arr[$key], $child);
313313
}
314314
}else{
315-
$xml[0] = htmlspecialchars($arr);
315+
$xml[0] = $arr;
316316
}
317317
}
318318

@@ -531,6 +531,10 @@ final public static function API_DoQuery(&$query, &$results){
531531
$newRecord['rid'] = $results['table']['records'][$i]['rid'];
532532
}
533533

534+
if(isset($results['table']['records'][$i]['f']['_'])){
535+
$results['table']['records'][$i]['f'] = array( $results['table']['records'][$i]['f'] );
536+
}
537+
534538
foreach($results['table']['records'][$i]['f'] as $key => $field){
535539
$newRecord[$field['id']] = $field['_'];
536540
}

0 commit comments

Comments
 (0)