recognize
recognize copied to clipboard
Installation of version 2.2.0 errors out if `open_basedir` is set
Describe the bug
The installation of the new version 2.2.0 errors out if the PHP instance has no access to /proc/cpuinfo.
To Reproduce
Limit the accessible paths via open_basedir and simply try to install that new version.
Expected behavior Properly installed recognize 2.2.0./
Additional context Exceptions from the log:
[PHP] Fehler: Error: file_get_contents(): open_basedir restriction in effect. File(/proc/cpuinfo) is not within the allowed path(s): (/var/www/nextcloud:/tmp:/mnt/storagespace_decrypted/nextcloud) at /var/www/nextcloud/apps/recognize/lib/Migration/InstallDeps.php#183 at <<closure>>
0. <<closure>>
OC\Log\ErrorHandler::onError()
1. /var/www/nextcloud/apps/recognize/lib/Migration/InstallDeps.php line 183
file_get_contents()
2. /var/www/nextcloud/apps/recognize/lib/Migration/InstallDeps.php line 100
OCA\Recognize\Migration\InstallDeps->isAVXSupported()
3. /var/www/nextcloud/lib/private/Repair.php line 124
OCA\Recognize\Migration\InstallDeps->run()
4. /var/www/nextcloud/lib/private/legacy/OC_App.php line 1082
OC\Repair->run()
5. /var/www/nextcloud/lib/private/legacy/OC_App.php line 1024
OC_App::executeRepairSteps()
6. /var/www/nextcloud/lib/private/Installer.php line 201
OC_App::updateApp("*** sensitive parameters replaced ***")
7. /var/www/nextcloud/apps/settings/lib/Controller/AppSettingsController.php line 535
OC\Installer->updateAppstoreApp("*** sensitive parameters replaced ***")
8. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 225
OCA\Settings\Controller\AppSettingsController->updateApp("*** sensitive parameters replaced ***")
9. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 133
OC\AppFramework\Http\Dispatcher->executeController()
10. /var/www/nextcloud/lib/private/AppFramework/App.php line 172
OC\AppFramework\Http\Dispatcher->dispatch()
11. /var/www/nextcloud/lib/private/Route/Router.php line 298
OC\AppFramework\App::main()
12. /var/www/nextcloud/lib/base.php line 1023
OC\Route\Router->match()
13. /var/www/nextcloud/index.php line 36
OC::handleRequest()
GET /settings/apps/update/recognize
[PHP] Fehler: Error: file_get_contents(/proc/cpuinfo): failed to open stream: Operation not permitted at /var/www/nextcloud/apps/recognize/lib/Migration/InstallDeps.php#183 at <<closure>>
0. <<closure>>
OC\Log\ErrorHandler::onError()
1. /var/www/nextcloud/apps/recognize/lib/Migration/InstallDeps.php line 183
file_get_contents()
2. /var/www/nextcloud/apps/recognize/lib/Migration/InstallDeps.php line 100
OCA\Recognize\Migration\InstallDeps->isAVXSupported()
3. /var/www/nextcloud/lib/private/Repair.php line 124
OCA\Recognize\Migration\InstallDeps->run()
4. /var/www/nextcloud/lib/private/legacy/OC_App.php line 1082
OC\Repair->run()
5. /var/www/nextcloud/lib/private/legacy/OC_App.php line 1024
OC_App::executeRepairSteps()
6. /var/www/nextcloud/lib/private/Installer.php line 201
OC_App::updateApp("*** sensitive parameters replaced ***")
7. /var/www/nextcloud/apps/settings/lib/Controller/AppSettingsController.php line 535
OC\Installer->updateAppstoreApp("*** sensitive parameters replaced ***")
8. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 225
OCA\Settings\Controller\AppSettingsController->updateApp("*** sensitive parameters replaced ***")
9. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 133
OC\AppFramework\Http\Dispatcher->executeController()
10. /var/www/nextcloud/lib/private/AppFramework/App.php line 172
OC\AppFramework\Http\Dispatcher->dispatch()
11. /var/www/nextcloud/lib/private/Route/Router.php line 298
OC\AppFramework\App::main()
12. /var/www/nextcloud/lib/base.php line 1023
OC\Route\Router->match()
13. /var/www/nextcloud/index.php line 36
OC::handleRequest()
GET /settings/apps/update/recognize
[index] Fehler: Exception: Argument 1 passed to str_contains() must be of the type string or null, bool given, called in /var/www/nextcloud/apps/recognize/lib/Migration/InstallDeps.php on line 187 in file '/var/www/nextcloud/3rdparty/symfony/polyfill-php80/bootstrap.php' line 29 at <<closure>>
0. /var/www/nextcloud/lib/private/AppFramework/App.php line 172
OC\AppFramework\Http\Dispatcher->dispatch()
1. /var/www/nextcloud/lib/private/Route/Router.php line 298
OC\AppFramework\App::main()
2. /var/www/nextcloud/lib/base.php line 1023
OC\Route\Router->match()
3. /var/www/nextcloud/index.php line 36
OC::handleRequest()
GET /settings/apps/update/recognize
@marcelklehr Apparently this check is already in a try/catch, although it seems it should throw a warning and not an exception in this case:
PHP Warning: file_get_contents(): open_basedir restriction in effect. File(/proc/cpuinfo) is not within the allowed path(s)
And I guess some php configurations handle warnings as errors?
Should we add a specific check for ini_get("open_basedir") still? Another option to prevent any similar case could be to use set_error_handler to catch warnings as exceptions, but that sounds a bit dirty :eyes:
Same in 5.0.3
[PHP] Fehler: file_get_contents(): open_basedir restriction in effect. File(/proc/cpuinfo) is not within the allowed path(s): (/var/www/.../:/tmp/:/var/lib/php/sessions:/var/www/.../tmp) at /.../apps/recognize/lib/Controller/AdminController.php#150
GET /index.php/apps/recognize/admin/avx
from xxx by admin at 2024-01-24T16:35:55+00:00