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.
On a server with PHP 7.0.8 this module gives the following error:
mod_fcgid: stderr: PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; MarkdownExtra_Parser has a deprecated constructor in /home/username/public_html/sites/all/modules/markdown/markdown.php on line 1696
The line 1696 looks like:
class MarkdownExtra_Parser extends Markdown_Parser {
and little bit further down there is a function with similar name:
function MarkdownExtra_Parser() {
The http://php.net/manual/en/migration70.deprecated.php says:
PHP 4 style constructors (methods that have the same name as the class they are defined in) are deprecated, and will be removed in the future. PHP 7 will emit E_DEPRECATED if a PHP 4 constructor is the only constructor defined within a class. Classes that implement a __construct() method are unaffected
Comment | File | Size | Author |
---|---|---|---|
#6 | markdown_php_lib_2766143_2.patch | 194.13 KB | frjo |
#2 | markdown_php_lib_2766143.patch | 98.11 KB | frjo |
Comments
Comment #2
frjo CreditAttribution: frjo commentedPlease try this patch that replaces the old PHP Markdown with the new PHP Markdown Lib, see https://michelf.ca/projects/php-markdown/. The Drupal 8 version already uses the PHP Markdown Lib.
Hopefully the lib version works with PHP 7. Please report back any issues. When it works as it should I will make a new release for Drupal 7.
Comment #3
nickonom CreditAttribution: nickonom commentedThanks. Will try soon.
Comment #4
nickonom CreditAttribution: nickonom commentedI have applied the patch and now see bunch of new files on the modules directory. What looks not nice is that there are now two files with the same name, but with first letters of different registers:
Should I just delete the old one? Is it ok all the new files have capital letters in their names?
Comment #5
nickonom CreditAttribution: nickonom commentedThe patch is breaking the website giving:
so unfortunately it is not ready for Drupal 7.
Comment #6
frjo CreditAttribution: frjo commentedA new patch that deletes the old markdown.php file. The new files (Markdown*) should all be in an subfolder named "includes". This should happen automatically when you apply the patch.
Reinstall the markdown filter module and run this command:
wget --quiet --output-document=- https://www.drupal.org/files/issues/markdown_php_lib_2766143_2.patch | patch -p1
Comment #7
iamdroid CreditAttribution: iamdroid commentedPatch #6 works for me.
Thank You.
Comment #8
frjo CreditAttribution: frjo commentedComment #9
nickonom CreditAttribution: nickonom commentedI also do not see the errors anymore. Thanks!
Comment #11
frjo CreditAttribution: frjo commented