File tree Expand file tree Collapse file tree 3 files changed +42
-5
lines changed Expand file tree Collapse file tree 3 files changed +42
-5
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,12 @@ class Request
71
71
*/
72
72
protected static $ _enableCache = true ;
73
73
74
+ /**
75
+ * Is safe.
76
+ *
77
+ * @var bool
78
+ */
79
+ protected $ _isSafe = true ;
74
80
75
81
/**
76
82
* Request constructor.
@@ -208,8 +214,8 @@ public function protocolVersion()
208
214
public function host ($ without_port = false )
209
215
{
210
216
$ host = $ this ->header ('host ' );
211
- if ($ host && $ without_port && $ pos = \strpos ( $ host , ' : ' ) ) {
212
- return \substr ( $ host , 0 , $ pos );
217
+ if ($ host && $ without_port ) {
218
+ return preg_replace ( ' /:\d{1,5}$/ ' , '' , $ host );
213
219
}
214
220
return $ host ;
215
221
}
@@ -656,14 +662,23 @@ public function __toString()
656
662
return $ this ->_buffer ;
657
663
}
658
664
665
+ /**
666
+ * __wakeup.
667
+ * @return void
668
+ */
669
+ public function __wakeup ()
670
+ {
671
+ $ this ->_isSafe = false ;
672
+ }
673
+
659
674
/**
660
675
* __destruct.
661
676
*
662
677
* @return void
663
678
*/
664
679
public function __destruct ()
665
680
{
666
- if (isset ($ this ->_data ['files ' ])) {
681
+ if (isset ($ this ->_data ['files ' ]) && $ this -> _isSafe ) {
667
682
\clearstatcache ();
668
683
\array_walk_recursive ($ this ->_data ['files ' ], function ($ value , $ key ){
669
684
if ($ key === 'tmp_name ' ) {
Original file line number Diff line number Diff line change @@ -134,6 +134,13 @@ class Session
134
134
*/
135
135
protected $ _sessionId = null ;
136
136
137
+ /**
138
+ * Is safe.
139
+ *
140
+ * @var bool
141
+ */
142
+ protected $ _isSafe = true ;
143
+
137
144
/**
138
145
* Session constructor.
139
146
*
@@ -402,13 +409,25 @@ public function gc()
402
409
static ::$ _handler ->gc (static ::$ lifetime );
403
410
}
404
411
412
+ /**
413
+ * __wakeup.
414
+ * @return void
415
+ */
416
+ public function __wakeup ()
417
+ {
418
+ $ this ->_isSafe = false ;
419
+ }
420
+
405
421
/**
406
422
* __destruct.
407
423
*
408
424
* @return void
409
425
*/
410
426
public function __destruct ()
411
427
{
428
+ if (!$ this ->_isSafe ) {
429
+ return ;
430
+ }
412
431
$ this ->save ();
413
432
if (\rand (1 , static ::$ gcProbability [1 ]) <= static ::$ gcProbability [0 ]) {
414
433
$ this ->gc ();
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ class Worker
34
34
*
35
35
* @var string
36
36
*/
37
- const VERSION = '4.0.45 ' ;
37
+ const VERSION = '4.0.46 ' ;
38
38
39
39
/**
40
40
* Status starting.
@@ -1057,7 +1057,10 @@ protected static function formatStatusData($statistics_file)
1057
1057
}
1058
1058
$ status_str = '' ;
1059
1059
$ current_total_request = array ();
1060
- $ worker_info = \unserialize ($ info [0 ]);
1060
+ $ worker_info = [];
1061
+ try {
1062
+ $ worker_info = unserialize ($ info [0 ], ['allowed_classes ' => false ]);
1063
+ } catch (Throwable $ exception ) {}
1061
1064
\ksort ($ worker_info , SORT_NUMERIC );
1062
1065
unset($ info [0 ]);
1063
1066
$ data_waiting_sort = array ();
You can’t perform that action at this time.
0 commit comments