Announcement

#1 2014-01-26 01:11:46

volo
Guest

piwigo 2.6.1 - Deprecated: preg_replace(): The /e modifier

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /usr/share/nginx/html/piwigo/admin/include/functions.php on line 611


1. automatic upgrade
piwigo2.6.0 → 2.6.1

2. service nginx restart

3. service php5-fpm restart

----------------------------------------
Album Manage - Changing the order of the album - Save Manual Order Click

The same problem occurred

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /usr/share/nginx/html/piwigo/admin/include/functions.php on line 611

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

Piwigo version
Piwigo 2.6.1
Check for upgrade
Subscribe moodcela@gmail.com to Piwigo Announcements Newsletter
Environment
Operating system: Linux
PHP: 5.5.3-1ubuntu2.1 (Show info) [2014-01-26 09:11:10]
MySQL: 5.5.34-MariaDB-1~saucy-log [2014-01-26 09:11:10]
Graphics Library: GD 2.1.1-dev

 

#2 2014-01-26 01:17:01

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: piwigo 2.6.1 - Deprecated: preg_replace(): The /e modifier

Hello

thanks for the report but a minimum of politeness would be great

Offline

 

#3 2014-01-26 01:23:56

volo
Guest

Re: piwigo 2.6.1 - Deprecated: preg_replace(): The /e modifier

 

#4 2014-01-27 08:42:20

JanisV
Member
2013-09-25
85

Re: piwigo 2.6.1 - Deprecated: preg_replace(): The /e modifier

mistic100 wrote:

Hello

thanks for the report but a minimum of politeness would be great

This problem already described in [Forum, topic 23233] sync page lost its HEAD and [Forum, topic 23239] Piwigo 2.6 but still present:(

Pls, check also:
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /var/www/piwigo/admin/include/themes.class.php on line 697

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /var/www/piwigo/admin/include/languages.class.php on line 410

Offline

 

#5 2014-02-09 08:39:42

super-hornet
Member
2014-02-09
2

Re: piwigo 2.6.1 - Deprecated: preg_replace(): The /e modifier

Hi there
My system is using PHP 5.5.9 and I just upgraded to 2.6.1 and encounter such an error.

This is what I do and it looks like it works:
Two files need to modify.

See below. The commented line (#) is the original line):

File #1, themes.php (in piwigo/admin/include)
Look for this function (should be at line #692):
  function theme_version_compare($a, $b)
  {
    # $pattern = array('/([a-z])/ei', '/\.+/', '/\.\Z|\A\./');
    $pattern = array('/([a-z])/i', '/\.+/', '/\.\Z|\A\./');
    $replacement = array( "'.'.intval('\\1', 36).'.'", '.', '');

    # $array = preg_replace($pattern, $replacement, array($a, $b));
    $array = preg_replace_callback($pattern,
      function ($replacement) {
    return $replacement[0];
      }, array($a, $b));

    return version_compare($array[0], $array[1], '>=');
  }

Then for file #2, languages.php (in piwigo/admin/include)
Look for this function (should be at line #405)
  function language_version_compare($a, $b)
  {
#    $pattern = array('/([a-z])/ei', '/\.+/', '/\.\Z|\A\./');
    $pattern = array('/([a-z])/i', '/\.+/', '/\.\Z|\A\./');
    $replacement = array( "'.'.intval('\\1', 36).'.'", '.', '');

#    $array = preg_replace($pattern, $replacement, array($a, $b));
    $array = preg_replace_callback($pattern,
      function ($replacement) {
    return $replacement[0];
      }, array($a, $b));

    return version_compare($array[0], $array[1], '>=');
  }


Hope this will help anyone who encounter similar problem.

Offline

 

#6 2014-02-10 13:05:13

super-hornet
Member
2014-02-09
2

Re: piwigo 2.6.1 - Deprecated: preg_replace(): The /e modifier

When creating new album, realized that another file that need modify to fix the "preg_replace()"

For file #3 (same location..that is piwigo/admin/include)
Filename: functions.php
Somewhere in line #605:
  foreach( $cat_map as $id=>$cat )
  {
    /*
    $new_global_rank = preg_replace(
          '/(\d+)/e',
          "\$cat_map['$1']['rank']",
          str_replace(',', '.', $cat['uppercats'] )
          );
    */
    $new_global_rank = preg_replace_callback(
          '/(\d+)/',
          function () {
        $return_value = "\$cat_map['$1']['rank']";
        return $return_value[0];
          },
          str_replace(',', '.', $cat['uppercats'] )
          );

Offline

 

#7 2014-02-10 13:08:29

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: piwigo 2.6.1 - Deprecated: preg_replace(): The /e modifier

thanks but all has already been updated

[Subversion] r26998 + [Subversion] r27156
[Subversion] r26972

ad you patch use Closures, introduced in PHP 5.3 so we can't use it :)

Offline

 

#8 2014-03-01 19:46:27

marfig
Member
2013-12-12
48

Re: piwigo 2.6.1 - Deprecated: preg_replace(): The /e modifier

Hi all,
could you please kindly help me, how to update my piwigo, currently I have 2.6.1, but still error message

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /var/www/p/admin/include/functions.php on line 611

appears.

Thank you very much
Best Regards
Martin

Offline

 

#9 2014-03-01 19:48:25

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: piwigo 2.6.1 - Deprecated: preg_replace(): The /e modifier

apply theses changes to the file
http://piwigo.org/dev/changeset/26972#file1

Offline

 

#10 2014-03-18 23:03:47

anthoang
Member
2014-03-18
8

Re: piwigo 2.6.1 - Deprecated: preg_replace(): The /e modifier

I'm using v2.6.1.

I had this same problem too and dug into the code to find out where the problem was.  It looks like there is a fix for it in,

http://piwigo.org/dev/changeset/26972#file1


I could update my piwigo files with those changes, but I'd much rather install a new version of piwigo.   Will these changes be in the next version of piwigo? and when?




***As a developer myself, it sucks when new versions of php comes out with deprecated functions.  it's suck a pain to update code.

Offline

 

Board footer

Powered by FluxBB

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