Announcement

#1 2016-05-20 07:46:10

drbubbles
Member
2015-07-02
7

[resolved] Charlies content php 7

Hello/Hi/Greetings,

I updated to ubuntu 16.04 with php 7.  Movies no longer play, instead I get the error:

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; getID3 has a deprecated constructor in /mnt/s2/piwigo/plugins/charlies/getid3/getid3/getid3.php on line 18

Fatal error: Uncaught Error: Call to undefined function eregi() in /mnt/s2/piwigo/plugins/charlies/getid3/getid3/getid3.php:63 Stack trace: #0 /mnt/s2/piwigo/plugins/charlies/charlies.inc.php(44): getID3->getID3() #1 /mnt/s2/piwigo/plugins/charlies/main.inc.php(140): Charlies_content(Array) #2 /mnt/s2/piwigo/include/functions_plugins.inc.php(229): render_Charlie_element_content('', Array) #3 /mnt/s2/piwigo/picture.php(988): trigger_change('render_element_...', '', Array) #4 {main} thrown in /mnt/s2/piwigo/plugins/charlies/getid3/getid3/getid3.php on line 63

I get only the second part of the error using jplayer,  both parts using videoJS.

Should I try and put php 5.4 back in or is this something I can fix simply by replacing eregi() with preg_match() in the charlies content plugin .php files?

Thanks!

Piwigo version: 2.8.1
PHP version: 7.0
MySQL version: 14.14
Piwigo URL: http://

Offline

 

#2 2016-05-22 01:42:40

drbubbles
Member
2015-07-02
7

Re: [resolved] Charlies content php 7

Replacing the three instances of eregi()  in getid3.php  in Charlies plugin folder fixed it:

The file is here:
    from main piwigo folder: plugins/charlies/getid3/getid3/getid3.php

Search for eregi, and replace with preg_match.

Then put  /i at the end of the part of the command inside the quotes: '  '

For example:

if (eregi('([0-9]+)M', $memory_limit, $matches)) {

becomes:

if (preg_match('([0-9]+)M /i', $memory_limit, $matches)) {

Do both those steps for the three places where eregi appears and the movies will play again.

Last edited by drbubbles (2016-05-22 01:45:25)

Offline

 

#3 2016-08-29 03:11:16

drbubbles
Member
2015-07-02
7

Re: [resolved] Charlies content php 7

For the VideoJS plugin configuration, I found I could avoid further errors by selecting "No" for "Metadata, Show File"

Last edited by drbubbles (2016-08-29 03:11:41)

Offline

 

#4 2017-01-21 23:17:12

jheinitz
Member
2015-02-16
21

Re: [resolved] Charlies content php 7

Hello,

I'm running in the same issue as you after upgradding to PHP7. I followed your advice to replace eregi with preg_match and I also added the /i modifier, but I still get an error:

Warning: preg_match(): Unknown modifier 'M' in /www/vhosts/.........../htdocs/plugins/charlies/getid3/getid3/getid3.php on line 64

The code here looks like this. It is line 64 because I doubled the original line 63 and commented it. Please see below:

                // if (eregi('([0-9]+)M', $memory_limit, $matches)) {
                if (preg_match('([0-9]+)M /i', $memory_limit, $matches)) {

What is wrong? What else do I need to change?

Kind regards

Jens

Offline

 

#5 2017-01-24 11:38:30

jheinitz
Member
2015-02-16
21

Re: [resolved] Charlies content php 7

Hello,

I fixed this issue on my own. Before changing eregi to preg_match with the /i modifier, I needed to change the deprecated constructor to public function __constructor. Afterwards the preg_match did no longer complain about the unknown modifier 'M'.

Kind regards

Jens

Offline

 

#6 2017-01-24 20:27:08

flop25
Piwigo Team
2006-07-06
7037

Re: [resolved] Charlies content php 7

Hello
thank you but could you report all the changes you made so we could update much mroe easily? Thank you


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#7 2017-01-24 23:55:02

jheinitz
Member
2015-02-16
21

Re: [resolved] Charlies content php 7

Hello,

yes, you're right. I should have added this information earlier. Here are the details I made:

File: plugins/charlies/getid3/getid3/getid3.php

Code:

50c50
<       function getID3()
---
>       public function __constructor()
63c63
<               if (eregi('([0-9]+)M', $memory_limit, $matches)) {
---
>               if (preg_match('([0-9]+)M /i', $memory_limit, $matches)) {
219c219
<                                               if (eregi('1 File\(s\)[ ]+([0-9]+) bytes', $dir_output, $matches)) {
---
>                                               if (preg_match('1 File\(s\)[ ]+([0-9]+) bytes /i', $dir_output, $matches)) {
225c225
<                                               if (eregi('([0-9]+) ([0-9]{4}-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}) '.preg_quote($filename).'$', $dir_output, $matches)) {
---
>                                               if (preg_match('([0-9]+) ([0-9]{4}-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}) '.preg_quote($filename).'$ /i', $dir_output, $matches)) {

File: plugins/charlies/charlies.inc.php

Code:

42a43,44
>       // Added by jheinitz - 24-Jan-2017
>       require_once(CHARLIES_PATH.'getid3/getid3/getid3.lib.php');

The second change also solved my problem that I reported here: Plugin Charlie's Content: Class getid3_lib not found

Thanks and kind regards

Jens

Offline

 

Board footer

Powered by FluxBB

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