[dev] 4.0-git Kronolith (& Ansel) & ensureTypes()
Michael J.Rubinsky
mrubinsk at horde.org
Fri Dec 10 21:03:30 UTC 2010
Quoting Rick Romero <rick at havokmon.com>:
> I'm having an odd issue that cropped up a couple weeks ago.
>
> When I goto Kronolith, I immediaetly get the error:
>
> QUERY FAILED: DUPLICATE ENTRY 'CALENDAR' FOR KEY 2 INSERT INTO
> `RAMPAGE_TYPES` (TYPE_NAME) VALUES ('CALENDAR')
>
> The enries already exist. Looking through the code, ansel also does a
> check against ensureTypes - but it does it under Tags after you view a
> gallery, so it's not as obvious.
>
> I tracked it to: horde/content/lib/Types/Manager.php around line 72:
>
> unset($typeName[$type]);
>
> should be
>
> unset($typeName[$id]);
This code is correct as-is. It's removing a type name that we know is
present from the list of names to ensure are present. $type should be
the value of the type_name field from the query above that line.
Some other users were having similar issues that were the result of a
broken php (one of the db methods was returning the wrong structure).
There is a closed bug about this on bugs.horde.org:
http://bugs.horde.org/ticket/9223
>
> It seems like the types get cached somehow,
Yes, they are cached globally for all users since these mappings would
rarely, if ever change. You need to clear clear your Horde_Cache store.
so trying to revert after it
> works to get it to fail again has proven difficult... But the above change
> seems to fix the problem on both Kronolith and Ansel (in the Tags area).
> All I know for sure is $type is definitely empty in that loop.
If $type is empty, then either your data is corrupt (an empty value in
the db), or your php is broken and not returning the valid data
structure.
Please look at the bug report referenced above, and see if that sounds
like what you are experiencing.
--mike
The Horde Project
http://www.horde.org
More information about the dev
mailing list