diff --git a/lib/public/AppFramework/App.php b/lib/public/AppFramework/App.php
index fa97dab2a3ff4217c55bb922dbbd1950ea6de919..016ef5a0318c8333eb749fa8cdf12726cb9edec8 100644
--- a/lib/public/AppFramework/App.php
+++ b/lib/public/AppFramework/App.php
@@ -77,7 +77,10 @@ class App {
 	 * @since 6.0.0
 	 */
 	public function __construct(string $appName, array $urlParams = []) {
-		if (\OC::$server->getConfig()->getSystemValueBool('debug')) {
+		$runIsSetupDirectly = \OC::$server->getConfig()->getSystemValueBool('debug')
+			&& (PHP_VERSION_ID < 70400 || (PHP_VERSION_ID >= 70400 && !ini_get('zend.exception_ignore_args')));
+
+		if ($runIsSetupDirectly) {
 			$applicationClassName = get_class($this);
 			$e = new \RuntimeException('App class ' . $applicationClassName . ' is not setup via query() but directly');
 			$setUpViaQuery = false;