Merge branch '2.8' into 3.1
* 2.8: [2.7][VarDumper] Fix PHP 7.1 compat [2.8][VarDumper] Fix PHP 7.1 compat silent file operation to avoid open basedir issues
This commit is contained in:
commit
df3dbc510e
@ -79,7 +79,7 @@ class ExecutableFinder
|
||||
}
|
||||
foreach ($suffixes as $suffix) {
|
||||
foreach ($dirs as $dir) {
|
||||
if (is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || is_executable($file))) {
|
||||
if (@is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || is_executable($file))) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ class ReflectionCaster
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
|
||||
$a += array(
|
||||
$prefix.'type' => $c->__toString(),
|
||||
$prefix.'name' => method_exists('ReflectionType', 'getName') ? $c->getName() : $c->__toString(),
|
||||
$prefix.'allowsNull' => $c->allowsNull(),
|
||||
$prefix.'isBuiltin' => $c->isBuiltin(),
|
||||
);
|
||||
@ -157,7 +157,7 @@ class ReflectionCaster
|
||||
));
|
||||
|
||||
if (isset($a[$prefix.'returnType'])) {
|
||||
$a[$prefix.'returnType'] = (string) $a[$prefix.'returnType'];
|
||||
$a[$prefix.'returnType'] = method_exists('ReflectionType', 'getName') ? $a[$prefix.'returnType']->getName() : $a[$prefix.'returnType']->__toString();
|
||||
}
|
||||
if (isset($a[$prefix.'this'])) {
|
||||
$a[$prefix.'this'] = new CutStub($a[$prefix.'this']);
|
||||
@ -213,12 +213,13 @@ class ReflectionCaster
|
||||
'position' => 'getPosition',
|
||||
'isVariadic' => 'isVariadic',
|
||||
'byReference' => 'isPassedByReference',
|
||||
'allowsNull' => 'allowsNull',
|
||||
));
|
||||
|
||||
try {
|
||||
if (method_exists($c, 'hasType')) {
|
||||
if ($c->hasType()) {
|
||||
$a[$prefix.'typeHint'] = $c->getType()->__toString();
|
||||
$a[$prefix.'typeHint'] = method_exists('ReflectionType', 'getName') ? $c->getType()->getName() : $c->getType()->__toString();
|
||||
}
|
||||
} else {
|
||||
$v = explode(' ', $c->__toString(), 6);
|
||||
@ -231,15 +232,22 @@ class ReflectionCaster
|
||||
$a[$prefix.'typeHint'] = $m[1];
|
||||
}
|
||||
}
|
||||
if (!isset($a[$prefix.'typeHint'])) {
|
||||
unset($a[$prefix.'allowsNull']);
|
||||
}
|
||||
|
||||
try {
|
||||
$a[$prefix.'default'] = $v = $c->getDefaultValue();
|
||||
if (method_exists($c, 'isDefaultValueConstant') && $c->isDefaultValueConstant()) {
|
||||
$a[$prefix.'default'] = new ConstStub($c->getDefaultValueConstantName(), $v);
|
||||
}
|
||||
if (null === $v) {
|
||||
unset($a[$prefix.'allowsNull']);
|
||||
}
|
||||
} catch (\ReflectionException $e) {
|
||||
if (isset($a[$prefix.'typeHint']) && $c->allowsNull()) {
|
||||
if (isset($a[$prefix.'typeHint']) && $c->allowsNull() && !method_exists('ReflectionType', 'getName')) {
|
||||
$a[$prefix.'default'] = null;
|
||||
unset($a[$prefix.'allowsNull']);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user