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.
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.
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.
Looks like a bug. After all, filter_input is using the variables.
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#L526For
INPUT_SERVER
andINPUT_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.--
could you fill a bug at https://bugs.php.net/ ?
--
Ferenc Kovács
@Tyr43l - http://tyrael.hu