I always get errors using PHP7:

mod_fcgid: stderr: PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; PARSEENTRIES has a deprecated constructor in /var/www/.../sites/all/modules/biblio/modules/bibtexParse/PARSEENTRIES.php on line 134

This is PHP4 code. You should rename that contstructor to ensure PHP7 compatibility.

The patch was created against to the current 7.x-1.0-dev.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nerdoc created an issue. See original summary.

nerdoc’s picture

Issue summary: View changes
AndyHeath’s picture

I've used Biblio on D7 as an essential part of my site which runs on ubuntu 14.04 for probably 5 or 6 years. The current Biblio PHP 7 incompatibilities are preventing upgrading to ubuntu 16.04 because that comes with PHP 7 baked in and running an earlier PHP would be very messy.

The results from Biblio are demonstrably wrong on PHP 7 but fine on PHP 5. On PHP 7 each listing of a paper is truncated. For example this is running on PHP 5 on Ubuntu 14.04

http://axelafa.com/content/access-all-elearning

whereas this is an image of the same part of the same site running on a local "mirror" of the site with PHP 7 on Ubuntu 16.04.1

https://s13.postimg.org/o45gxdfs7/Access_For_all_to_e_Learning_Axelrod_A...

The same truncation is the case for every paper.

This is the error I am getting in the log

Type php
Date Saturday, November 12, 2016 - 17:09
User andy
Location http://localhost/content/access-all-elearning
Referrer http://localhost/biblio
Message Notice: Array to string conversion in theme_biblio_tabular() (line 244 of /var/www/drupal/sites/all/modules/biblio/includes/biblio_theme.inc).
Severity notice
Hostname 127.0.0.1

I have admittedly installed the dev version of biblio in case it should solve these issues. I had the truncation of the biblio records before I did that but I don't know whether the error was the same.

Any thoughts about fixing PHP 7 compatibility soon and what kind of timescale that might be on ?

Tempted to try and fix it myself but would prefer to stick with the standard releases than hack the code too much.

Thanks

andy - my apologies if I posted this in the wrong place

Olafski’s picture

Got the same PHP 7 related "deprecated" message as in the issue summary on my site. Consequently the Biblio nodes on the site are truncated, as described in comment #3.

@AndyHeath: Are you considering to provide a patch? I guess, I'm not able to do so but would be happy to test a patch! Btw, in my opinion, the "Array to string conversion" message is another issue. I get it (actually a lot of them) on a site with PHP 5.5.14 as well, but on that site the Biblio nodes are not truncated.

Anonymous’s picture

This sure looks like a php 7 issue. I Checked after I read this: my sites running php7 are all truncated; my main site that's still on 5.5 is displaying just fine.

This really makes biblio useless. Any hopes for a fix before we look to another method for publications?

szeidler’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
3.3 KB

Here's a patch, that fixes the __construct() trouble with the parsing classes and fixes the Array to String conversion in theme_biblio_tabular that was resulted by the new variable evaluation in PHP7.

Alan D.’s picture

Priority: Normal » Major
Status: Needs review » Reviewed & tested by the community

Thanks, works a treat :)

Bumping to major since PHP 7 really is the default now on new systems, quickly clogs the logs and such a trivial patch to review.

Olafski’s picture

Thanks for the patch! I applied it on a test site, and the Biblio nodes are not truncated anymore. Would be happy if the patch could be committed.

kpaxman’s picture

Issue tags: +PHP 7.0 (duplicate)
pbattino’s picture

I ran a php7 compatibility checker on the version I'm using ( 7.x-1.0-rc7+31-dev ) and I got the same result, PLUS one critical error in modules/rtf/rtf_export.inc :
oldClassConstructors
` function rtf() {`
(around line 28)

szeidler’s picture

Status: Reviewed & tested by the community » Needs work
szeidler’s picture

FileSize
3.63 KB
343 bytes

I updated the patch to include also the PHP 7 issue in #10.

szeidler’s picture

Status: Needs work » Needs review
Alan D.’s picture

Hit all? Seemed like the case upset the automated tools.

PARSECREATORS::PARSECREATORS()
USMARC::usmarc($string)
Record::record()
File::file()
Field::field()

And probably better just to delete constructors altogether if the class doesn't extend anything?

class PARSEPAGE
{
-  function PARSEPAGE()
-   {
-   }

szeidler’s picture

Oh you're right, there are even more classes. I also would vote for removing the constructors, that are not doing anything. I can extend my previous patch.

szeidler’s picture

Another shot based on Alan's suggestions.

Alan D.’s picture

Status: Needs review » Reviewed & tested by the community

Nice. :)

emerham’s picture

There are still split functions in the bibtexParse module

biblio/modules/bibtexParse/PARSECREATORS.php
> Line 218: [Error] Removed function "split" called
    split(' ', $matches[1]);
> Line 223: [Error] Removed function "split" called
    split(' ', $value);
> Line 268: [Error] Removed function "split" called
    split(' ', $remainder);
> Line 292: [Error] Removed function "split" called
    split(' ', $input);

and

biblio/modules/bibtexParse/PARSEMONTH.php
> Line 35: [Error] Removed function "split" called
    split('#', $monthField);

php7cc still fails testing as split is no longer there, need to update to preg_split.

emerham’s picture

I've updated the patch with split->preg_split.

emerham’s picture

FileSize
2.07 KB

ok, made the interdiff wrong, updated with proper interdiff

szeidler’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the heads-up @emerham. I haven't seen them. The patch is working fine.

mboesi’s picture

Hi, I have applied the patch and most of the errors are gone. However, when adding a new entry via bibtext I get following error message:

Notice: Undefined property: stdClass::$biblio_type_of_work in _biblio_bibtex_import() (line 263 of /var/www/XXXX/sites/all/modules/biblio/modules/bibtexParse/biblio_bibtex.module).

Did anyone of you experience the same problem? OR does anyone know how to fix this issue?

Thanks in advance!

Alan D.’s picture

@mboesi

This is likely to be completely unrelated to this issue and it is best not to ask about new issues in unrelated threads.

Best to search the open issues and #2114935: Undefined property: biblio_type_of_work in _biblio_bibtex_import() appears to be what you are reporting here, the exact same error!

dev-null’s picture

Thank you for this tremendous patch that helps a lot !!

Just a remaining problem that may have been unnoticed :

The patch is perfectly working for raw references imported from given scientific reviews (check on my test website here http://espacepro.sfa.asso.fr/node/25). However, if I edit the reference to add a full text, the warning is appearing again. (check here http://espacepro.sfa.asso.fr/node/26).

Probably something still missing in biblio_theme.inc . Seems the issue has been fixed elsewhere. As I'm not at all a php wizard, I prefer to flag the issue for specialists. Any clue may help.

Thank you.

dev-null’s picture

Humm... further to my previous message, I confirm that patch 1760736 complete to fix the issue.

Thanks.

  • Liam Morland committed a5b9c0f on 7.x-1.x authored by emerham
    Issue #2806971 by szeidler, emerham, Alan D., nerdoc, Olafski, AndyHeath...
Liam Morland’s picture

Title: PHP7 compatibility » Make compatible with PHP 7
Version: 7.x-1.0-rc7 » 7.x-1.x-dev
Status: Reviewed & tested by the community » Fixed
Olafski’s picture

IIRC the fix didn't make it in 7.x-1.0-rc8 but in the Dev version. Is there a special reason why not in the rc8 version?

Liam Morland’s picture

I wanted to make rc8 be exactly the state of development as it has been since April, 2016. I intend to fix the security issues then release rc9. You can run this fix by running the latest dev version.

vtamas’s picture

Status: Fixed » Needs review
FileSize
571 bytes

A variable wasn't renamed properly in theme_biblio_tabular(). Attaching a patch with a fix.

Liam Morland’s picture

@#30 I appreciate the fix, but that is part of #2846926: Fix new window links using 'biblio_links_target_new_window'.

Liam Morland’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.