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