Skip to content

Commit 9bf9194

Browse files
Merge pull request #41406 from owncloud/disable_phar_wrapper
fix: disable the phar wrapper globally
2 parents 5acafd9 + 72184d6 commit 9bf9194

File tree

6 files changed

+6
-5
lines changed

6 files changed

+6
-5
lines changed

console.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ function exceptionHandler($exception) {
5454
// set to run indefinitely if needed
5555
\set_time_limit(0);
5656

57+
stream_wrapper_unregister('phar'); // disable phar wrapper
58+
5759
if (!OC::$CLI) {
5860
echo "This script can be run from the command line only" . PHP_EOL;
5961
exit(1);

cron.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
require_once __DIR__ . '/lib/base.php';
3535

36+
stream_wrapper_unregister('phar'); // disable phar wrapper
3637
if (!\OC::$CLI) {
3738
$url = \OC::$server->getURLGenerator()->linkToRoute('core.Cron.run');
3839
\header("Location: $url");

index.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
try {
3131
require_once __DIR__ . '/lib/base.php';
32+
stream_wrapper_unregister('phar'); // disable phar wrapper
3233
OC::handleRequest();
3334
} catch (\OC\ServiceUnavailableException $ex) {
3435
\OC::$server->getLogger()->logException($ex, ['app' => 'index']);

lib/kernel.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -569,11 +569,6 @@ public static function init() {
569569
@\ini_set('post_max_size', '10G');
570570
@\ini_set('file_uploads', '50');
571571

572-
// disable phar handler in web requests
573-
if (!self::$CLI) {
574-
stream_wrapper_unregister("phar");
575-
}
576-
577572
self::setRequiredIniValues();
578573
self::handleAuthHeaders();
579574
self::registerAutoloaderCache();

public.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
*/
2929
try {
3030
require_once __DIR__ . '/lib/base.php';
31+
stream_wrapper_unregister('phar'); // disable phar wrapper
3132
if (\OCP\Util::needUpgrade()) {
3233
// since the behavior of apps or remotes are unpredictable during
3334
// an upgrade, return a 503 directly

remote.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ function resolveService($service) {
116116
try {
117117
require_once __DIR__ . '/lib/base.php';
118118

119+
stream_wrapper_unregister('phar'); // disable phar wrapper
119120
// All resources served via the DAV endpoint should have the strictest possible
120121
// policy. Exempted from this is the SabreDAV browser plugin which overwrites
121122
// this policy with a softer one if debug mode is enabled.

0 commit comments

Comments
 (0)