Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitae08d2d

Browse files
committed
[VarDumper] fix casting server attribute
1 parenta025c9d commitae08d2d

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

‎src/Symfony/Component/VarDumper/Caster/MemcachedCaster.php‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,15 @@ class MemcachedCaster
2020
{
2121
publicstaticfunctioncastMemcached(\Memcached$c,array$a,Stub$stub,$isNested)
2222
{
23+
$servers = [];
2324
foreach ($c->getServerList()as$key =>$serverData) {
24-
$a +=array(
25-
Caster::PREFIX_VIRTUAL.'servers' =>newEnumStub(
26-
array(
27-
'server_'.$key =>newEnumStub($serverData),
28-
)
29-
),
30-
);
25+
$servers['server_'.$key] =newEnumStub($serverData);
3126
}
3227

3328
$a +=array(
29+
Caster::PREFIX_VIRTUAL.'servers' =>newEnumStub(
30+
$servers
31+
),
3432
Caster::PREFIX_VIRTUAL.'options' =>newEnumStub(
3533
array(
3634
'OPT_COMPRESSION' =>$c->getOption(\Memcached::OPT_COMPRESSION),

‎src/Symfony/Component/VarDumper/Tests/Caster/MemcachedCasterTest.php‎

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,16 @@ public function testCastMemcached()
2626

2727
$var =new \Memcached();
2828

29-
$expectedServerHost ='127.0.0.1';
30-
$expectedServerPort =11211;
31-
$expectedConnectionType ='TCP';
29+
$expectedServerHost1 ='127.0.0.1';
30+
$expectedServerPort1 =11211;
31+
$expectedConnectionType1 ='TCP';
3232

33-
$var->addServer($expectedServerHost,$expectedServerPort);
33+
$expectedServerHost2 ='127.0.0.2';
34+
$expectedServerPort2 =11211;
35+
$expectedConnectionType2 ='TCP';
36+
37+
$var->addServer($expectedServerHost1,$expectedServerPort1);
38+
$var->addServer($expectedServerHost2,$expectedServerPort2);
3439

3540
$expectedOption1 =$var->getOption(\Memcached::OPT_COMPRESSION) ?'true' :'false';
3641
$expectedOption2 =$var->getOption(\Memcached::OPT_SERIALIZER);
@@ -56,9 +61,14 @@ public function testCastMemcached()
5661
Memcached {
5762
servers: {
5863
server_0: {
59-
host: "$expectedServerHost"
60-
port:$expectedServerPort
61-
type: "$expectedConnectionType"
64+
host: "$expectedServerHost1"
65+
port:$expectedServerPort1
66+
type: "$expectedConnectionType1"
67+
}
68+
server_1: {
69+
host: "$expectedServerHost2"
70+
port:$expectedServerPort2
71+
type: "$expectedConnectionType2"
6272
}
6373
}
6474
options: {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp