00999: Setting $EnableUploadVersions=1 causes errors

Summary: Setting $EnableUploadVersions=1 causes errors
Created: 2007-12-21 22:43
Status: Suspended
Category: Bug
From: jerren?
Priority: 4
Version: 2.2.0-beta65 (VersionNum=2001965)
OS: MS XP/IE7/PHP5.2.4

Description: When setting the variable $EnableUploadVersions=1, the following errors appear at the bottom of the generated wiki page:

Warning: preg_match_all() expects parameter 2 to be string, array given in C:\xampplite\htdocs\pmwiki.php on line 411

Warning: Invalid argument supplied for foreach() in C:\xampplite\htdocs\pmwiki.php on line 412

I am suspending this issue because recent versions of PmWiki appear not to have it (pmwiki.org uses $EnableUploadVersions=1 and doesn't display the error). If something like this happens in the latest version, please add a new PITS entry for it. Thanks! --Petko December 18, 2011, at 02:08 PM

Version: 2.2.35
OS: WIN 7/Uniserver/PHP 5.3.8

Recipes: BlogIt, AuthUser, AuthUserCookie, PmForm, ...

Independent of "EnableUploadVersions" status, I find in my Uniserver error log:
PHP Warning: Invalid argument supplied for foreach() in E:\\UniServer\\www\\wiki\\pmwiki.php on line 419, referer: "Some Wiki page"
line 418: function SDVA(&$var,$val)
line 419: { foreach($val as $k=>$v) if (!isset($var[$k])) $var[$k]=$v; }

I don't understand the function, sorry. What's going wrong? --Jazzvox December 18, 2011, at 01:07 PM

If it is independent of the "EnableUploadVersions" status, it may be better to open a new PITS entry for it.

This function sets default values if such values have not yet been set in config.php. It expects the first parameter to be the name of the array, and the second parameter to be an array of key=>value pairs. An error as yours probably means that the second parameter isn't set or is not an array. If I were you, I'd first check my config.php, then any recipes that are installed -- I can disable recipes one after another and test the wiki every time to see if the error disappears (when the error disappears, I'll know which recipe caused it). --Petko December 18, 2011, at 02:04 PM