Project

General

Profile

Actions

Feature #27508

closed

Get value from cookie

Added by Simon Schaufelberger almost 13 years ago. Updated about 11 years ago.

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

0%

Estimated time:
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?

Actions #1

Updated by Oliver Hader almost 13 years ago

Should be working already with

data = global:_COOKIE|files

which will then access $_COOKIE['files']

Actions #2

Updated by Oliver Hader almost 13 years ago

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

Updated by Oliver Hader almost 13 years ago

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

Updated by Dmitry Dulepov almost 13 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!)

Actions #5

Updated by Simon Schaufelberger over 11 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.

Actions #6

Updated by Armin Vieweg over 11 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.

Actions #7

Updated by Simon Schaufelberger over 11 years ago

sorry, i have deleted my temporary account already ;)

Actions #8

Updated by Stefan Galinski about 11 years ago

  • Status changed from Accepted to Rejected
Actions

Also available in: Atom PDF