Loading...
 
Skip to main content

Slash after the last digit of a Category ID

Status
Closed
Subject
Slash after the last digit of a Category ID
Version
3.x
Category
  • Error
Feature
Category
Resolution status
Invalid
Submitted by
Floh1111
Lastmod by
Ushindi Gedeon
Rating
(0)
Description

Watch Module must be turned on.
Category module must be tuned on.
Article Module must be turned on.

If I create a new Article and assign it to a category that is watched by me, I should get a notifcation that a new object has entered the category. By I don´t get a notification.

I encountered this problem while I was working on the new report feature because I didn´t get an entry in the report too.

The possible Bug is located at the update_object_categories function in categlib.php (Line 1491) in the $categories variable.
$categories contains all new Categorie-ID´s of an object. So if I assign an article to a category, $categories should contain the ID of the category. No problem so far. The problem is, that each ID has a slash behind the last digit.

Copy to clipboard
print_r($categories); die();


at the third line of the function gives

Copy to clipboard
Array ( [0] => 2/ )


I think the slash is wrong.

Solution

Debug it backwards and look for the place where the slash comes from.
Then remove the slash.

I debuged it back somewhere to the tree-generator but I didn´t unterstand the code. Sry.

A hack to solve the problem temporary is, to remove the slash from the ID in the update_object_categories function itself.

Copy to clipboard
//Dirty hack to remove the Slash at the end of the ID (Why is there a slash?!) foreach($categories as $key=>$category) { if($category{strlen($category)-1}=="/") $categories[$key]=substr($category, 0, -1); }
Workaround
Priority
25
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
2540
Created
Wednesday 03 June, 2009 12:25:55 UTC
by Unknown
LastModif
Tuesday 26 May, 2026 14:18:09 UTC


Show PHP error messages