@@ -220,15 +220,19 @@ final public function __construct(string $name, string $value = '', array $optio
220220 unset($ options ['max-age ' ]);
221221 }
222222
223- // to retain backward compatibility with previous versions' fallback
224- $ prefix = $ options ['prefix ' ] ?: self ::$ defaults ['prefix ' ];
225- $ path = $ options ['path ' ] ?: self ::$ defaults ['path ' ];
226- $ domain = $ options ['domain ' ] ?: self ::$ defaults ['domain ' ];
227- $ secure = $ options [ ' secure ' ] ?: self :: $ defaults [ ' secure ' ];
228- $ httponly = $ options [ ' httponly ' ] ?: self :: $ defaults [ ' httponly ' ];
223+ // to preserve backward compatibility with array-based cookies in previous CI versions
224+ $ prefix = $ options ['prefix ' ] ?: self ::$ defaults ['prefix ' ];
225+ $ path = $ options ['path ' ] ?: self ::$ defaults ['path ' ];
226+ $ domain = $ options ['domain ' ] ?: self ::$ defaults ['domain ' ];
227+
228+ // empty string SameSite should use the default for browsers
229229 $ samesite = $ options ['samesite ' ] ?: self ::$ defaults ['samesite ' ];
230230
231- $ this ->validateName ($ name , $ options ['raw ' ]);
231+ $ raw = $ options ['raw ' ];
232+ $ secure = $ options ['secure ' ];
233+ $ httponly = $ options ['httponly ' ];
234+
235+ $ this ->validateName ($ name , $ raw );
232236 $ this ->validatePrefix ($ prefix , $ secure , $ path , $ domain );
233237 $ this ->validateSameSite ($ samesite , $ secure );
234238
@@ -241,7 +245,7 @@ final public function __construct(string $name, string $value = '', array $optio
241245 $ this ->secure = $ secure ;
242246 $ this ->httponly = $ httponly ;
243247 $ this ->samesite = ucfirst (strtolower ($ samesite ));
244- $ this ->raw = $ options [ ' raw ' ] ;
248+ $ this ->raw = $ raw ;
245249 }
246250
247251 //=========================================================================
0 commit comments