Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#121 2022-03-11 11:28:50

Gallex
Member
Registered: 2006-10-08
Posts: 1,253

Re: adi_notes - leave notes for Textpattern users

i’m using ver 1.4 and got error after install:

A problem occurred while loading the plugin: adi_notes (1.4) -> 8192: Required parameter $inline_style follows optional parameter $thing on line 719
textpattern/lib/txplib_misc.php:1156 include_once()
textpattern/vendors/Textpattern/Plugin/Plugin.php:352 load_plugin()
textpattern/include/txp_plugin.php:400 Textpattern\Plugin\Plugin->changeStatus()
textpattern/include/txp_plugin.php:54 switch_status()
textpattern/index.php:230 include()

fresh install
txp 4.8.8
php 8.0

Offline

#122 2022-03-11 17:44:24

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,412
Website

Re: adi_notes - leave notes for Textpattern users

Hi Gallex,

That’s because things got a bit stricter with PHP 8+ as described here. For the moment, you’re just seeing a deprecation notice, not a full error.

And the solution, as far as I can tell is: go into /textpattern/plugins/adi_notes/ and open adi_notes.php. Go down to line 719 (where the error is showing and replace that function with this:

function adi_notes_textarea($name, $thing = '', $id = '', $rows='5', $cols='40', $inline_style='') {
// based on text_area() but with added inline style & without height & width

	$id = ($id) ? ' id="'.$id.'"' : '';
	$rows = ' rows="' . ( ($rows && is_numeric($rows)) ? $rows : '5') . '"';
	$cols = ' cols="' . ( ($cols && is_numeric($cols)) ? $cols : '40') . '"';
	$style = !empty($inline_style) ? ' style="'.$inline_style.'"' : '';
	return '<textarea'.$id.' name="'.$name.'"'.$rows.$cols.$style.'>'.txpspecialchars($thing).'</textarea>';
}

The only things that have changed are

line 719: $inline_style  ->  $inline_style=''

making $inline_style also an optional parameter, and:

line 725: ($inline_style) ? …  ->  !empty($inline_style) ? …

I’ve only briefly tested it, but it looks like it’s working fine. It should also be backwards compatible. Another solution would be to change the order of the parameters, but you then need to change it where the function is called too.


TXP Builders – finely-crafted code, design and txp

Offline

#123 2022-03-13 09:46:12

Gallex
Member
Registered: 2006-10-08
Posts: 1,253

Re: adi_notes - leave notes for Textpattern users

thank you, jakob!
i hope adi will find a time to fix this. i use this plugin a lot

Offline

Board footer

Powered by FluxBB