Skip to content

Navigation Menu

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 13e4077

Browse filesBrowse files
[VarDumper] Fix SocketCaster
1 parent 036e3a0 commit 13e4077
Copy full SHA for 13e4077

File tree

4 files changed

+25
-18
lines changed
Filter options

4 files changed

+25
-18
lines changed

‎src/Symfony/Component/VarDumper/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
7.3
5+
---
6+
7+
* Add `CurlCaster`, `OpenSslCaster`, `SqliteCaster`, `SocketCaster` and `DbaCaster`
8+
49
7.2
510
---
611

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Caster/DbaCaster.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ class DbaCaster
2020
{
2121
public static function castDbaConnection(\Dba\Connection $dba, array $a, Stub $stub, bool $isNested): array
2222
{
23+
// not yet possible to gather information about the connection object
24+
2325
return $a;
2426
}
2527

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Caster/SocketCaster.php
+15-12Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,21 @@ public static function castSocket(\Socket $h, array $a, Stub $stub, bool $isNest
2626
$a += [
2727
Caster::PREFIX_VIRTUAL.'address' => $addr,
2828
Caster::PREFIX_VIRTUAL.'port' => $port,
29-
Caster::PREFIX_VIRTUAL.'info' => new EnumStub([
30-
'timed_out' => new ConstStub($info['timed_out'] ? 'true' : 'false'),
31-
'blocked' => new ConstStub($info['blocked'] ? 'true' : 'false'),
32-
'eof' => new ConstStub($info['eof'] ? 'true' : 'false'),
33-
'unread_bytes' => new ScalarStub($info['unread_bytes']),
34-
'stream_type' => new ConstStub($info['stream_type']),
35-
'wrapper_type' => new ConstStub($info['wrapper_type'] ?? '?'),
36-
'wrapper_data' => new ConstStub($info['wrapper_data'] ?? '?'),
37-
'mode' => new ConstStub($info['mode']),
38-
'seekable' => new ConstStub($info['seekable'] ? 'true' : 'false'),
39-
'uri' => new ConstStub($info['uri']),
40-
]),
29+
Caster::PREFIX_VIRTUAL.'info' => new EnumStub(array_intersect_key(
30+
$info,
31+
[
32+
'timed_out' => new ConstStub($info['timed_out'] ? 'true' : 'false'),
33+
'blocked' => new ConstStub($info['blocked'] ? 'true' : 'false'),
34+
'eof' => new ConstStub($info['eof'] ? 'true' : 'false'),
35+
'unread_bytes' => new ScalarStub($info['unread_bytes']),
36+
'stream_type' => new ConstStub($info['stream_type']),
37+
'wrapper_type' => new ConstStub($info['wrapper_type'] ?? ''),
38+
'wrapper_data' => new ConstStub($info['wrapper_data'] ?? ''),
39+
'mode' => new ConstStub($info['mode']),
40+
'seekable' => new ConstStub($info['seekable'] ? 'true' : 'false'),
41+
'uri' => new ConstStub($info['uri'] ?? ''),
42+
]
43+
)),
4144
];
4245

4346
return $a;

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Tests/Caster/SocketCasterTest.php
+3-6Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,11 @@ public function testCastSocket()
3535
timed_out: false
3636
blocked: true
3737
eof: false
38+
stream_type: "udp_socket"
39+
mode: "r+"
3840
unread_bytes: 0
39-
stream_type: udp_socket
40-
wrapper_type: ?
41-
wrapper_data: ?
42-
mode: r+
4341
seekable: false
44-
uri: udp://
45-
}
42+
%A}
4643
}
4744
EODUMP, $socket);
4845
}

0 commit comments

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