Feature #27508

Get value from cookie

Added by Simon Schaufelberger over 8 years ago. Updated almost 7 years ago.

Status:
Rejected
Priority:
Should have
Assignee:
Category:
TypoScript
Target version:
-
Start date:
2011-06-17
Due date:
% Done:

0%

PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

At the moment the only possibilty to get a value from a cookie is this:

lib.files = TEXT
lib.files {
    data = global:HTTP_COOKIE_VARS|files
}

where files is the cookie name.
The problem with this? It does NOT work if "register_long_arrays" in php.ini is off and by the way:
This feature has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.
from: http://php.net/manual/en/ini.core.php

I would like to create a patch for the core which does the following:

add a new item to "function getData" in class.tslib_content.php for example:

case 'cookie' :
    $retVal = $this->getCookie($key);
    break;

and then a function which basically does this (of course with more error checking)
function getCookie($key) {
    return $_COOKIE[$key];
}

any comments on that or shall i commit to gerrit already?

History

#1 Updated by Oliver Hader over 8 years ago

Should be working already with

data = global:_COOKIE|files

which will then access $_COOKIE['files']

#2 Updated by Oliver Hader over 8 years ago

  • Status changed from New to Rejected
  • Assignee set to Oliver Hader
  • Priority changed from Should have to Won't have this time

#3 Updated by Oliver Hader over 8 years ago

  • Status changed from Rejected to Accepted
  • Priority changed from Won't have this time to Should have

#4 Updated by Dmitry Dulepov over 8 years ago

I think this should be "Rejected" because there is already a way to do it. If status is "Accepted", the report statys in the list of active bugs (it shouldn't!)

#5 Updated by Simon Schaufelberger almost 7 years ago

can be closed since its working well.

it would be good to add this to the documentation since other people are asking this question as well and i even saw a post here:
http://stackoverflow.com/questions/8740573/is-it-possible-to-get-cookie-with-typoscript
that says its not even possible which is wrong.

#6 Updated by Armin Vieweg almost 7 years ago

I've updated the "correct answer" on stackoverflow :)
It would be nice, if you could edit your answer and put the typoscript in it, as a guy in the comments ask for it.

#7 Updated by Simon Schaufelberger almost 7 years ago

sorry, i have deleted my temporary account already ;)

#8 Updated by Stefan Galinski almost 7 years ago

  • Status changed from Accepted to Rejected

Also available in: Atom PDF