cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

[BUG]: Cant get all cookies

Open borisdelev opened this issue 2 years ago • 2 comments

Describe the bug I use cookies :) Soo... if i try to get them all with getCookies function- get empty array. If i retrieve cookie by name, all its fine.

To Reproduce

Steps to reproduce the behavior:

$this->cookies->set('test', 'test');
var_dump($this->cookies->get('test'); // Works
var_dump($this->cookies->getCookies()); // return empty array

Expected behavior Array with all set cookies. I have create a few more test and in some situation- example code from top is working. Will investigate more. Anyway- this warning appear: Deprecated: Phalcon\Http\Cookie::setDomain(): Passing null to parameter #1 ($domain) of type string is deprecated in and i think must be fixed.

Details

  • Phalcon version: 5.8.0
  • PHP Version: 8.3.7
  • Operating System: Windows
  • Server: Apache

borisdelev avatar Sep 22 '24 20:09 borisdelev

I'm not able to verify the specific bug, will probably need a more detailed example, I used the same 3 lines in a controller and worked as expected.

However, looking at the source code, the deprecated warning seem very likely to happen due to type strictness.

https://github.com/phalcon/cphalcon/blob/83677f1df8dde17946eee54ddbc900c8839c2b53/phalcon/Http/Cookie.zep#L510 https://github.com/phalcon/cphalcon/blob/83677f1df8dde17946eee54ddbc900c8839c2b53/phalcon/Http/Response/Cookies.zep#L255

raicabogdan avatar Sep 23 '24 11:09 raicabogdan

Will try to figure out the issue and will poke when i get it. Thank you 👍

borisdelev avatar Sep 23 '24 12:09 borisdelev