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
- 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=1This 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+
-
This bug has been demonstrated on show2.tiki.org
Please demonstrate your bug on show2.tiki.org
Show.tiki.org is not configured properlyThe public/private keys configured to connect to show2.tiki.org were not accepted. Please make sure you are using RSA keys. Thanks.
- Demonstrate Bug (older Tiki versions)
-
This bug has been demonstrated on show.tikiwiki.org
Please demonstrate your bug on show.tikiwiki.org
Show.tiki.org is not configured properlyThe public/private keys configured to connect to show.tikiwiki.org were not accepted. Please make sure you are using RSA keys. Thanks.
- Ticket ID
- 1336
- Created
- Thursday 30 August, 2007 21:14:37 UTC
by Unknown - LastModif
- Thursday 28 October, 2021 06:28:20 UTC