seblucas / cops

Calibre OPDS (and HTML) PHP Server : web-based light alternative to Calibre content server / Calibre2OPDS to serve ebooks (epub, mobi, pdf, ...)
http://blog.slucas.fr/en/oss/calibre-opds-php-server
GNU General Public License v2.0
1.43k stars 229 forks source link

create_function() deprecated #392

Closed brambil closed 6 years ago

brambil commented 6 years ago

Deprecated: Function create_function() is deprecated in /tmp/mnt/NAS/entware/share/www/cops/resources/doT-php/doT.php on line 94

COPS 1.0.1

phpinfo().pdf

marioscube commented 6 years ago

Upgrade to a newer version of COPS, if possible.

seblucas commented 6 years ago

I saw that in the release note for 7.2.0 (around Xmas IIRC). I really don't what to do to replace besides completely changing the templating system.

http://php.net/manual/en/function.create-function.php

I'll think about that.

otapi commented 6 years ago

Well, I'm stucked on this :( I want to install COPS to a RT-AC66U_B1 router with Entware-ng. The OPKG pulls only the PHP 7.2 - the older versions are not there. Since the create_function is deprecated in 7.2, the COPS doesn't work anymore. Any workaround on this? Do you know an OPKG repository with older version of PHP? The newest versions don't seem to help: installing COPS from the master branch Today + copy the vendor folder from the 1.6.5 composer it is even worse with this error message:

Fatal error: Uncaught Error: Class 'Base' not found in /tmp/mnt/core/entware/share/www/index.php:19 Stack trace: #0 {main} thrown in /tmp/mnt/core/entware/share/www/index.php on line 19

Please help!

seblucas commented 6 years ago

create_function should only be used when using server side rendering can you confirm that ?

I've read a lot about alternatives to create_function and did not anything easy to implement

seblucas commented 6 years ago

Also the function is deprecated so it still should be working, does it give an error ? I'll check with a docker image soon but in the meanwhile it would help if you could share a log with the error

otapi commented 6 years ago

I don't have the build running anymore as I switched to Calibre-web, sorry! The orig symptom with COPS latest release and PHP 7.2 was: the browser got the main page with a leading BR tag, and an error message about the deprecated function. Followed by the actual page content with html, head tags and so in. It broke all the css and js script on the page and just the raw text of the body were visible without any formatting or style.

seblucas commented 6 years ago

Ok thanks I see the problem and will fix it. Thanks a lot for your response

brambil commented 6 years ago

create_function should only be used when using server side rendering can you confirm that ?

The problem is the same, even if with client side rendering.