[pmwiki-users] cookbooks SelectQuery and UpdateForm

Petko Yotov 5ko at 5ko.fr
Thu Jun 22 00:37:37 PDT 2023


On 22/06/2023 08:36, Piotr Dybczyński wrote:
> i have several serious problems with PmWiki after upgrading to Debian
> 12 (PHP 8.2) (I have also upgraded PmWiki to the latest).

If indeed you have evidence of any problems on PHP 8.2 with PmWiki core 
itself (as opposed to local customisations), I'd be *very* interested in 
tracking them and fixing them ASAP.

See also https://www.pmwiki.org/wiki/PmWiki/Troubleshooting .

> All pages that use my databases do not work.

I checked if the 2 recipes mentioned above use recent PmWiki programming 
interfaces that work with recent PHP versions, and they do.

I don't use the recipes, I hope someone who does will be able to share 
some insight.

> Some of them generate an error:
> 
> SQLSTATE[HY093]: Invalid parameter number: number of bound variables
> does not match number of tokens

This specific error message means that the database query is incorrectly 
constructed. The query expects for example 3 variables, but instead 2 or 
4 are provided.

To debug this one would need knowledge of your database tables and 
fields, and also the query and the page directive.


> but most of them show nothing (blank page).

Is it a totally blank page, or the header, sidebar, footer are visible 
but not the page content?

This sometimes happens when there is an error in the table names, field 
names, or a syntax error in the query.

A blank page can sometimes happen if a recipe is using 
htmlspecialchars() and there is a mismatch between the expected and 
actual character encoding. But this would also happen in PHP 7.3.

There are other cases with blank pages, search the Troubleshooting page 
above for "blank" or "empty".

> What is really frustrating they also show blank page when I append
> ?action=edit !!!
> After ours of digging I found probable reason fo the abovementioned 
> error.
...
> I want to repair other pages in a similar way but I see blank pages
> when trying to edit.

You could change your code to not include the offending recipes for the 
'edit' action. Something like this:

   if ($action != 'edit') {
     include_once("cookbook/selectquery4.0.php");
     include_once("cookbook/updateform7.php");
   }

This way you should at least be able to edit and save the pages.

Petko

> It would be great if you can help!
> 
> All the best,
> Piotr
> 
> W dniu 21.06.2023 o 19:10, Petko Yotov pisze:
>> SelectQuery has a relatively recent release selectquery4.0.php which 
>> appears to work in PHP 8.2.3.
>> 
>> I don't use the recipe and haven't tested everything, but was able to 
>> have a query displayed correctly with no warnings.
>> 
>> 
>> UpdateForm also has a recent version updateform7.php that I modified 
>> to fix one initial fatal error.
>> 
>> Line 74, initially like this:
>> 
>>    while (count(@$opt['']) > 0 && count($args) > 0)
>> 
>> Changed to look like this:
>> 
>>    while (count((array)@$opt['']) > 0 && count($args) > 0)
>> 
>> I don't use the recipe and haven't tested everything, but was able to 
>> have a query select field auto-filled correctly with no warnings.
>> 
>> Let us know if you notice any other problems.
>> 
>> Petko
>> 
>> 
>> On 21/06/2023 18:01, Piotr Dybczyński wrote:
>>> Hi all,
>>> 
>>> is there anybody who could adapt these two cookbooks to PHP 8.2?
>>> 
>>> I have several PmWiki pages talking to my databases and after
>>> upgrading to Debian 12 they do not work.
>>> 
>>> Great thanks in advance,
>>> Piotr



More information about the pmwiki-users mailing list