Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9efb442

Browse filesBrowse files
committed
Don't call method_exists() with non-objects.
1 parent e3069df commit 9efb442
Copy full SHA for 9efb442

File tree

3 files changed

+5
-5
lines changed
Filter options

3 files changed

+5
-5
lines changed

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddDebugLogProcessorPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddDebugLogProcessorPass.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function process(ContainerBuilder $container)
3636

3737
public static function configureLogger($logger)
3838
{
39-
if (method_exists($logger, 'removeDebugLogger') && \in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) {
39+
if (\is_object($logger) && method_exists($logger, 'removeDebugLogger') && \in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) {
4040
$logger->removeDebugLogger();
4141
}
4242
}

‎src/Symfony/Component/HttpFoundation/InputBag.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/InputBag.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ final class InputBag extends ParameterBag
2929
*/
3030
public function get(string $key, $default = null)
3131
{
32-
if (null !== $default && !is_scalar($default) && !method_exists($default, '__toString')) {
32+
if (null !== $default && !is_scalar($default) && !(\is_object($default) && method_exists($default, '__toString'))) {
3333
trigger_deprecation('symfony/http-foundation', '5.1', 'Passing a non-string value as 2nd argument to "%s()" is deprecated, pass a string or null instead.', __METHOD__);
3434
}
3535

3636
$value = parent::get($key, $this);
3737

38-
if (null !== $value && $this !== $value && !is_scalar($value) && !method_exists($value, '__toString')) {
38+
if (null !== $value && $this !== $value && !is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) {
3939
trigger_deprecation('symfony/http-foundation', '5.1', 'Retrieving a non-string value from "%s()" is deprecated, and will throw a "%s" exception in Symfony 6.0, use "%s::all()" instead.', __METHOD__, BadRequestException::class, __CLASS__);
4040
}
4141

@@ -87,7 +87,7 @@ public function add(array $inputs = [])
8787
*/
8888
public function set(string $key, $value)
8989
{
90-
if (!is_scalar($value) && !method_exists($value, '__toString') && !\is_array($value)) {
90+
if (!is_scalar($value) && !\is_array($value) && !method_exists($value, '__toString')) {
9191
trigger_deprecation('symfony/http-foundation', '5.1', 'Passing "%s" as a 2nd Argument to "%s()" is deprecated, pass a string or an array instead.', get_debug_type($value), __METHOD__);
9292
}
9393

‎src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/DoctrineTransportFactory.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/DoctrineTransportFactory.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function createTransport(string $dsn, array $options, SerializerInterface
4747
throw new TransportException(sprintf('Could not find Doctrine connection from Messenger DSN "%s".', $dsn), 0, $e);
4848
}
4949

50-
if ($useNotify && method_exists($driverConnection->getWrappedConnection(), 'pgsqlGetNotify')) {
50+
if ($useNotify && ($wrappedConnection = $driverConnection->getWrappedConnection()) && method_exists($wrappedConnection, 'pgsqlGetNotify')) {
5151
$connection = new PostgreSqlConnection($configuration, $driverConnection);
5252
} else {
5353
$connection = new Connection($configuration, $driverConnection);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.