Coder Social home page Coder Social logo

[Bug]: [PHP] Error: Array to string conversion at /usr/share/nginx/nextcloud/lib/private/App/DependencyAnalyzer.php#398 about server HOT 8 OPEN

corsairius avatar corsairius commented on July 2, 2024
[Bug]: [PHP] Error: Array to string conversion at /usr/share/nginx/nextcloud/lib/private/App/DependencyAnalyzer.php#398

from server.

Comments (8)

joshtrichards avatar joshtrichards commented on July 2, 2024

Not able to reproduce so far, but I'll leave open while we await other reports.

Any particular section or app profile trigger this for you?

from server.

corsairius avatar corsairius commented on July 2, 2024

Just entering the Apps section throws this error.

from server.

kesselb avatar kesselb commented on July 2, 2024

Hi,

please apply the following patch to your installation. Then try opening the apps section again and then check your logfile for "array given to DependencyAnalyzer.getValue" and share the complete logline with us.

Index: lib/private/App/DependencyAnalyzer.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/lib/private/App/DependencyAnalyzer.php b/lib/private/App/DependencyAnalyzer.php
--- a/lib/private/App/DependencyAnalyzer.php	(revision 806e390d14123f0bdf9e805bd55553339a0b5d3b)
+++ b/lib/private/App/DependencyAnalyzer.php	(date 1717527159746)
@@ -31,6 +31,7 @@
 namespace OC\App;
 
 use OCP\IL10N;
+use function OCP\Log\logger;
 
 class DependencyAnalyzer {
 	/** @var array */
@@ -395,6 +396,12 @@
 		if (isset($element['@value'])) {
 			return $element['@value'];
 		}
+		if (is_array($element)) {
+			logger('core')->error('array given to DependencyAnalyzer.getValue', [
+				'element' => $element,
+				'trace' => new \Exception('array given to DependencyAnalyzer.getValue')
+			]);
+		}
 		return (string)$element;
 	}
 }

from server.

corsairius avatar corsairius commented on July 2, 2024

{"reqId":"WWII5J4EAuEPo2n7Oyod","level":3,"time":"2024-06-05T00:07:34+00:00","remoteAddr":"192.168.64.1","user":"xxx","app":"core","method":"GET","url":"/settings/apps/list","message":"array given to DependencyAnalyzer.getValue","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36","version":"29.0.1.1","data":{"app":"core","element":"{"min-version":"5.7"}","trace":"{"class":"Exception","message":"array given to DependencyAnalyzer.getValue","code":0,"file":"/usr/share/nginx/nextcloud/lib/private/App/DependencyAnalyzer.php:402","trace":"#0 /usr/share/nginx/nextcloud/lib/private/App/DependencyAnalyzer.php(215): OC\App\DependencyAnalyzer->getValue()\n#1 [internal function]: OC\App\DependencyAnalyzer->OC\App\{closure}()\n#2 /usr/share/nginx/nextcloud/lib/private/App/DependencyAnalyzer.php(214): array_map()\n#3 /usr/share/nginx/nextcloud/lib/private/App/DependencyAnalyzer.php(65): OC\App\DependencyAnalyzer->analyzeDatabases()\n#4 /usr/share/nginx/nextcloud/apps/settings/lib/Controller/AppSettingsController.php(348): OC\App\DependencyAnalyzer->analyze()\n#5 [internal function]: OCA\Settings\Controller\AppSettingsController->OCA\Settings\Controller\{closure}()\n#6 /usr/share/nginx/nextcloud/apps/settings/lib/Controller/AppSettingsController.php(319): array_map()\n#7 /usr/share/nginx/nextcloud/lib/private/AppFramework/Http/Dispatcher.php(232): OCA\Settings\Controller\AppSettingsController->listApps()\n#8 /usr/share/nginx/nextcloud/lib/private/AppFramework/Http/Dispatcher.php(138): OC\AppFramework\Http\Dispatcher->executeController()\n#9 /usr/share/nginx/nextcloud/lib/private/AppFramework/App.php(184): OC\AppFramework\Http\Dispatcher->dispatch()\n#10 /usr/share/nginx/nextcloud/lib/private/Route/Router.php(338): OC\AppFramework\App::main()\n#11 /usr/share/nginx/nextcloud/lib/base.php(1050): OC\Route\Router->match()\n#12 /usr/share/nginx/nextcloud/index.php(49): OC::handleRequest()\n#13 {main}"}"},"id":"665fac57c61b0"}

from server.

kesselb avatar kesselb commented on July 2, 2024

Thanks 👍

Somehow, the min-version definition for a database in info.xml seems to trigger that error.

To loop over all files and find the min-version definitions:
grep -i -r "<database min-version=" .

I think it could be the sensorloggers app:
https://github.com/search?q=%3Cdatabase+min-version%3D%225.7&type=code

The definition itself looks correct. I'm unsure why it fails here.
Maybe because it's only one database definition.

Seems like this block is missing to make it work.
However, comparing the min-version for database is not implemented anyway 🙈

Index: lib/private/App/DependencyAnalyzer.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/lib/private/App/DependencyAnalyzer.php b/lib/private/App/DependencyAnalyzer.php
--- a/lib/private/App/DependencyAnalyzer.php	(revision cac6443cbbc1aadb56e0499b19588386fd0c3cce)
+++ b/lib/private/App/DependencyAnalyzer.php	(date 1717578526379)
@@ -186,6 +186,9 @@
 		if (!is_array($supportedDatabases)) {
 			$supportedDatabases = [$supportedDatabases];
 		}
+		if (isset($supportedDatabases['@value'])) {
+			$supportedDatabases = [$supportedDatabases];
+		}
 		$supportedDatabases = array_map(function ($db) {
 			return $this->getValue($db);
 		}, $supportedDatabases);

from server.

corsairius avatar corsairius commented on July 2, 2024

{"reqId":"jd5vyyp43IHt21mElXF9","level":3,"time":"2024-06-05T13:12:46+00:00","remoteAddr":"192.168.64.1","user":"xxx","app":"core","method":"GET","url":"/settings/apps/list","message":"array given to DependencyAnalyzer.getValue","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36","version":"29.0.1.1","data":{"app":"core","element":"{"min-version":"5.7"}","trace":"{"class":"Exception","message":"array given to DependencyAnalyzer.getValue","code":0,"file":"/usr/share/nginx/nextcloud/lib/private/App/DependencyAnalyzer.php:402","trace":"#0 /usr/share/nginx/nextcloud/lib/private/App/DependencyAnalyzer.php(215): OC\App\DependencyAnalyzer->getValue()\n#1 [internal function]: OC\App\DependencyAnalyzer->OC\App\{closure}()\n#2 /usr/share/nginx/nextcloud/lib/private/App/DependencyAnalyzer.php(214): array_map()\n#3 /usr/share/nginx/nextcloud/lib/private/App/DependencyAnalyzer.php(65): OC\App\DependencyAnalyzer->analyzeDatabases()\n#4 /usr/share/nginx/nextcloud/apps/settings/lib/Controller/AppSettingsController.php(348): OC\App\DependencyAnalyzer->analyze()\n#5 [internal function]: OCA\Settings\Controller\AppSettingsController->OCA\Settings\Controller\{closure}()\n#6 /usr/share/nginx/nextcloud/apps/settings/lib/Controller/AppSettingsController.php(319): array_map()\n#7 /usr/share/nginx/nextcloud/lib/private/AppFramework/Http/Dispatcher.php(232): OCA\Settings\Controller\AppSettingsController->listApps()\n#8 /usr/share/nginx/nextcloud/lib/private/AppFramework/Http/Dispatcher.php(138): OC\AppFramework\Http\Dispatcher->executeController()\n#9 /usr/share/nginx/nextcloud/lib/private/AppFramework/App.php(184): OC\AppFramework\Http\Dispatcher->dispatch()\n#10 /usr/share/nginx/nextcloud/lib/private/Route/Router.php(338): OC\AppFramework\App::main()\n#11 /usr/share/nginx/nextcloud/lib/base.php(1050): OC\Route\Router->match()\n#12 /usr/share/nginx/nextcloud/index.php(49): OC::handleRequest()\n#13 {main}"}"},"id":"666064552b50f"}

{"reqId":"Uq6X5LgJWuQVJJ8mOkzX","level":3,"time":"2024-06-05T13:12:45+00:00","remoteAddr":"192.168.64.1","user":"xxx","app":"PHP","method":"GET","url":"/settings/apps/list","message":"Array to string conversion at /usr/share/nginx/nextcloud/lib/private/App/DependencyAnalyzer.php#405","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36","version":"29.0.1.1","data":{"app":"PHP"},"id":"666064552b522"}

from server.

kesselb avatar kesselb commented on July 2, 2024

@corsairius It should work again if you remove the sensorloggers app (if possible with occ or by deleting the folder).

from server.

corsairius avatar corsairius commented on July 2, 2024

Removed the sensorloggers from the disabled app list, as well as the others hanging around. Appears corrected. Thanks!

from server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.