monperrus / bibtexbrowser

Beautiful publication lists with bibtex and PHP (standalone or in Wordpress)
http://www.monperrus.net/martin/bibtexbrowser/
84 stars 54 forks source link

Remove Depreciation warnings from PHP 7 #76

Closed moissinac closed 7 years ago

moissinac commented 7 years ago

With PHP7 and simple script for using bibtexbrowser I get messages like

( ! ) Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; StateBasedBibtexParser has a deprecated constructor in ...

Is there a mean to work with PHP 7? a workaround?

monperrus commented 7 years ago

replace

error_reporting(/pp4php:serl/E_ALL/lres/);

by

error_reporting(|E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR|);

?

moissinac commented 7 years ago

replaced @error_reporting(/pp4php:serl/E_ALL/lres/); in bibtexbrowser.php by @error_reporting(E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR);

and got nothing better always a lot of messages Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; StateBasedBibtexParser has a deprecated constructor in C:\outils\wamp64\www\givingsense.eu\sembib\lib\bibtexbrowser.php on line 488

with the test page: <?php $_GET['bib']='../data/bibfiles/bib2017.bib'; include( '../lib/bibtexbrowser.php' ); ?>

moissinac commented 7 years ago

by replacing all contructors by construct, I get a working library for PHP 7 and PHP 5.6.16 for example: class StateBasedBibtexParser { var $delegate; function StateBasedBibtexParser(&$delegate) { ... replaced by class StateBasedBibtexParser { var $delegate; function construct(&$delegate) { ...

monperrus commented 7 years ago

closed per 244c6e4739fac9a37b63b34c73121dce1c3cdada