[dokuwiki] Re: possible bug in parserutils.php patch on the 19th of September...

  • From: Anthony.Caetano@xxxxxxxxxxxx
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sat, 29 Sep 2007 22:25:57 +0200

Hi Chris

> small piece of code.  Its not confidence inspiring that the patches have
> been thought through.

Indeed for my part I have merely been trying to get my blog entries 
creation dates to show up.  I don't have a full understanding of the code.

> ...
> If using the above code still causes warnings in your php logs,  then I
> reckon the metadata itself has somehow gotten incorrect(*).  The best
> ...
> (*) Which could indicate a bug somewhere else in DW.  If anyone does try
> the above code and you still get warnings, feel free to email the
> metadata portion of ?do=debug output to me.  Data values in the keys

I have tried your version and I don't get any warnings in the metadata 
anymore, however, I did blow away all the metadata for these old files and 
recreate, so perhaps it is merely because there isn't corrupted data in 
there now.

> PS.  Its feasible that a syntax plugin could add invalid data to one of
> these keys - I didn't check the metadata renderer to see if that is
> possible.  If it is, it should really be the responsibility of the
> renderer to correct the data before writing it out.

I agree.  As I mentioned in my previous post, some of the fix for my 
problem was in the Meta Plugin.  For instance a somewhat contrived meta 
data entry such as:
~~META:
date created = 2005-10-03 20:43:53
&creator = Anthony Caetano&
something = else
&another = thing
~~

Would generate a data array like this:

Array
(
    [] => Array
        (
            [date created] => 2005-10-03 20:43:53
            [something] => else
        )

    [creator] => Anthony Caetano
    [another] => thing
)

Which is wrong.  It then merges into the metadata essentially via a 
duplicate of the old code in parserutils, but without the emtpy check 
introduced by Tom.  Hence my metadata was not being picked up.  I fixed 
the metadata plugin by:
1.  adding more trim calls in its handler so the explode function didn't 
return empty elements in the arrays.
2.  updating the meta data merge code to be in line with that of the 
parserutils.php.  (Ideally this code should be centralized to keep at 
least the protected validations consistent.)

Once I had fixed this I was still not getting my create dates perhaps 
because of the logic in the parserutils not handling my messed up existing 
metadata, since like I say it seems okay now.  Or maybe for some other 
reason, like perhap I didn't delete the cdate.idx file for the blog... 

Thanks
-ant

Other related posts: