PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13.1 1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 All 212 releases
← All changes | vendor/composer/ClassLoader.php +27 -14 1.7.0 → 1.8.13 View file →
@@ -41,8 +41,11 @@
41 41 * @see https://www.php-fig.org/psr/psr-4/
42 42 */
43 43 class ClassLoader
44 44 {
45 + /** @var \Closure(string):void */
46 + private static $includeFile;
47 +
45 48 /** @var ?string */
46 49 private $vendorDir;
47 50
48 51 // PSR-4
@@ -105,8 +108,9 @@
105 108 */
106 109 public function __construct($vendorDir = null)
107 110 {
108 111 $this->vendorDir = $vendorDir;
112 + self::initializeIncludeClosure();
109 113 }
110 114
111 115 /**
112 116 * @return string[]
@@ -424,9 +428,10 @@
424 428 */
425 429 public function loadClass($class)
426 430 {
427 431 if ($file = $this->findFile($class)) {
428 - includeFile($file);
432 + $includeFile = self::$includeFile;
433 + $includeFile($file);
429 434
430 435 return true;
431 436 }
432 437
@@ -554,19 +559,27 @@
554 559 }
555 560
556 561 return false;
557 562 }
558 -}
559 563
560 -/**
561 - * Scope isolated include.
562 - *
563 - * Prevents access to $this/self from included files.
564 - *
565 - * @param string $file
566 - * @return void
567 - * @private
568 - */
569 -function includeFile($file)
570 -{
571 - include $file;
564 + /**
565 + * @return void
566 + */
567 + private static function initializeIncludeClosure()
568 + {
569 + if (self::$includeFile !== null) {
570 + return;
571 + }
572 +
573 + /**
574 + * Scope isolated include.
575 + *
576 + * Prevents access to $this/self from included files.
577 + *
578 + * @param string $file
579 + * @return void
580 + */
581 + self::$includeFile = \Closure::bind(static function($file) {
582 + include $file;
583 + }, null, null);
584 + }
572 585 }