Skip to content

Bug: Cookie Helper and Response class issue #2783

Description

@MisterAnmar

Description
Im trying to create a cookie using response class as per the user guide.

`

$cookie = [
        'name'   => 'Something',
        'value'  => 'The Value',
        'expire' => '86500',
        'domain' => '.some-domain.com',
        'path'   => '/',
        'prefix' => 'myprefix_',
        'secure' => TRUE,
        'httponly' => FALSE
];

$this->response->setCookie($cookie);

`
of course data where different

try to retrieve the cookie i cant

$this->request->getCookie('Something');

Also i tried using helper. i just cant to seem to make it work..
However when i use the native php function it works like a charm

setcookie('mya', 'Some Value', time()+3600, '/');

and on a different function i just do


	public function testc()
	{
               // Does not work
		echo $this->request->getCookie('mya');
		// Works fine
                 if (isset($_COOKIE['mya'])) {
		 	echo $_COOKIE['mya'];
		 }
	}


CodeIgniter 4 version
CI4.0.2 Appstarter build using composer

Context

  • OS: Win10
  • Web server WAMP64
  • PHP version 7.3.5

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions