kaschioudi / ojs3-markup

markup plugin for OJS3
8 stars 15 forks source link

PHP warning on conversion #57

Closed asmecher closed 6 years ago

asmecher commented 6 years ago

PHP Notice: Undefined variable: abstracts in /home/asmecher/git/ojs/plugins/generic/markup/classes/MarkupConversionHelper.inc.php on line 117

(This may have been a submission without any abstracts.)

kaschioudi commented 6 years ago

I believe I have already fixed this in the past. (see https://github.com/kaschioudi/ojs3-markup/blob/master/classes/MarkupConversionHelper.inc.php#L107) Is there a chance you're not running the latest version of the code ?

asmecher commented 6 years ago

Yes, it looks like it's fixed in HEAD. But shouldn't that be an array initialization, rather than an empty string?

kaschioudi commented 6 years ago

But shouldn't that be an array initialization, rather than an empty string?

in this case, it doesn't really matter because this array goes straight to OTS.

asmecher commented 6 years ago

You're right, it won't behave badly, this is just for clarity's sake. Running

$var = '';
$var[1] = 'something';

...will juggle $var from a string '' into an array ['something'], but it only behaves as expected because $var starts out as an empty string. If $var contains anything else, then $var[1] will be treated as a string index and you'll get a string with some contents replaced.

Since $abstracts is supposed to contain a list, initializing it to an empty list makes more sense, I think.

kaschioudi commented 6 years ago

fixed in master and ojs-stable-3_1_0 branches.