Merge branch '3.4' into 4.3

* 3.4:
  Simpler example for Apache basic auth workaround
  [Console] Fix trying to access array offset on value of type int
  [Process] add tests for php executable finder if file does not exist
  [Cache] Make sure we get the correct number of values from redis::mget()
This commit is contained in:
Nicolas Grekas 2019-11-28 11:05:26 +01:00
commit 4375742f2c
4 changed files with 26 additions and 8 deletions

View File

@ -295,7 +295,13 @@ trait RedisTrait
}
});
} else {
$values = array_combine($ids, $this->redis->mget($ids));
$values = $this->redis->mget($ids);
if (!\is_array($values) || \count($values) !== \count($ids)) {
return [];
}
$values = array_combine($ids, $values);
}
foreach ($values as $id => $v) {

View File

@ -39,8 +39,8 @@ class ArrayInput extends Input
*/
public function getFirstArgument()
{
foreach ($this->parameters as $key => $value) {
if ($key && '-' === $key[0]) {
foreach ($this->parameters as $param => $value) {
if ($param && \is_string($param) && '-' === $param[0]) {
continue;
}
@ -107,7 +107,7 @@ class ArrayInput extends Input
{
$params = [];
foreach ($this->parameters as $param => $val) {
if ($param && '-' === $param[0]) {
if ($param && \is_string($param) && '-' === $param[0]) {
if (\is_array($val)) {
foreach ($val as $v) {
$params[] = $param.('' != $v ? '='.$this->escapeToken($v) : '');

View File

@ -46,13 +46,13 @@ class ServerBag extends ParameterBag
/*
* php-cgi under Apache does not pass HTTP Basic user/pass to PHP by default
* For this workaround to work, add these lines to your .htaccess file:
* RewriteCond %{HTTP:Authorization} ^(.+)$
* RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
* RewriteCond %{HTTP:Authorization} .+
* RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
*
* A sample .htaccess file:
* RewriteEngine On
* RewriteCond %{HTTP:Authorization} ^(.+)$
* RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
* RewriteCond %{HTTP:Authorization} .+
* RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
* RewriteCond %{REQUEST_FILENAME} !-f
* RewriteRule ^(.*)$ app.php [QSA,L]
*/

View File

@ -46,4 +46,16 @@ class PhpExecutableFinderTest extends TestCase
$this->assertEquals($f->findArguments(), [], '::findArguments() returns no arguments');
}
}
public function testNotExitsBinaryFile()
{
$f = new PhpExecutableFinder();
$phpBinaryEnv = PHP_BINARY;
putenv('PHP_BINARY=/usr/local/php/bin/php-invalid');
$this->assertFalse($f->find(), '::find() returns false because of not exist file');
$this->assertFalse($f->find(false), '::find(false) returns false because of not exist file');
putenv('PHP_BINARY='.$phpBinaryEnv);
}
}