Skip to content

Commit 60d6a75

Browse files
Merge branch '5.4' into 6.0
* 5.4: [Messenger] Fix dealing with unexpected payload in Redis transport [Filesystem] Update some PHPDoc of the Path class [VarDumper] Fix dumping mysqli_driver instances Fix missing ReturnTypeWillChange attributes [Cache] Add missing log when saving namespace [HttpKernel] Reset services between requests performed by KernelBrowser [HttpKernel] Remove unused argument in ArgumentMetadataFactory [Stopwatch] Fix test expectation [SecurityBundle] fix autoconfiguring Monolog's ProcessorInterface KernelTestCase resets internal state on tearDown [Security/Http] Fix getting password-upgrader when user-loader is a closure [HttpKernel] Fix extracting controller name from closures [Intl] fix wrong offset timezone PHP 8.1 Fix type binding Remove duplicated test [Dotenv] Fix reading config for symfony/runtime when running dump command [Serializer] Remove unnecessary break [Runtime] Fix dotenv_overload with commands Make document type nodes ignorable Initialize Symfony\Component\Security\Core\Exception\AccountStatusException:: property
2 parents 81cfe0e + 6efddb1 commit 60d6a75

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed

Caster/MysqliCaster.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\VarDumper\Caster;
13+
14+
use Symfony\Component\VarDumper\Cloner\Stub;
15+
16+
/**
17+
* @author Nicolas Grekas <p@tchwork.com>
18+
*
19+
* @internal
20+
*/
21+
final class MysqliCaster
22+
{
23+
public static function castMysqliDriver(\mysqli_driver $c, array $a, Stub $stub, bool $isNested): array
24+
{
25+
foreach ($a as $k => $v) {
26+
if (isset($c->$k)) {
27+
$a[$k] = $c->$k;
28+
}
29+
}
30+
31+
return $a;
32+
}
33+
}

Cloner/AbstractCloner.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ abstract class AbstractCloner implements ClonerInterface
153153
'Ds\Pair' => ['Symfony\Component\VarDumper\Caster\DsCaster', 'castPair'],
154154
'Symfony\Component\VarDumper\Caster\DsPairStub' => ['Symfony\Component\VarDumper\Caster\DsCaster', 'castPairStub'],
155155

156+
'mysqli_driver' => ['Symfony\Component\VarDumper\Caster\MysqliCaster', 'castMysqliDriver'],
157+
156158
'CurlHandle' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castCurl'],
157159

158160
':dba' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'],

Tests/Caster/MysqliCasterTest.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\VarDumper\Tests\Caster;
13+
14+
use PHPUnit\Framework\TestCase;
15+
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
16+
17+
/**
18+
* @requires extension mysqli
19+
* @group integration
20+
*/
21+
class MysqliCasterTest extends TestCase
22+
{
23+
use VarDumperTestTrait;
24+
25+
public function testNotConnected()
26+
{
27+
$driver = new \mysqli_driver();
28+
$driver->report_mode = 3;
29+
30+
$xCast = <<<EODUMP
31+
mysqli_driver {%A
32+
+reconnect: false
33+
+report_mode: 3
34+
}
35+
EODUMP;
36+
37+
$this->assertDumpMatchesFormat($xCast, $driver);
38+
}
39+
}

0 commit comments

Comments
 (0)