Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page names are recorded but if a "/0/" if in the URL, it will be removed when it shouldn't #745

Closed
mattab opened this issue May 27, 2009 · 7 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Milestone

Comments

@mattab
Copy link
Member

mattab commented May 27, 2009

from email:

>
> Piwik removes url path section which contains 0,  e.g.
>
> portal/ategories/223/1/0/1/company/3107
>
> is recorded as 
>
> portal/ategories/223/1/1/company/3107
>
> in log table - which is incorrect.


see code in tracker/action and matching unit tests, need fixing

@mattab
Copy link
Member Author

mattab commented May 27, 2009

in core/Tracker/Action.php

                    // remove empty categories
                    $split = array_filter($split);

filter out /0/ in url path like:

portal/categories/223/1/0/1/company/3107

this is wrong!

@anonymous-matomo-user
Copy link

Attachment: Fix for bug #745
745_patch.txt

@anonymous-matomo-user
Copy link

Attachment 745_patch.txt appears to fix the problem by only removing empty-strings in the array_filter. This is accomplished using a filter function implemented as a static on the Piwik_Tracker_Action class (a lambda function could also be used, but I guess that would be less efficient).

Unit test tests/core/Tracker/Action.test.php has also been updated to include the given test case above. Unit test passes successfully.

@robocoder
Copy link
Contributor

Thanks. FYI "ClassName::StaticFunction" is a 5.2.x-ism for callbacks. In general, for backwards compatibility, we should be using this syntax, array('ClassName', 'StaticFunction'). However, in this specific case, I believe we can just use 'strlen' for the callback.

@anonymous-matomo-user
Copy link

Attachment: 745 bugfix #2 - using 'strlen'
745_patch.2.txt

@anonymous-matomo-user
Copy link

Yes, of course! Rather stupid of me, forgetting that 0 evaluates to false when that was the cause of the problem I was trying to fix.

I've attached 745_patch.2.txt which has the fix.

@robocoder
Copy link
Contributor

(In [1272]) Fixes #745 - patch and test case by craigmj; thanks

@mattab mattab added this to the Piwik 0.4.2 milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Projects
None yet
Development

No branches or pull requests

3 participants