leibler / dokuwiki-plugin-todo

DokuWiki ToDo Plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHP 7 Errors

SFITCS opened this issue · comments

The latest stable build throws errors when run under PHP7. e.g.:-

[Fri Aug 11 15:12:11.555255 2017] [:error] [pid 12952] [client ::1:57248] PHP Warning:  Declaration of syntax_plugin_todo_todo::handle($match, $state, $pos, Doku_Handler &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /var/www/new/business/lib/plugins/todo/syntax/todo.php on line 0, referer: http://localhost/new/business/doku.php?id=start
[Fri Aug 11 15:12:11.555385 2017] [:error] [pid 12952] [client ::1:57248] PHP Warning:  Declaration of syntax_plugin_todo_todo::render($mode, Doku_Renderer &$renderer, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /var/www/new/business/lib/plugins/todo/syntax/todo.php on line 0, referer: http://localhost/new/business/doku.php?id=start
[Fri Aug 11 15:12:13.395691 2017] [:error] [pid 12958] [client ::1:57286] PHP Warning:  Declaration of syntax_plugin_todo_todo::handle($match, $state, $pos, Doku_Handler &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /var/www/new/business/lib/plugins/todo/syntax/todo.php on line 0, referer: http://localhost/new/business/doku.php?id=start

This is fixable. diff:-

diff -r old/syntax/list.php new/syntax/list.php
55c55
<     public function handle($match, $state, $pos, Doku_Handler &$handler) {
---
>     public function handle($match, $state, $pos, Doku_Handler $handler) {
159c159
<     public function render($mode, Doku_Renderer &$renderer, $data) {
---
>     public function render($mode, Doku_Renderer $renderer, $data) {
diff -r old/syntax/todo.php new/syntax/todo.php
157c157
<      * @param &$handler Doku_Handler  Reference to the Doku_Handler object.
---
>      * @param $handler Doku_Handler  Reference to the Doku_Handler object.
160c160
<     public function handle($match, $state, $pos, Doku_Handler &$handler) {
---
>     public function handle($match, $state, $pos, Doku_Handler $handler) {
211c211
<      * @param &$renderer Doku_Renderer A reference to the renderer object.
---
>      * @param $renderer Doku_Renderer A reference to the renderer object.
215c215
<     public function render($mode, Doku_Renderer &$renderer, $data) {
---
>     public function render($mode, Doku_Renderer $renderer, $data) {
295c295
<      * @param Doku_Renderer_xhtml &$renderer
---
>      * @param Doku_Renderer_xhtml $renderer
300c300
<     protected function createTodoItem(&$renderer, $id, $data) {
---
>     protected function createTodoItem($renderer, $id, $data) {
384c384
<      * @param Doku_Renderer_xhtml &$renderer
---
>      * @param Doku_Renderer_xhtml $renderer
389c389
<     private function _createLink(&$renderer, $pagename, $name = NULL) {
---
>     private function _createLink($renderer, $pagename, $name = NULL) {
437c437
<      * @param Doku_Renderer_xhtml &$renderer current rendering object (use $renderer->doc .= 'text' to output text)
---
>      * @param Doku_Renderer_xhtml $renderer current rendering object (use $renderer->doc .= 'text' to output text)
445c445
<     public function _searchpatternHandler($type, &$renderer, $data, $matches, $params = array(), $page = null, $value = null) {
---
>     public function _searchpatternHandler($type, $renderer, $data, $matches, $params = array(), $page = null, $value = null) {

With the latest build, syntax/todo.php needs to have all references to &$handler changed to $handler, and all references to &$renderer changed to $renderer, to prevent PHP7 errors.

Thanks for the great code.

I have the same issue. I'm currently stuck with 5.6.31, since I have the dw2pdf installed at the same time, that requires PHP7 to run properly.

@pashol
Try the linked modified, stable version. It has the same changes made as shown in the diff I posted earlier.
SHA256: 01e8b4496d8ebf2105dbdfb29b742e2d932ddfe043f3ee0fb669e07fc4b0d076

please, can you prepare a pull request - we're on github ;)
btw. i thought this was already done in #73

i close this as duplicate of #73