Data from handle() to render() in plugins, how persistent/global is it?
Chris Green <cl <at> isbd.net>
2012-02-08 14:08:49 GMT
I have two plugins which both pass data to their render() function in
the array returned by the handle() function, the normal/only way to do
it.
One of the items in the array is an array itself, called $rows.
It seems that that data in $rows is common to both plugins, i.e. I am
seeing the data that one plugin has put into the array when I use it in
the other plugin. This causes a problem when the data is used for
insertion into a database using PDO and an INSERT query like:-
INSERT INTO zzr1200 (seqno, blogdate, Mileage, Description) VALUES
(:seqno, :Date, :Mileage, :Description)
The insert fails because there is too much data in the $rows array as it
has values from the 'other' plugin as well as the expected values keyed
with seqno, blogdate, Mileage and Description.
Is this a bug or is it just the way that DokuWiki works?
What's the best way around the problem?
Use different names for the $rows array in the two plugins?
Is there a way to guarantee all values are removed from the array?
Any other ideas?
It probably only affects odd cases like this as normally the handle()
function will have explicitly set all the values expected by the render()
(Continue reading)