From 5a3e57c2f5e558f88fbd83010ff64632bec46123 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 24 Sep 2015 12:48:44 +0200 Subject: [PATCH] encode arrays as string --- core/command/app/checkcode.php | 3 --- lib/private/app/codechecker/infochecker.php | 7 ++++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/core/command/app/checkcode.php b/core/command/app/checkcode.php index 0db9958f38..9f6e0729ce 100644 --- a/core/command/app/checkcode.php +++ b/core/command/app/checkcode.php @@ -127,9 +127,6 @@ class CheckCode extends Command { if($value === [] || is_null($value) || $value === '') { $output->writeln("Deprecated field available: $key"); } else { - if(is_array($value)) { - $value = 'Array of ' . count($value) . ' element(s)'; - } $output->writeln("Deprecated field available: $key => $value"); } }); diff --git a/lib/private/app/codechecker/infochecker.php b/lib/private/app/codechecker/infochecker.php index 2af72ebedc..1272707a33 100644 --- a/lib/private/app/codechecker/infochecker.php +++ b/lib/private/app/codechecker/infochecker.php @@ -39,6 +39,7 @@ class InfoChecker extends BasicEmitter { private $optionalFields = [ 'bugs', 'category', + 'dependencies', 'documentation', 'namespace', 'ocsid', @@ -51,6 +52,7 @@ class InfoChecker extends BasicEmitter { ]; private $deprecatedFields = [ 'default_enable', + 'info', 'public', 'remote', 'shipped', @@ -76,6 +78,9 @@ class InfoChecker extends BasicEmitter { $info = $this->infoParser->parse($appPath . '/appinfo/info.xml'); foreach ($info as $key => $value) { + if(is_array($value)) { + $value = json_encode($value); + } if (in_array($key, $this->mandatoryFields)) { $this->emit('InfoChecker', 'mandatoryFieldFound', [$key, $value]); continue; @@ -88,7 +93,7 @@ class InfoChecker extends BasicEmitter { if (in_array($key, $this->deprecatedFields)) { // skip empty arrays - empty arrays for remote and public are always added - if($value === []) { + if($value === '[]' && in_array($key, ['public', 'remote', 'info'])) { continue; } $this->emit('InfoChecker', 'deprecatedFieldFound', [$key, $value]);