phalcon / cphalcon

High performance, full-stack PHP framework delivered as a C extension.
https://phalcon.io
BSD 3-Clause "New" or "Revised" License
10.79k stars 1.96k forks source link

[BUG]: Cant get all cookies #16649

Closed borisdelev closed 1 month ago

borisdelev commented 2 months ago

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

raicabogdan commented 2 months ago

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

borisdelev commented 2 months ago

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