Page 1 of 1

Problems with magic_quotes

PostPosted: 04. January 2017 23:39
by theflyingdutch
Hello there !
Im using xampp v3.2.2 ( 7.0.13 / PHP 7.0.13 ) - Windows 10 and I have the following problem :
When I try to run my script it says :
Fatal error: Cannot redeclare get_magic_quotes_gpc() in C:\xampp\htdocs\includes\defines.inc.php on line 87
On this line in that file I have:
if (version_compare(PHP_VERSION, '6.0.0') >= 0) {
function get_magic_quotes_gpc(){
return false;
}
}

Whenever I try to edit the .ini file ( I check which one I'm using from phpinfo script )I set the magic_quotes_gpc=Off to magic_quotes_gpc=On ( I tried also with space between = on etc..) and its not working.. whenever I try to start the apache from the xamp panel windows say that apache cannot start..
I tried different ways that I found in the internet but its not working.. also if I remove this from my script, then the entire script is not working..
Help me please..

Re: Problems with magic_quotes

PostPosted: 04. January 2017 23:49
by Altrea
Hi,

Start using the PHP Manual, it's a life saver.

best wishes,
Altrea

Re: Problems with magic_quotes

PostPosted: 05. January 2017 10:24
by theflyingdutch
Yea I know but for now I need them for a tests etc..

Re: Problems with magic_quotes

PostPosted: 05. January 2017 10:44
by Altrea
Then you need to use a XAMPP version containing PHP version lower than 5.4. There is no other way. The functionality was removed completely.

Re: Problems with magic_quotes

PostPosted: 05. January 2017 12:19
by Nobbie
Altrea wrote:Then you need to use a XAMPP version containing PHP version lower than 5.4. There is no other way. The functionality was removed completely.


No!!!

You did not read the error carefully - it is just vice verse: the get_magic_quotes_gpc() HAD been removed for PHP6 only, but it is back again in PHP7. See http://php.net/manual/en/function.get-m ... es-gpc.php

And this is actually the error message, in the PHP Code there is a faulty if-clause comparing if PHP6 or higher is running and in that case, a user-defined get_magic_quotes_gpc() is declared. But for PHP7 (which is higher than 6.0.0) this collides with the already existing function get_magic_quotes_gpc(), exactly what the error message says: Fatal error: Cannot redeclare get_magic_quotes_gpc()

The solution is quit simple, simply remove that 5 lines of code in the PHP script and thats it!

Re: Problems with magic_quotes

PostPosted: 05. January 2017 12:53
by Altrea
Nobbie wrote:
Altrea wrote:Then you need to use a XAMPP version containing PHP version lower than 5.4. There is no other way. The functionality was removed completely.


No!!!

You did not read the error carefully - it is just vice verse: the get_magic_quotes_gpc() HAD been removed for PHP6 only, but it is back again in PHP7. See http://php.net/manual/en/function.get-m ... es-gpc.php

You are right, the check function returns with PHP 7 which causes this error message. But the part why i wrote my reply was this one:
theflyingdutch wrote:Whenever I try to edit the .ini file ( I check which one I'm using from phpinfo script )I set the magic_quotes_gpc=Off to magic_quotes_gpc=On ( I tried also with space between = on etc..) and its not working.. whenever I try to start the apache from the xamp panel windows say that apache cannot start..

The check function might be back, but the magic_quotes functionality is still removed. Adding or enabling it in the php.ini will not bring it back.

Re: Problems with magic_quotes

PostPosted: 05. January 2017 13:21
by Nobbie
Altrea wrote:The check function might be back, but the magic_quotes functionality is still removed.


Of course. the "functionality" of get_magic_quotes_gpc() already had been reduced to a simple "return FALSE" since PHP 5.4. There is no functionality in any means, exactly what the user-defined function above also does. Therefore simply remove that if-clause. But the function itself had been removed in PHP6, but this has been reverted in PHP7 (probably due to many requests).

Re: Problems with magic_quotes

PostPosted: 05. January 2017 13:52
by Altrea
PHP 6 has never been released so i would agree that this replacement function is useless.

Re: Problems with magic_quotes

PostPosted: 05. January 2017 22:43
by theflyingdutch
Okay guys, now I know.. somebody can tell me from where I can download xampp with php 5.4 <
Thanks.

Re: Problems with magic_quotes

PostPosted: 05. January 2017 23:35
by Altrea
From here: https://sourceforge.net/projects/xampp/files/
The last XAMPP version containing PHP 5.4.X was XAMPP 1.8.2-6