Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi everyone,
Recently I faced with issue Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; GeSHi has a deprecated constructor in function require_once() (line 837 in file /sites/all/modules/contrib/libraries/libraries.module).
This error is related to PHP version 7 and higher and appears when user visits the page with code snippets handled by geshi filter.
Comment | File | Size | Author |
---|---|---|---|
#5 | geshifilter-has-a-deprecated-constructor-2885243-5-7.54.patch | 3.15 KB | e.bogatyrev |
#2 | geshifilter-has-a-deprecated-constructor-2885243-1-7.54.patch | 720 bytes | e.bogatyrev |
Comments
Comment #2
e.bogatyrevHere is the patch from me.
Comment #3
e.bogatyrevComment #4
yukare CreditAttribution: yukare commentedI had this too, but we can not fix it, because it is in geshi library, not in the drupal module, which is still compatible with php 4. The better thing we can do is create a path from same dir as geshi(it can be in other places, so we can not use a path from drupal root as it will not work for everyone) and add a note in the readme and the project page to this issue, but we can not fix it.
I see now while looking for the issue. Geshi library has a new version 1.0.9, please use this version, it fixes this issue. I will put a note on project page.
Comment #5
e.bogatyrevHi yukare,
Thanks for your answer. I agree with you, but may be better to add the version verification in
hook_requirements
. Anyway I have created another patch for hook_requirements() and updated the library version forgeshifilter.make
. Please take a look and let me know what do you think.Comment #6
hugronaphor CreditAttribution: hugronaphor as a volunteer and at Acrosto commentedUpdating the GeSHi library to 1.0.9.0 now gives me the: "Undefined index: LANG_NAME in GeSHi->get_language_name()" in Drupal 8
Seems like there are some API changes which has to be addressed, like:
$geshi->set_language_path($dir); is deprecated now.
Comment #7
yukare CreditAttribution: yukare commented@hugronaphor please go to /admin/config/content/formats/geshifilter and click on "Flush geshi language definition cache", if this does not fiz the error please provide the full error message, with file/line number. We do not have this error in a new instalation, so maybe it is something that is on cache.
Comment #8
hugronaphor CreditAttribution: hugronaphor as a volunteer and at Acrosto commentedI'm afraid it's still the same:
I use PHP 7.0.28
Comment #9
geerlingguy CreditAttribution: geerlingguy at Midwestern Mac, LLC commentedSame here, but using 7.x, and running PHP 7.1.x.