filter_input and auto_globals_jit

From: Date: Thu, 22 May 2014 21:01:42 +0000
Subject: filter_input and auto_globals_jit
Groups: php.internals 
Request: Send a blank email to internals+get-74434@lists.php.net to get a copy of this message
Here is an oddity which I'm not sure how this is supposed to work. If you have auto_globals_jit enables then not only are super global variables not initialized unless they are called, the underlying data storage for the original data[used by filter_input] will not be populated. As I read filter.c, there seems to be a weird schism on how it deals with this. https://github.com/php/php-src/blob/master/ext/filter/filter.c#L526 For INPUT_SERVER and INPUT_ENV it seems as if filter will make sure to initialize the data, example: if (PG(auto_globals_jit)) { zend_is_auto_global("_SERVER", sizeof("_SERVER")-1 TSRMLS_CC); } For INPUT_POST, INPUT_GET, and INPUT_COOKIE however there is no safety net. For example, with Just in Time: test.php?var=test $before = filter_input(INPUT_GET); // $before = null $var = $_GET('test'); // $var = 'test' $after = filter_input(INPUT_GET); // $after = 'test' So the question is, is this by design? In which case I'll update the docs. Or is this an oversight? In which case I'll open a bug and submit a patch.

« previous php.internals (#74434) next »