Quantcast

[Tiki-devel] How to fix this PHP Notice?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Tiki-devel] How to fix this PHP Notice?

luciash d' being

Hi fellow devs,

I wanted to fix the notice appearing on doc.tiki.org site but cannot figure out how to do it properly. It says:

PHP (5.6.30-0+deb8u1) NOTICE (E_NOTICE):
File: lib/menubuilder/menulib.php
Line: 468
Type: Undefined index: position

It seems to be repeated for each module we have there. When I check the code on line 468 I see it is trying to get a cookie:

$ck = getCookie('menu'.$params['id'].'__'.$option['position'], 'menu');

I was expecting $position but this is more complex and I am unsure where to put the if (isset($option['position'])) { ... }
to get rid of the Notice.

Should it be like this?  if (isset($option['position'])) { $ck = getCookie('menu'.$params['id'].'__'.$option['position'], 'menu'); }

In greater context it looks like:

// set sections open/close according to cookie
                global $prefs;
                foreach ($channels['data'] as $position => &$option) {
                        if (!empty($params['menu_cookie']) && $params['menu_cookie'] == 'n') {
                                if (!empty($option['selected']) || !empty($option['selectedAscendant'])) {
                                        $option['open'] = true;
                                }
                        } else {
                                if (empty($params['id']) && !empty($params['structureId'])) {
                                        $params['id'] = $params['structureId'];
                                }
                                $ck = getCookie('menu'.$params['id'].'__'.$option['position'], 'menu');
                                if ($prefs['javascript_enabled'] === 'n') {
                                        $option['open'] = true;
                                } elseif ($ck === 'o') {
                                        $option['open'] = true;
                                } elseif ($ck === 'c') {
                                        $option['open'] = false;
                                }
                        }
                }
                return $channels;


Thanks,
luci



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Tiki-devel] How to fix this PHP Notice?

Jonny Bradley-4
Hi Luci,

I still can't recreate this one on my localhost - in fact i can't see it on doc now, where do you see this exactly?

jb



On 15 Feb 2017, at 14:41, luciash <[hidden email]> wrote:

Hi fellow devs,

I wanted to fix the notice appearing on doc.tiki.org site but cannot figure out how to do it properly. It says:

PHP (5.6.30-0+deb8u1) NOTICE (E_NOTICE):
File: lib/menubuilder/menulib.php
Line: 468
Type: Undefined index: position

It seems to be repeated for each module we have there. When I check the code on line 468 I see it is trying to get a cookie:

$ck = getCookie('menu'.$params['id'].'__'.$option['position'], 'menu');

I was expecting $position but this is more complex and I am unsure where to put the if (isset($option['position'])) { ... }
to get rid of the Notice.

Should it be like this?  if (isset($option['position'])) { $ck = getCookie('menu'.$params['id'].'__'.$option['position'], 'menu'); }

In greater context it looks like:

// set sections open/close according to cookie
                global $prefs;
                foreach ($channels['data'] as $position => &$option) {
                        if (!empty($params['menu_cookie']) && $params['menu_cookie'] == 'n') {
                                if (!empty($option['selected']) || !empty($option['selectedAscendant'])) {
                                        $option['open'] = true;
                                }
                        } else {
                                if (empty($params['id']) && !empty($params['structureId'])) {
                                        $params['id'] = $params['structureId'];
                                }
                                $ck = getCookie('menu'.$params['id'].'__'.$option['position'], 'menu');
                                if ($prefs['javascript_enabled'] === 'n') {
                                        $option['open'] = true;
                                } elseif ($ck === 'o') {
                                        $option['open'] = true;
                                } elseif ($ck === 'c') {
                                        $option['open'] = false;
                                }
                        }
                }
                return $channels;


Thanks,
luci


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Tiki-devel] How to fix this PHP Notice?

luciash d' being

I see it on http://doc.tiki.org/Documentation (in Firefox private window - not sure if that matters) as logged in - You must be logged in to see it.

luci


On 16.2.2017 14:59, Jonny Bradley wrote:
Hi Luci,

I still can't recreate this one on my localhost - in fact i can't see it on doc now, where do you see this exactly?

jb



On 15 Feb 2017, at 14:41, luciash <[hidden email]> wrote:

Hi fellow devs,

I wanted to fix the notice appearing on doc.tiki.org site but cannot figure out how to do it properly. It says:

PHP (5.6.30-0+deb8u1) NOTICE (E_NOTICE):
File: lib/menubuilder/menulib.php
Line: 468
Type: Undefined index: position

It seems to be repeated for each module we have there. When I check the code on line 468 I see it is trying to get a cookie:

$ck = getCookie('menu'.$params['id'].'__'.$option['position'], 'menu');

I was expecting $position but this is more complex and I am unsure where to put the if (isset($option['position'])) { ... }
to get rid of the Notice.

Should it be like this?  if (isset($option['position'])) { $ck = getCookie('menu'.$params['id'].'__'.$option['position'], 'menu'); }

In greater context it looks like:

// set sections open/close according to cookie
                global $prefs;
                foreach ($channels['data'] as $position => &$option) {
                        if (!empty($params['menu_cookie']) && $params['menu_cookie'] == 'n') {
                                if (!empty($option['selected']) || !empty($option['selectedAscendant'])) {
                                        $option['open'] = true;
                                }
                        } else {
                                if (empty($params['id']) && !empty($params['structureId'])) {
                                        $params['id'] = $params['structureId'];
                                }
                                $ck = getCookie('menu'.$params['id'].'__'.$option['position'], 'menu');
                                if ($prefs['javascript_enabled'] === 'n') {
                                        $option['open'] = true;
                                } elseif ($ck === 'o') {
                                        $option['open'] = true;
                                } elseif ($ck === 'c') {
                                        $option['open'] = false;
                                }
                        }
                }
                return $channels;


Thanks,
luci


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot


_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Tiki-devel] How to fix this PHP Notice?

luciash d' being

I see it in Chrome too, but must be logged in...


On 16.2.2017 15:05, luciash wrote:

I see it on http://doc.tiki.org/Documentation (in Firefox private window - not sure if that matters) as logged in - You must be logged in to see it.

luci


On 16.2.2017 14:59, Jonny Bradley wrote:
Hi Luci,

I still can't recreate this one on my localhost - in fact i can't see it on doc now, where do you see this exactly?

jb



On 15 Feb 2017, at 14:41, luciash <[hidden email]> wrote:

Hi fellow devs,

I wanted to fix the notice appearing on doc.tiki.org site but cannot figure out how to do it properly. It says:

PHP (5.6.30-0+deb8u1) NOTICE (E_NOTICE):
File: lib/menubuilder/menulib.php
Line: 468
Type: Undefined index: position

It seems to be repeated for each module we have there. When I check the code on line 468 I see it is trying to get a cookie:

$ck = getCookie('menu'.$params['id'].'__'.$option['position'], 'menu');

I was expecting $position but this is more complex and I am unsure where to put the if (isset($option['position'])) { ... }
to get rid of the Notice.

Should it be like this?  if (isset($option['position'])) { $ck = getCookie('menu'.$params['id'].'__'.$option['position'], 'menu'); }

In greater context it looks like:

// set sections open/close according to cookie
                global $prefs;
                foreach ($channels['data'] as $position => &$option) {
                        if (!empty($params['menu_cookie']) && $params['menu_cookie'] == 'n') {
                                if (!empty($option['selected']) || !empty($option['selectedAscendant'])) {
                                        $option['open'] = true;
                                }
                        } else {
                                if (empty($params['id']) && !empty($params['structureId'])) {
                                        $params['id'] = $params['structureId'];
                                }
                                $ck = getCookie('menu'.$params['id'].'__'.$option['position'], 'menu');
                                if ($prefs['javascript_enabled'] === 'n') {
                                        $option['open'] = true;
                                } elseif ($ck === 'o') {
                                        $option['open'] = true;
                                } elseif ($ck === 'c') {
                                        $option['open'] = false;
                                }
                        }
                }
                return $channels;


Thanks,
luci


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot


_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot


_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Tiki-devel] How to fix this PHP Notice?

Jonny Bradley-4

Got it, thanks (thought i was logged in but wasn't).

So i can't see any menu modules that are for registered only that might be responsible - can you spot the difference? Or set up a show instance that does it?

The problem is why does the menu option/item not have a position?

I'm guess something like

        $ck = empty($option['position']) ? 'o' : getCookie('menu'.$params['id'].'__'.$option['position'], 'menu')

...would do the trick but would prefer to know why it's happening first...

jb



> On 16 Feb 2017, at 14:07, luciash <[hidden email]> wrote:
>
> I see it in Chrome too, but must be logged in...
>
> On 16.2.2017 15:05, luciash wrote:
>> I see it on http://doc.tiki.org/Documentation (in Firefox private window - not sure if that matters) as logged in - You must be logged in to see it.
>>
>> luci
>>
>> On 16.2.2017 14:59, Jonny Bradley wrote:
>>> Hi Luci,
>>>
>>> I still can't recreate this one on my localhost - in fact i can't see it on doc now, where do you see this exactly?
>>>
>>> jb
>>>
>>>
>>>
>>>> On 15 Feb 2017, at 14:41, luciash <[hidden email]> wrote:
>>>>
>>>> Hi fellow devs,
>>>>
>>>> I wanted to fix the notice appearing on doc.tiki.org site but cannot figure out how to do it properly. It says:
>>>>
>>>> PHP (5.6.30-0+deb8u1) NOTICE (E_NOTICE):
>>>> File: lib/menubuilder/menulib.php
>>>> Line: 468
>>>> Type: Undefined index: position
>>>>
>>>> It seems to be repeated for each module we have there. When I check the code on line 468 I see it is trying to get a cookie:
>>>>
>>>> $ck = getCookie('menu'.$params['id'].'__'.$option['position'], 'menu');
>>>>
>>>> I was expecting $position but this is more complex and I am unsure where to put the if (isset($option['position'])) { ... }
>>>> to get rid of the Notice.
>>>>
>>>> Should it be like this?  if (isset($option['position'])) { $ck = getCookie('menu'.$params['id'].'__'.$option['position'], 'menu'); }
>>>>
>>>> In greater context it looks like:
>>>>
>>>> // set sections open/close according to cookie
>>>>                 global $prefs;
>>>>                 foreach ($channels['data'] as $position => &$option) {
>>>>                         if (!empty($params['menu_cookie']) && $params['menu_cookie'] == 'n') {
>>>>                                 if (!empty($option['selected']) || !empty($option['selectedAscendant'])) {
>>>>                                         $option['open'] = true;
>>>>                                 }
>>>>                         } else {
>>>>                                 if (empty($params['id']) && !empty($params['structureId'])) {
>>>>                                         $params['id'] = $params['structureId'];
>>>>                                 }
>>>>                                 $ck = getCookie('menu'.$params['id'].'__'.$option['position'], 'menu');
>>>>                                 if ($prefs['javascript_enabled'] === 'n') {
>>>>                                         $option['open'] = true;
>>>>                                 } elseif ($ck === 'o') {
>>>>                                         $option['open'] = true;
>>>>                                 } elseif ($ck === 'c') {
>>>>                                         $option['open'] = false;
>>>>                                 }
>>>>                         }
>>>>                 }
>>>>                 return $channels;
>>>>
>>>>
>>>>
>>>> Thanks,
>>>> luci
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Check out the vibrant tech community on one of the world's most
>>>> engaging tech sites, SlashDot.org! http://sdm.link/slashdot_______________________________________________
>>>> TikiWiki-devel mailing list
>>>> [hidden email]
>>>> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, SlashDot.org!
>>> http://sdm.link/slashdot
>>>
>>>
>>> _______________________________________________
>>> TikiWiki-devel mailing list
>>>
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, SlashDot.org!
>> http://sdm.link/slashdot
>>
>>
>> _______________________________________________
>> TikiWiki-devel mailing list
>>
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot_______________________________________________
> TikiWiki-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
Loading...