Changeset 50842 for trunk/src/wp-includes/Requests/Cookie.php
- Timestamp:
- 05/11/2021 07:40:41 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/Requests/Cookie.php
r46586 r50842 66 66 */ 67 67 public function __construct($name, $value, $attributes = array(), $flags = array(), $reference_time = null) { 68 $this->name = $name;69 $this->value = $value;68 $this->name = $name; 69 $this->value = $value; 70 70 $this->attributes = $attributes; 71 $default_flags = array(72 'creation' => time(),71 $default_flags = array( 72 'creation' => time(), 73 73 'last-access' => time(), 74 'persistent' => false,75 'host-only' => true,74 'persistent' => false, 75 'host-only' => true, 76 76 ); 77 $this->flags = array_merge($default_flags, $flags);77 $this->flags = array_merge($default_flags, $flags); 78 78 79 79 $this->reference_time = time(); … … 229 229 foreach ($this->attributes as $key => $value) { 230 230 $orig_value = $value; 231 $value = $this->normalize_attribute($key, $value);231 $value = $this->normalize_attribute($key, $value); 232 232 if ($value === null) { 233 233 unset($this->attributes[$key]); … … 386 386 */ 387 387 public static function parse($string, $name = '', $reference_time = null) { 388 $parts = explode(';', $string);388 $parts = explode(';', $string); 389 389 $kvparts = array_shift($parts); 390 390 … … 398 398 // 399 399 // https://bugzilla.mozilla.org/show_bug.cgi?id=169091 400 $name = '';400 $name = ''; 401 401 $value = $kvparts; 402 402 } … … 404 404 list($name, $value) = explode('=', $kvparts, 2); 405 405 } 406 $name = trim($name);406 $name = trim($name); 407 407 $value = trim($value); 408 408 … … 413 413 foreach ($parts as $part) { 414 414 if (strpos($part, '=') === false) { 415 $part_key = $part;415 $part_key = $part; 416 416 $part_value = true; 417 417 } 418 418 else { 419 419 list($part_key, $part_value) = explode('=', $part, 2); 420 $part_value = trim($part_value);421 } 422 423 $part_key = trim($part_key);420 $part_value = trim($part_value); 421 } 422 423 $part_key = trim($part_key); 424 424 $attributes[$part_key] = $part_value; 425 425 } … … 450 450 if (empty($parsed->attributes['domain']) && !empty($origin)) { 451 451 $parsed->attributes['domain'] = $origin->host; 452 $parsed->flags['host-only'] = true;452 $parsed->flags['host-only'] = true; 453 453 } 454 454 else { … … 498 498 * @codeCoverageIgnore 499 499 * @deprecated Use {@see Requests_Cookie::parse_from_headers} 500 * @return string500 * @return array 501 501 */ 502 502 public static function parseFromHeaders(Requests_Response_Headers $headers) {
Note: See TracChangeset
for help on using the changeset viewer.