V2.6.2 : Undefined index: in Category.php

Please report bugs here!

Moderator: Thorsten

Post Reply
emmanuel
Posts: 1
Joined: Wed Feb 10, 2010 7:52 pm

V2.6.2 : Undefined index: in Category.php

Post by emmanuel »

Hi,

Have a look at these errors, how can it be resolved ? Thank's. Emmanuel.

phpMyFAQ notice [8]: Undefined index: in Category.php on line 777

phpMyFAQ notice [8]: Undefined index: in Category.php on line 778

phpMyFAQ notice [8]: Undefined index: in Category.php on line 779

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at /Data/IMPARTIAL/Web/Public/Client/FAQ/inc/functions.php:173) in index.php on line 574

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at /Data/IMPARTIAL/Web/Public/Client/FAQ/inc/functions.php:173) in index.php on line 575

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at /Data/IMPARTIAL/Web/Public/Client/FAQ/inc/functions.php:173) in index.php on line 576

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at /Data/IMPARTIAL/Web/Public/Client/FAQ/inc/functions.php:173) in index.php on line 577

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at /Data/IMPARTIAL/Web/Public/Client/FAQ/inc/functions.php:173) in index.php on line 578

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at /Data/IMPARTIAL/Web/Public/Client/FAQ/inc/functions.php:173) in index.php on line 579

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at /Data/IMPARTIAL/Web/Public/Client/FAQ/inc/functions.php:173) in index.php on line 580
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: V2.6.2 : Undefined index: in Category.php

Post by Thorsten »

Hi,

how can I reproduce these errors?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
MNibble
Posts: 8
Joined: Wed Mar 10, 2010 1:02 pm

Re: V2.6.2 : Undefined index: in Category.php

Post by MNibble »

reproduction is hard.

I have the same issue. However I wasn't able to create a reliable repro.
It is someone tied to the session of a user. The search term is not as important. I had it with "int" "11" "22".
Most of the time it will go away when you logout and log in again.

Hammering the instant search let the issue appear more often.

It appears to be connected to some articles. For example the int was part of internal error codes, which did not show up in the search at all. While the key words had been "internal error codes". After saving the article again it worked (no change was made .. create a whitespace and deleting it again). However the error stayed for that user for some time.

Restarting apache to wipe the session completely or changing permission level from medium or simple and back did not resolve it ether.

It does show for a split second if you use the instant search backwards. (typing a long word and deleting one character at a time) You can see that the screen changes to the error message and then gets filed with the normal search result.

I can life with missing an article, is there a way to silent the warning?

Cheers,

MNibble

-- we do not use mod rewrite --
MNibble
Posts: 8
Joined: Wed Mar 10, 2010 1:02 pm

Re: V2.6.2 : Undefined index: in Category.php

Post by MNibble »

If I am logged in I can enter 12 in the search and get

9 search results -- which is about right :)

If I am not logged in. I get

------------------------------------------------------------------------------------
phpMyFAQ notice [8]: Undefined index: in Category.php on line 777

phpMyFAQ notice [8]: Undefined index: in Category.php on line 778

phpMyFAQ notice [8]: Undefined index: in Category.php on line 779

9 search results

However only one will be displayed, which again is correct as without being loggin in the other 8 shouldn't be seen. Just the error should not be displayed.
MNibble
Posts: 8
Joined: Wed Mar 10, 2010 1:02 pm

Re: V2.6.2 : Undefined index: in Category.php

Post by MNibble »

A cleaner repro.

Create a new sub category. Use medium permissions. Set some new articles into that category and apply a group to it - not visible for everyone.

Get back to be everyone, just someone that does not have the permission to view it.

Search - try different terms,eventually you will get the error cause the listing (easier to repro with the quick search) would contain FAQs that you are not allowed to view.

As a side note. Those FAQ that are groups based in permissions shouldn't be displayed on the front page to everyone.
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: V2.6.2 : Undefined index: in Category.php

Post by Thorsten »

Hi,

did you tried 2.6.3?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
MNibble
Posts: 8
Joined: Wed Mar 10, 2010 1:02 pm

Re: V2.6.2 : Undefined index: in Category.php

Post by MNibble »

Not yet, will do in the upcoming week.
KwikSilvr
Posts: 4
Joined: Tue May 04, 2010 2:23 pm

Re: V2.6.2 : Undefined index: in Category.php

Post by KwikSilvr »

I still see this issue in the 2.6.4 version.

In my case it appears to be tied to how the categories are configured. I have a top category with 7 sub-categories. One of the Admins changed the permissions on the top category to be locked to a specific group, but all of the sub-categories were open to everyone. Any search that resulted in a FAQ located in one of the sub-categories yielded the error.

Opening the top category back up to everyone has resolved the issue.
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: V2.6.2 : Undefined index: in Category.php

Post by Thorsten »

Hi,

ah... thanks for the hint... I'll check this behaviour.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Gorgo
Posts: 1
Joined: Fri Jul 23, 2010 11:28 am

Re: V2.6.2 : Undefined index: in Category.php

Post by Gorgo »

This is still a problem in the current 2.6.6

- create a category visible to everyone
- create another category not visible to everyone and create a sub-category (visible to everyone)
- put an article into both
- log out and display the article -> "Undefined index: in Category.php" error

fix:
- permissions of subcategory must be set to same permissions like parent category
problem with that:
- if you edit that article, permissions of parent category are reset

background:
it should be possible to have articles in both public and restricted categories at the same time
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: V2.6.2 : Undefined index: in Category.php

Post by Thorsten »

Hi,

I'll check this issue. Thanks for the good description!

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
bram
Posts: 19
Joined: Mon Aug 16, 2010 12:54 pm

Re: V2.6.2 : Undefined index: in Category.php

Post by bram »

A patch that fixes the warnings is attached.
Note that is is not a real fix.

Normally the title shows:
"Main-category: sub-category: question"

When the user has access to the sub-category and not to the main-category then the title shows
": question"
and 3 warnings are generated.

After the patch the title still shows:
": questions"
but no warnings are generated.


This is a patch based on 2.6.7 since the code changed in HEAD.
You do not have the required permissions to view the files attached to this post.
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: V2.6.2 : Undefined index: in Category.php

Post by Thorsten »

Hi,

thanks for the patch. It's fixed in 2.6.8 now.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply