Announcement

  •  » Engine
  •  » Compatibility PHP 5.3 (pre-6.0)?

#1 2009-08-14 21:26:21

Eric
Former Piwigo Team
VALENCE (FR)
2005-03-25
1768

Compatibility PHP 5.3 (pre-6.0)?

Hi all guys (and girl !).

I've upgraded my Wampserver to version 2.0i providing support PHP 5.3 and MySql 5.1.36. This enabled me to note that some PHP functions are deprecated in this release. These same functions will disappear in PHP version 6.

I know it will spend time, much time, before the main hosts'll update their platforms, but I don't like to see a lot of [notice] on my local test sites ;-)

So i've identified 3 functions still used in Piwigo's code that are deprecated. According PHP documentation, they should be replaced as follows:
ereg() -> preg_match()
ereg_replace() -> preg_replace()
eregi() -> preg_match() with the 'i' modifier
eregi_replace() -> preg_replace() with the 'i' modifier
set_magic_quotes_runtime() -> No more usefull. I've fixed it by adding "@" before the function.

And here are the Piwigo's core files using some of this deprecated features :
pwg/admin/include/pclzip.lib.php
pwg/admin/thumbnail.php
pwg/include/functions_user.inc.php
pwg/tools/create_listing_file.php
pwg/upload.php
pwg/install.php

I've already fixed this files for my personnal need but i'm still not PHP expert.

Do you agree, or not ?
Should I send them on svn ?

Offline

 

#2 2009-08-16 11:01:34

P@t
Piwigo Team
Nice
2007-06-13
4098

Re: Compatibility PHP 5.3 (pre-6.0)?

Eric wrote:

Do you agree, or not ?
Should I send them on svn ?

I'm agree ;-) For me, you can commit...

For pclzip file, you could send a message to pclzip contact.


P@t

Offline

 

#3 2009-08-16 11:09:27

P@t
Piwigo Team
Nice
2007-06-13
4098

Re: Compatibility PHP 5.3 (pre-6.0)?

For pclzip, new version is available (2.8.1), where depreciated functions have been removed.
I will upgrade pclzip class as soon as possible ;-)


P@t

Offline

 

#4 2009-08-17 12:46:07

Eric
Former Piwigo Team
VALENCE (FR)
2005-03-25
1768

Re: Compatibility PHP 5.3 (pre-6.0)?

I'ven't send the fixed files yet 'cause my PC was on failure this week-end (some bad virus attack :( ). But it's OK now and I'll send the files on SVN as soon as possible. But it could be nice if someone could verify my code adaptations : I'm still not an expert ;-)

Offline

 

#5 2009-08-17 18:24:28

Eric
Former Piwigo Team
VALENCE (FR)
2005-03-25
1768

Re: Compatibility PHP 5.3 (pre-6.0)?

Fixed files were send successfully to Piwigo's trunk.

Hope I'ven't mistaken :-S

Offline

 

#6 2009-08-17 20:11:36

nicolas
Former Piwigo Team
2004-12-30
1232

Re: Compatibility PHP 5.3 (pre-6.0)?

Why always use that horrible arobase ? It's slow and useless in that case !

Offline

 

#7 2009-08-17 21:10:42

Eric
Former Piwigo Team
VALENCE (FR)
2005-03-25
1768

Re: Compatibility PHP 5.3 (pre-6.0)?

nicolas wrote:

Why always use that horrible arobase ? It's slow and useless in that case !

So, what else ? Simply deleting calls of set_magic_quotes_runtime() ?

Offline

 

#8 2009-08-17 23:24:45

nicolas
Former Piwigo Team
2004-12-30
1232

Re: Compatibility PHP 5.3 (pre-6.0)?

Eric wrote:

nicolas wrote:

Why always use that horrible arobase ? It's slow and useless in that case !

So, what else ? Simply deleting calls of set_magic_quotes_runtime() ?

No; I think the better way is to test.

Offline

 

#9 2009-08-19 15:36:37

RegisLG
Guest

Re: Compatibility PHP 5.3 (pre-6.0)?

Hi all,

before finding this thread, while googling for a way to prevent the "Deprecated: Function set_magic_quotes_runtime() is deprecated" message, i ended up with these changes :

In  "include/common.inc.php" and  "install.php" :

search for : set_magic_quotes_runtime(0);

replace with : ini_set("magic_quotes_runtime", 0);

It seems to work (no more error message), i don't know if this is correct or not, just my 2 cents.

 

#10 2009-08-19 15:40:42

nicolas
Former Piwigo Team
2004-12-30
1232

Re: Compatibility PHP 5.3 (pre-6.0)?

RegisLG wrote:

replace with : ini_set("magic_quotes_runtime", 0);

It seems to work (no more error message), i don't know if this is correct or not, just my 2 cents.

It works and I think it's better than adding an arobase. But many hosts service deactivate the ini_set() function. :-(

Offline

 

#11 2009-08-19 18:16:09

Eric
Former Piwigo Team
VALENCE (FR)
2005-03-25
1768

Re: Compatibility PHP 5.3 (pre-6.0)?

nicolas wrote:

RegisLG wrote:

replace with : ini_set("magic_quotes_runtime", 0);

It seems to work (no more error message), i don't know if this is correct or not, just my 2 cents.

It works and I think it's better than adding an arobase. But many hosts service deactivate the ini_set() function. :-(

ini_set() is not allowed on Free hosting service. That is why I have not mentioned.

I agree with you : We have to find another way as adding an arobase. Even if it works on Free hosting... But I haven't found a solution by other web applications using magic_quotes_runtime. Punbb/Fluxbb's dev team choose the arobase too, for the moment.

Maybe with this below could work on a majority hosting service. I'll try as soon as possible on Free.

Code:

// Check if magic_quotes_runtime is active
if(get_magic_quotes_runtime())
{
    // Deactive
    set_magic_quotes_runtime(false);
}

Offline

 
  •  » Engine
  •  » Compatibility PHP 5.3 (pre-6.0)?

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact