Merge remote-tracking branch 'origin/4.4' into 5.1

* origin/4.4:
  Fix CS
  Add a warning comment on ldap empty password
  Bump Symfony version to 4.4.14
  Update VERSION for 4.4.13
  Update CHANGELOG for 4.4.13
  [PhpunitBridge] Fix deprecation type detection
This commit is contained in:
Nicolas Grekas 2020-09-02 18:21:51 +02:00
commit 2e8ca94fb8
8 changed files with 131 additions and 3 deletions

View File

@ -7,6 +7,15 @@ in 4.4 minor versions.
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v4.4.0...v4.4.1
* 4.4.13 (2020-09-02)
* security #cve-2020-15094 Remove headers with internal meaning from HttpClient responses (mpdude)
* bug #38024 [Console] Fix undefined index for inconsistent command name definition (chalasr)
* bug #38023 [DI] fix inlining of non-shared services (nicolas-grekas)
* bug #38020 [PhpUnitBridge] swallow deprecations (xabbuh)
* bug #38010 [Cache] Psr16Cache does not handle Proxy cache items (alex-dev)
* bug #37937 [Serializer] fixed fix encoding of cache keys with anonymous classes (michaelzangerle)
* 4.4.12 (2020-08-31)
* bug #37966 [HttpClient][MockHttpClient][DX] Throw when the response factory callable does not return a valid response (fancyweb)

View File

@ -270,7 +270,10 @@ class Deprecation
if (file_exists($v.'/composer/installed.json')) {
self::$vendors[] = $v;
$loader = require $v.'/autoload.php';
$paths = self::getSourcePathsFromPrefixes(array_merge($loader->getPrefixes(), $loader->getPrefixesPsr4()));
$paths = self::addSourcePathsFromPrefixes(
array_merge($loader->getPrefixes(), $loader->getPrefixesPsr4()),
$paths
);
}
}
}
@ -286,15 +289,17 @@ class Deprecation
return self::$vendors;
}
private static function getSourcePathsFromPrefixes(array $prefixesByNamespace)
private static function addSourcePathsFromPrefixes(array $prefixesByNamespace, array $paths)
{
foreach ($prefixesByNamespace as $prefixes) {
foreach ($prefixes as $prefix) {
if (false !== realpath($prefix)) {
yield realpath($prefix);
$paths[] = realpath($prefix);
}
}
}
return $paths;
}
/**

View File

@ -0,0 +1,5 @@
<?php
require_once __DIR__.'/composer/autoload_real.php';
return ComposerAutoloaderInitFakeBis::getLoader();

View File

@ -0,0 +1,47 @@
<?php
class ComposerLoaderFakeBis
{
public function getPrefixes()
{
return [];
}
public function getPrefixesPsr4()
{
return [
'foo\\lib\\' => [__DIR__.'/../foo/lib/'],
];
}
public function loadClass($className)
{
foreach ($this->getPrefixesPsr4() as $prefix => $baseDirs) {
if (strpos($className, $prefix) !== 0) {
continue;
}
foreach ($baseDirs as $baseDir) {
$file = str_replace([$prefix, '\\'], [$baseDir, '/'], $className.'.php');
if (file_exists($file)) {
require $file;
}
}
}
}
}
class ComposerAutoloaderInitFakeBis
{
private static $loader;
public static function getLoader()
{
if (null === self::$loader) {
self::$loader = new ComposerLoaderFakeBis();
spl_autoload_register([self::$loader, 'loadClass']);
}
return self::$loader;
}
}

View File

@ -0,0 +1 @@
{"just here": "for the detection"}

View File

@ -0,0 +1,14 @@
<?php
namespace foo\lib;
class SomeOtherService
{
public function deprecatedApi()
{
@trigger_error(
__FUNCTION__.' from foo is deprecated! You should stop relying on it!',
E_USER_DEPRECATED
);
}
}

View File

@ -0,0 +1,45 @@
--TEST--
Test DeprecationErrorHandler with multiple autoload files
--FILE--
<?php
$k = 'SYMFONY_DEPRECATIONS_HELPER';
putenv($k.'='.$_SERVER[$k] = $_ENV[$k] = 'max[self]=0');
putenv('ANSICON');
putenv('ConEmuANSI');
putenv('TERM');
$vendor = __DIR__;
while (!file_exists($vendor.'/vendor')) {
$vendor = dirname($vendor);
}
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
require_once __DIR__.'/../../bootstrap.php';
eval(<<<'EOPHP'
namespace PHPUnit\Util;
class Test
{
public static function getGroups()
{
return array();
}
}
EOPHP
);
require __DIR__.'/fake_vendor/autoload.php';
require __DIR__.'/fake_vendor_bis/autoload.php';
(new \App\Services\AppService())->directDeprecations();
?>
--EXPECTF--
Remaining direct deprecation notices (2)
1x: deprecatedApi is deprecated! You should stop relying on it!
1x in AppService::directDeprecations from App\Services
1x: deprecatedApi from foo is deprecated! You should stop relying on it!
1x in AppService::directDeprecations from App\Services

View File

@ -50,6 +50,8 @@ class Connection extends AbstractConnection
/**
* {@inheritdoc}
*
* @param string $password WARNING: When the LDAP server allows unauthenticated binds, a blank $password will always be valid
*/
public function bind(string $dn = null, string $password = null)
{