Loading...
 
Skip to main content

Publishing TikiWiki Mods causes " Array to string conversion" and an invalid file to be written

Status
Closed
Subject
Publishing TikiWiki Mods causes " Array to string conversion" and an invalid file to be written
Version
1.9.x
Category
  • Error
  • Patch
Feature
Mods
Resolution status
Out of Date
Submitted by
mlove
Lastmod by
Bernard Sfez / Tiki Specialist
Rating
(0)
Description

I have a fresh install of 1.9.7 and 1.9.8 on both Fedora Core 5 and Solaris 10, each with the latest Apache 2.2 and PHP 5 version. When I try to Publish or Republish any TikiWiki Mods, I get this in my php log (I have debugging symbols turned on).

PHP Notice: Array to string conversion in /opt/wiki/lib/mods/modslib.php on line 151, referer: http://wiki/tiki-mods.php?publishall=1
PHP Notice: Array to string conversion in /opt/wiki/lib/mods/modslib.php on line 152, referer: http://wiki/tiki-mods.php?publishall=1
PHP Notice: Array to string conversion in /opt/wiki/lib/mods/modslib.php on line 153, referer: http://wiki/tiki-mods.php?publishall=1
PHP Warning: implode() <a href='function.implode'>function.implode</a>: Bad arguments. in /opt/wiki/lib/mods/modslib.php on line 159, referer: http://wiki/tiki-mods.php?publishall=1

This results in a file beginning with '-rray' being written into mods/Dist and mods/Cache. This file is very hard to remove on these two operating systems, since it keeps tricking the rm command into thinking they are command options even when escaped.

This seems to be the result of an Array being passed as part of the argument to modslib->publish $Items argument. The code assumes that it is a purely an array of strings, and when it is not you generate non-fatal errors that cause this problem

Solution

I haven't looked around in detail to find the root cause of the array being passed, but I have added a simple argument check to the appropriate routine in lib/mods/modslib.php. I am including the diff:

149d148
< if (! is_string($item)) { continue; }

Importance
5
Priority
25
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
1336
Created
Thursday 30 August, 2007 21:14:37 UTC
by Unknown
LastModif
Thursday 28 October, 2021 06:28:20 UTC


Show PHP error messages