aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/composer/ClassLoader.php
diff options
context:
space:
mode:
authorKlaus Weidenbach <Klaus.Weidenbach@gmx.net>2017-02-25 19:12:41 +0100
committerKlaus Weidenbach <Klaus.Weidenbach@gmx.net>2017-02-27 23:40:29 +0100
commit503c368f9ec08a70e4dbacd7b729568da6e4ea92 (patch)
tree94222fe6380f9d7311a41c398d7ffd28594b15d6 /vendor/composer/ClassLoader.php
parent2848d1caaf48a33ab1fb9a0c7de534287107e57e (diff)
downloadvolse-hubzilla-503c368f9ec08a70e4dbacd7b729568da6e4ea92.tar.gz
volse-hubzilla-503c368f9ec08a70e4dbacd7b729568da6e4ea92.tar.bz2
volse-hubzilla-503c368f9ec08a70e4dbacd7b729568da6e4ea92.zip
:arrow_up: :hammer: Upgrade PHP Markdown library.
The current version throws deprecated warning with PHP7.1 and PHPUnit. Upgrade the Markdown library to the current PHP Markdown Lib 1.7.0. Used composer to manage this library.
Diffstat (limited to 'vendor/composer/ClassLoader.php')
-rw-r--r--vendor/composer/ClassLoader.php36
1 files changed, 31 insertions, 5 deletions
diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php
index ac67d302a..4626994fd 100644
--- a/vendor/composer/ClassLoader.php
+++ b/vendor/composer/ClassLoader.php
@@ -55,6 +55,7 @@ class ClassLoader
private $classMap = array();
private $classMapAuthoritative = false;
private $missingClasses = array();
+ private $apcuPrefix;
public function getPrefixes()
{
@@ -272,6 +273,26 @@ class ClassLoader
}
/**
+ * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
+ *
+ * @param string|null $apcuPrefix
+ */
+ public function setApcuPrefix($apcuPrefix)
+ {
+ $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
+ }
+
+ /**
+ * The APCu prefix in use, or null if APCu caching is not enabled.
+ *
+ * @return string|null
+ */
+ public function getApcuPrefix()
+ {
+ return $this->apcuPrefix;
+ }
+
+ /**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
@@ -313,11 +334,6 @@ class ClassLoader
*/
public function findFile($class)
{
- // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
- if ('\\' == $class[0]) {
- $class = substr($class, 1);
- }
-
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
@@ -325,6 +341,12 @@ class ClassLoader
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
+ if (null !== $this->apcuPrefix) {
+ $file = apcu_fetch($this->apcuPrefix.$class, $hit);
+ if ($hit) {
+ return $file;
+ }
+ }
$file = $this->findFileWithExtension($class, '.php');
@@ -333,6 +355,10 @@ class ClassLoader
$file = $this->findFileWithExtension($class, '.hh');
}
+ if (null !== $this->apcuPrefix) {
+ apcu_add($this->apcuPrefix.$class, $file);
+ }
+
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;