php how to allow auto-global/superglobal variable
Posted by: roice (---.179.5.223.static.012.net.il)
Date: January 05, 2015 12:44PM

hello,

I just install WAMP server on my local computer and I got this error:

( ! ) Fatal error: Cannot re-assign auto-global variable _POST in C:\Program Files (x86)\wamp\www....

Is there any way to allow superglobal ?

Thanks

Options: ReplyQuote
Re: php how to allow auto-global/superglobal variable
Posted by: RiggsFolly (---.as43234.net)
Date: January 05, 2015 02:26PM

Please answer these questions so we know what you are using [forum.wampserver.com]

Also this sounds like a PHP coding issue and not a configuration problem. So please show the code that you are using, there is normally a filename and line number to identify the code that is causing a problem in the error message.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.2.8 32bit & 64bit) Aestan Tray Menu 3.2.4.7
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: php how to allow auto-global/superglobal variable
Posted by: roice (---.179.5.223.static.012.net.il)
Date: January 05, 2015 03:04PM

What?

I just want to know if it possible to allow superglobal ?

I would like to send variable to function with POST ...

Options: ReplyQuote
Re: php how to allow auto-global/superglobal variable
Posted by: RiggsFolly (---.as43234.net)
Date: January 05, 2015 03:45PM

That should work by default.

Thats what I mean this is very odd, and probably means you have something odd/wrong in the PHP code you are using, and not in the Apache/PHP configuration.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.2.8 32bit & 64bit) Aestan Tray Menu 3.2.4.7
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: php how to allow auto-global/superglobal variable
Posted by: roice (---.179.5.223.static.012.net.il)
Date: January 05, 2015 05:47PM

Why,
Everyone says that superglobal shouldn't work on the new PHP version. here:

[stackoverflow.com]

I want to allow superglobal . can it be done?

Options: ReplyQuote
Re: php how to allow auto-global/superglobal variable
Posted by: Otomatic (Moderator)
Date: January 05, 2015 06:34PM

Hi,

As $_POST array is superglobal it is not permit to use it as parameter to a fonction.
This code is not allowed:
function my_function($_POST){
    if(is_array($_POST)){
....
This code works because $_POST is superglobal:
function my_function(){
    if(is_array($_POST)){
....

Since PHP 5.4, you cannot use a superglobal as the parameter to a function. This causes a fatal error:


But you can use a superglobal inside a function.

------------------------------------------------------------------------------------------------------------
Wampserver 3.2.9 32 bit - Apache 2.4.53 - PHP 8.1.5…5.6.40 - MySQL 5.7.38 - MariaDB 10.5.13/10.6.5
Wampserver 3.2.9 64 bit - Apache 2.4.53 - PHP 8.1.5…5.6.40 - MySQL 5.7.38/8.0.29 - MariaDB 10.5.15/10.7.3
PhPMyadmin 5.1.3 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »

Options: ReplyQuote
Re: php how to allow auto-global/superglobal variable
Posted by: roice (---.179.5.223.static.012.net.il)
Date: January 06, 2015 10:08AM

yeah, I know,
But it use to work on previous versions, and I ain't gonna change all my software because of that.

Thanks why I want to allow superglobal

Where can I get previous versions of WAMP ?

Options: ReplyQuote
Re: php how to allow auto-global/superglobal variable
Posted by: RiggsFolly (---.as43234.net)
Date: January 06, 2015 10:35AM

Well if you want your code to run on modern versions of PHP then it is going to have to be changed.

The fix is not a big deal

See [stackoverflow.com]
and [stackoverflow.com]


Other versions = [sourceforge.net]

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.2.8 32bit & 64bit) Aestan Tray Menu 3.2.4.7
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: php how to allow auto-global/superglobal variable
Posted by: roice (---.179.5.223.static.012.net.il)
Date: January 06, 2015 02:19PM

thanks

Do you remember which version allow superglobal?

Options: ReplyQuote
Re: php how to allow auto-global/superglobal variable
Posted by: RiggsFolly (---.as43234.net)
Date: January 06, 2015 02:45PM

I am beginning to think that what you are actually asking, but dont know how to is :

My PHP code is OLD and was written to assumes that the PHP parameter register_globals is turned on.
This makes all the variables past in the $_POST and $_GET arrays automatically get created as PHP variables i.e.

If the $_POST array looked like this :-

array (
"id" => 1,
"firstname" => "Very"
"lastname" => "OldCode"
)

Then PHP would create 3 variables like so :-

$id = 1
$firstname = "Very"
$lastname = "OldCode"

and these are what my code uses.

-----------------------

Ok, if this is what you are asking then

register_globals was deprecated in PHP 5.3 and REMOVED as of PHP5.4


So if you dont want to change your old code you will have to run it on PHP5.3
The latest version of PHP5.3 is PHP5.3.29

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.2.8 32bit & 64bit) Aestan Tray Menu 3.2.4.7
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: php how to allow auto-global/superglobal variable
Posted by: roice (---.179.5.223.static.012.net.il)
Date: January 06, 2015 02:59PM

OK,
which wampserver is it -
[sourceforge.net]

2.4? 2.3?



Edited 1 time(s). Last edit at 01/06/2015 03:00PM by roice.

Options: ReplyQuote
Re: php how to allow auto-global/superglobal variable
Posted by: Otomatic (Moderator)
Date: January 06, 2015 03:45PM

Hi,

You can continue to use Wampserver 2.5 and install PHP 5.3.28 : [forum.wampserver.com]

------------------------------------------------------------------------------------------------------------
Wampserver 3.2.9 32 bit - Apache 2.4.53 - PHP 8.1.5…5.6.40 - MySQL 5.7.38 - MariaDB 10.5.13/10.6.5
Wampserver 3.2.9 64 bit - Apache 2.4.53 - PHP 8.1.5…5.6.40 - MySQL 5.7.38/8.0.29 - MariaDB 10.5.15/10.7.3
PhPMyadmin 5.1.3 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »

Options: ReplyQuote
Re: php how to allow auto-global/superglobal variable
Posted by: roice (---.179.5.223.static.012.net.il)
Date: January 07, 2015 10:01AM

but when I installed WAMPSERVER 2.5 it's already installed php 5.4

how can I change it to 5.3?

Options: ReplyQuote
Re: php how to allow auto-global/superglobal variable
Posted by: Otomatic (Moderator)
Date: January 07, 2015 10:12AM

Hi,

> how can I change it to 5.3?
READ the content of the link at the right of You can continue to use Wampserver 2.5 and install PHP 5.3.28

------------------------------------------------------------------------------------------------------------
Wampserver 3.2.9 32 bit - Apache 2.4.53 - PHP 8.1.5…5.6.40 - MySQL 5.7.38 - MariaDB 10.5.13/10.6.5
Wampserver 3.2.9 64 bit - Apache 2.4.53 - PHP 8.1.5…5.6.40 - MySQL 5.7.38/8.0.29 - MariaDB 10.5.15/10.7.3
PhPMyadmin 5.1.3 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »

Options: ReplyQuote
Re: php how to allow auto-global/superglobal variable
Posted by: roice (---.179.5.223.static.012.net.il)
Date: January 07, 2015 11:46AM

but it's not in English...

Options: ReplyQuote
Re: php how to allow auto-global/superglobal variable
Posted by: Otomatic (Moderator)
Date: January 07, 2015 02:26PM

Hi,

Put your glasses or visit the optometrist! It is in French AND in English.

------------------------------------------------------------------------------------------------------------
Wampserver 3.2.9 32 bit - Apache 2.4.53 - PHP 8.1.5…5.6.40 - MySQL 5.7.38 - MariaDB 10.5.13/10.6.5
Wampserver 3.2.9 64 bit - Apache 2.4.53 - PHP 8.1.5…5.6.40 - MySQL 5.7.38/8.0.29 - MariaDB 10.5.15/10.7.3
PhPMyadmin 5.1.3 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »

Options: ReplyQuote
Re: php how to allow auto-global/superglobal variable
Posted by: RiggsFolly (---.as43234.net)
Date: January 07, 2015 02:26PM

It is actually in English and French.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.2.8 32bit & 64bit) Aestan Tray Menu 3.2.4.7
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote


Sorry, only registered users may post in this forum.