@@ -33,7 +33,7 @@ public function __construct(RequestStack $requestStack = null)
33
33
34
34
private function doInvoke (array |LogRecord $ record ): array |LogRecord
35
35
{
36
- $ hash = $ this ->requestStack && ($ request = $ this ->requestStack ->getCurrentRequest ()) ? spl_object_hash ($ request ) : '' ;
36
+ $ key = $ this ->requestStack && ($ request = $ this ->requestStack ->getCurrentRequest ()) ? spl_object_id ($ request ) : '' ;
37
37
38
38
$ timestamp = $ timestampRfc3339 = false ;
39
39
if ($ record ['datetime ' ] instanceof \DateTimeInterface) {
@@ -43,7 +43,7 @@ private function doInvoke(array|LogRecord $record): array|LogRecord
43
43
$ timestampRfc3339 = (new \DateTimeImmutable ($ record ['datetime ' ]))->format (\DateTimeInterface::RFC3339_EXTENDED );
44
44
}
45
45
46
- $ this ->records [$ hash ][] = [
46
+ $ this ->records [$ key ][] = [
47
47
'timestamp ' => $ timestamp ,
48
48
'timestamp_rfc3339 ' => $ timestampRfc3339 ,
49
49
'message ' => $ record ['message ' ],
@@ -53,16 +53,16 @@ private function doInvoke(array|LogRecord $record): array|LogRecord
53
53
'channel ' => $ record ['channel ' ] ?? '' ,
54
54
];
55
55
56
- if (!isset ($ this ->errorCount [$ hash ])) {
57
- $ this ->errorCount [$ hash ] = 0 ;
56
+ if (!isset ($ this ->errorCount [$ key ])) {
57
+ $ this ->errorCount [$ key ] = 0 ;
58
58
}
59
59
60
60
switch ($ record ['level ' ]) {
61
61
case Logger::ERROR :
62
62
case Logger::CRITICAL :
63
63
case Logger::ALERT :
64
64
case Logger::EMERGENCY :
65
- ++$ this ->errorCount [$ hash ];
65
+ ++$ this ->errorCount [$ key ];
66
66
}
67
67
68
68
return $ record ;
@@ -71,7 +71,7 @@ private function doInvoke(array|LogRecord $record): array|LogRecord
71
71
public function getLogs (Request $ request = null ): array
72
72
{
73
73
if (null !== $ request ) {
74
- return $ this ->records [spl_object_hash ($ request )] ?? [];
74
+ return $ this ->records [spl_object_id ($ request )] ?? [];
75
75
}
76
76
77
77
if (0 === \count ($ this ->records )) {
@@ -84,7 +84,7 @@ public function getLogs(Request $request = null): array
84
84
public function countErrors (Request $ request = null ): int
85
85
{
86
86
if (null !== $ request ) {
87
- return $ this ->errorCount [spl_object_hash ($ request )] ?? 0 ;
87
+ return $ this ->errorCount [spl_object_id ($ request )] ?? 0 ;
88
88
}
89
89
90
90
return array_sum ($ this ->errorCount );
0 commit comments