Fix compatibility with php 7.4
This commit is contained in:
parent
593091f399
commit
ea19ab96c3
@ -263,13 +263,7 @@ class AutoLoader
|
||||
* @return bool false unless className now exists
|
||||
*/
|
||||
private function loadLastResort($className, $loader = null) {
|
||||
// @CHANGE LDR Add protection to avoid conflict with other autoloader
|
||||
/*print 'Try to load '.$className."\n";
|
||||
if (in_array($className, array('Google_Client')))
|
||||
{
|
||||
return false;
|
||||
}*/
|
||||
$loaders = array_unique(static::$rogueLoaders);
|
||||
$loaders = array_unique(static::$rogueLoaders);
|
||||
if (isset($loader)) {
|
||||
if (false === array_search($loader, $loaders))
|
||||
static::$rogueLoaders[] = $loader;
|
||||
|
||||
@ -159,7 +159,7 @@ class CommentParser
|
||||
$addNewline = true;
|
||||
}
|
||||
continue;
|
||||
} elseif ($line{0} == '@') {
|
||||
} elseif ($line[0] == '@') {
|
||||
$mode = 2;
|
||||
$newParam = true;
|
||||
}
|
||||
@ -353,7 +353,7 @@ class CommentParser
|
||||
$data = $format->decode($str);
|
||||
}
|
||||
} else { // auto detect
|
||||
if ($str{0} == '{') {
|
||||
if ($str[0] == '{') {
|
||||
$d = json_decode($str, true);
|
||||
if (json_last_error() != JSON_ERROR_NONE) {
|
||||
throw new Exception('Error parsing embedded JSON data'
|
||||
@ -445,7 +445,7 @@ class CommentParser
|
||||
{
|
||||
$r = array();
|
||||
$email = end($value);
|
||||
if ($email{0} == '<') {
|
||||
if ($email[0] == '<') {
|
||||
$email = substr($email, 1, -1);
|
||||
array_pop($value);
|
||||
$r['email'] = $email;
|
||||
@ -470,7 +470,7 @@ class CommentParser
|
||||
$data = array_shift($value);
|
||||
if (empty($data)) {
|
||||
$r['type'] = 'mixed';
|
||||
} elseif ($data{0} == '$') {
|
||||
} elseif ($data[0] == '$') {
|
||||
$r['name'] = substr($data, 1);
|
||||
$r['type'] = 'mixed';
|
||||
} else {
|
||||
@ -478,7 +478,7 @@ class CommentParser
|
||||
$r['type'] = count($data) == 1 ? $data[0] : $data;
|
||||
|
||||
$data = array_shift($value);
|
||||
if (!empty($data) && $data{0} == '$') {
|
||||
if (!empty($data) && $data[0] == '$') {
|
||||
$r['name'] = substr($data, 1);
|
||||
}
|
||||
}
|
||||
@ -498,7 +498,7 @@ class CommentParser
|
||||
$data = array_shift($value);
|
||||
if (empty($data)) {
|
||||
$r['type'] = 'mixed';
|
||||
} elseif ($data{0} == '$') {
|
||||
} elseif ($data[0] == '$') {
|
||||
$r['name'] = substr($data, 1);
|
||||
$r['type'] = 'mixed';
|
||||
} else {
|
||||
|
||||
@ -221,7 +221,7 @@ class XmlFormat extends Format
|
||||
$namespaces = $xml->getNamespaces();
|
||||
if (count($namespaces)) {
|
||||
$p = strpos($data, $xml->getName());
|
||||
if ($p && $data{$p - 1} == ':') {
|
||||
if ($p && $data[$p - 1] == ':') {
|
||||
$s = strpos($data, '<') + 1;
|
||||
$prefix = substr($data, $s, $p - $s - 1);
|
||||
static::$namespacedProperties[static::$rootName] = $prefix;
|
||||
|
||||
@ -198,7 +198,7 @@ class Resources implements iUseAuthentication, iProvideMultiVersionApi
|
||||
} elseif (false !== ($pos = strpos($id, '-v'))) {
|
||||
//$version = intval(substr($id, $pos + 2));
|
||||
$id = substr($id, 0, $pos);
|
||||
} elseif ($id{0} == 'v' && is_numeric($v = substr($id, 1))) {
|
||||
} elseif ($id[0] == 'v' && is_numeric($v = substr($id, 1))) {
|
||||
$id = '';
|
||||
//$version = $v;
|
||||
} elseif ($id == 'root' || $id == 'index') {
|
||||
@ -233,7 +233,7 @@ class Resources implements iUseAuthentication, iProvideMultiVersionApi
|
||||
if ($tSlash) {
|
||||
if ($fLen != $tLen && !Text::beginsWith($fullPath, $target . '/'))
|
||||
continue;
|
||||
} elseif ($fLen > $tLen + 1 && $fullPath{$tLen + 1} != '{' && !Text::beginsWith($fullPath, '{')) {
|
||||
} elseif ($fLen > $tLen + 1 && $fullPath[$tLen + 1] != '{' && !Text::beginsWith($fullPath, '{')) {
|
||||
//when mapped to root exclude paths that have static parts
|
||||
//they are listed else where under that static part name
|
||||
continue;
|
||||
@ -275,7 +275,7 @@ class Resources implements iUseAuthentication, iProvideMultiVersionApi
|
||||
if (count($parts) == 1 && $httpMethod == 'GET') {
|
||||
} else {
|
||||
for ($i = 0; $i < count($parts); $i++) {
|
||||
if (strlen($parts[$i]) && $parts[$i]{0} == '{') {
|
||||
if (strlen($parts[$i]) && $parts[$i][0] == '{') {
|
||||
$pos = $i - 1;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -533,7 +533,7 @@ class Restler extends EventDispatcher
|
||||
rtrim($path, '/') //remove trailing slash if found
|
||||
);
|
||||
|
||||
if (Defaults::$useUrlBasedVersioning && strlen($path) && $path{0} == 'v') {
|
||||
if (Defaults::$useUrlBasedVersioning && strlen($path) && $path[0] == 'v') {
|
||||
$version = intval(substr($path, 1));
|
||||
if ($version && $version <= $this->apiVersion) {
|
||||
$this->requestedApiVersion = $version;
|
||||
@ -1599,7 +1599,7 @@ class Restler extends EventDispatcher
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
if ($name{0} == '_') {
|
||||
if ($name[0] == '_') {
|
||||
$hiddenProperty = substr($name, 1);
|
||||
if (isset($this->$hiddenProperty)) {
|
||||
return $this->$hiddenProperty;
|
||||
|
||||
@ -87,7 +87,7 @@ class Routes
|
||||
foreach ($methods as $method) {
|
||||
$methodUrl = strtolower($method->getName());
|
||||
//method name should not begin with _
|
||||
if ($methodUrl{0} == '_') {
|
||||
if ($methodUrl[0] == '_') {
|
||||
continue;
|
||||
}
|
||||
$doc = $method->getDocComment();
|
||||
@ -330,7 +330,7 @@ class Routes
|
||||
if (!$type) {
|
||||
return 's';
|
||||
}
|
||||
switch ($type{0}) {
|
||||
switch ($type[0]) {
|
||||
case 'i':
|
||||
case 'f':
|
||||
return 'n';
|
||||
@ -428,7 +428,7 @@ class Routes
|
||||
}
|
||||
$index = intval(substr($k, 1));
|
||||
$details = $value[$httpMethod]['metadata']['param'][$index];
|
||||
if ($k{0} == 's' || strpos($k, static::pathVarTypeOf($v)) === 0) {
|
||||
if ($k[0] == 's' || strpos($k, static::pathVarTypeOf($v)) === 0) {
|
||||
//remove the newlines
|
||||
$data[$details['name']] = trim($v, PHP_EOL);
|
||||
} else {
|
||||
|
||||
@ -203,7 +203,7 @@ class Scope
|
||||
|
||||
$divider = '\\';
|
||||
$qualified = false;
|
||||
if ($className{0} == $divider) {
|
||||
if ($className[0] == $divider) {
|
||||
$qualified = trim($className, $divider);
|
||||
} elseif (array_key_exists($className, $scope)) {
|
||||
$qualified = $scope[$className];
|
||||
|
||||
@ -356,7 +356,7 @@ class Emmet
|
||||
$pos = strpos($string, $f, $start);
|
||||
$tokens = array();
|
||||
for ($i = $start; $i < $pos; $i++) {
|
||||
$token = $string{$i};
|
||||
$token = $string[$i];
|
||||
if (('#' == $token || '.' == $token) &&
|
||||
(!empty($tokens) || $i == 0)
|
||||
) {
|
||||
@ -368,7 +368,7 @@ class Emmet
|
||||
$r[] = $f;
|
||||
} while (false != ($f = strtok(static::DELIMITERS)));
|
||||
for ($i = $pos; $i < strlen($string); $i++) {
|
||||
$token = $string{$i};
|
||||
$token = $string[$i];
|
||||
$r[] = $tokens[] = $token;
|
||||
}
|
||||
return $r;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user