summaryrefslogtreecommitdiff
path: root/includes/api/ApiFormatYaml_spyc.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/api/ApiFormatYaml_spyc.php')
-rw-r--r--includes/api/ApiFormatYaml_spyc.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/includes/api/ApiFormatYaml_spyc.php b/includes/api/ApiFormatYaml_spyc.php
index 05a39e23..1ec8af48 100644
--- a/includes/api/ApiFormatYaml_spyc.php
+++ b/includes/api/ApiFormatYaml_spyc.php
@@ -463,6 +463,7 @@
* @param string $line A line from the YAML file
*/
function _getIndent($line) {
+ $match = array();
preg_match('/^\s{1,}/',$line,$match);
if (!empty($match[0])) {
$indent = substr_count($match[0],' ');
@@ -500,6 +501,7 @@
} elseif (preg_match('/^(.+):/',$line,$key)) {
// It's a key/value pair most likely
// If the key is in double quotes pull it out
+ $matches = array();
if (preg_match('/^(["\'](.*)["\'](\s)*:)/',$line,$matches)) {
$value = trim(str_replace($matches[1],'',$line));
$key = $matches[2];
@@ -529,6 +531,7 @@
* @return mixed
*/
function _toType($value) {
+ $matches = array();
if (preg_match('/^("(.*)"|\'(.*)\')/',$value,$matches)) {
$value = (string)preg_replace('/(\'\'|\\\\\')/',"'",end($matches));
$value = preg_replace('/\\\\"/','"',$value);
@@ -596,6 +599,7 @@
// Check for strings
$regex = '/(?:(")|(?:\'))((?(1)[^"]+|[^\']+))(?(1)"|\')/';
+ $strings = array();
if (preg_match_all($regex,$inline,$strings)) {
$saved_strings[] = $strings[0][0];
$inline = preg_replace($regex,'YAMLString',$inline);
@@ -603,12 +607,14 @@
unset($regex);
// Check for sequences
+ $seqs = array();
if (preg_match_all('/\[(.+)\]/U',$inline,$seqs)) {
$inline = preg_replace('/\[(.+)\]/U','YAMLSeq',$inline);
$seqs = $seqs[0];
}
// Check for mappings
+ $maps = array();
if (preg_match_all('/{(.+)}/U',$inline,$maps)) {
$inline = preg_replace('/{(.+)}/U','YAMLMap',$inline);
$maps = $maps[0];
@@ -704,6 +710,7 @@
function _linkRef(&$n,$key,$k = NULL,$v = NULL) {
if (empty($k) && empty($v)) {
// Look for &refs
+ $matches = array();
if (preg_match('/^&([^ ]+)/',$n->data[$key],$matches)) {
// Flag the node so we know it's a reference
$this->_allNodes[$n->id]->ref = substr($matches[0],1);
@@ -837,7 +844,7 @@
$ret = array();
foreach($keys as $key) {
- list($unused,$val) = each($vals);
+ list( /* unused */ ,$val) = each($vals);
// This is the good part! If a key already exists, but it's part of a
// sequence (an int), just keep addin numbers until we find a fresh one.
if (isset($ret[$key]) and is_int($key)) {