Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

midgard.superglobals_compat On has no effect on gjallarhorn #107

Open
flack opened this issue Feb 26, 2013 · 8 comments
Open

midgard.superglobals_compat On has no effect on gjallarhorn #107

flack opened this issue Feb 26, 2013 · 8 comments
Assignees
Milestone

Comments

@flack
Copy link
Member

flack commented Feb 26, 2013

I just tried enabling superglobals_compat in PHP's midgard2.ini file, and when I query the setting in my script with ini_get('midgard.superglobals_compat'), it returns On. But neither $_MIDGARD nor $_MIDCOM are available. Am I doing somethig wrong or is this a general problem?

@piotras
Copy link
Member

piotras commented Feb 27, 2013

This directive only sets superglobals named variables, without any properties or array values registered. It should work exactly the same as it works in ratatoskr.

@flack
Copy link
Member Author

flack commented Feb 27, 2013

Yes, I know. My problem is the following:

echo ini_get('midgard.superglobals_compat');  //outputs "On"
var_dump(isset($_MIDCOM)); // outputs false

So the variables are not there, and if I set $_MIDCOM in some script, it has the normal script scope, not the superglobal scope

@piotras
Copy link
Member

piotras commented Feb 27, 2013

What PHP version do you use? Can not confirm right now but it seems to be related to 5.4.

@flack
Copy link
Member Author

flack commented Feb 27, 2013

It's 5.3.3 from Debian stable

@ghost ghost assigned piotras Mar 11, 2013
@piotras
Copy link
Member

piotras commented Mar 11, 2013

It seems both superglobals are just set to reserve variable name. If one of these is NULL or FALSE it means there's no variable associated with the name. You can still set some data though:

$_MIDGARD['key'] = 'value';

And $_MIDGARD['key'] will be available as global variable.

@flack
Copy link
Member Author

flack commented Mar 11, 2013

OK, I think I figured it out now: If I set

midgard.superglobals_compat = On

In /etc/php5/conf.d/midgard2.ini, then it works. If I set

php_admin_value midgard.superglobals_compat "On"

In Apache virtual host config, then it doesn't work.

Here is the script I use for testing:

echo ini_get('midgard.superglobals_compat');  //outputs "On" in both cases
$_MIDCOM = 'test';
function test_midcom()
{
    var_dump(isset($_MIDCOM));  // outputs true whehn set in midgard2.ini, and false when set in vhost
}
test_midcom();

@flack
Copy link
Member Author

flack commented Mar 11, 2013

P.S.: If it turns out that enabling superglobals_compat is impossible with a php_admin_value, could mgd throw a warning in this case?

@piotras
Copy link
Member

piotras commented Mar 12, 2013

Did you try php_admin_flag instead of value? Also try to set it to "On" in ini and "Off" in vhost config if that should be disabled for some hosts or requests. Ini registration should be done in module loading phase, so we can not conditionally set it to On in vhost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants