Undefined offset: 1 and username undefined variable Undefined offset: 1 and username undefined variable
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Undefined offset: 1 and username undefined variable

Started by Niecher, June 20, 2013, 01:29:01 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Niecher

In debug mode I get this notices:

Quote
/include/themes.inc.php

  • Notice line 1864: Undefined offset: 1
  • Notice line 1866: Undefined offset: 1
  • Notice line 1866: Undefined offset: 1
  • Notice line 1873: Undefined offset: 1

In the header section tabs:

Quote
    // Header for tabs
    $tabs .= $template['tab_header'];

    if ($CONFIG['tabs_dropdown']) {
        // Dropdown list for all pages
        preg_match('/cat=([\d]+)/', $template['page_link'], $matches);
        $tabs_dropdown_js = <<< EOT

I'm trying to fix it by adding the following code to define offset: 1

Quote
    // Header for tabs
    $tabs .= $template['tab_header'];

    if ($CONFIG['tabs_dropdown']) {
        // Dropdown list for all pages
        preg_match('/cat=([\d]+)/', $template['page_link'], $matches);


    if (!$matches) {
       // return as if {$matches[1]} is empty if no match
       return preg_replace('/cat=([\d]+)/', 'cat=""', $template['page_link']);
    }


        $tabs_dropdown_js = <<< EOT

but it seems that it does not work, I mean, the variable offset: 1 not shown in notices but the template is broken

any idea to define offset: 1?

Thanks in advance. :-\




other notices on file usermgr.php

Quote

  • Runtime Notice line 142: Non-static method Inspekt::makeSuperCage() should not be called statically
  • Notice line 198: Undefined variable: username
  • Runtime Notice line 331: Non-static method CPGPluginAPI::filter() should not be called statically
  • Notice line 342: Undefined variable: username
  • Notice line 343: Undefined variable: username
  • Notice line 350: Undefined variable: username
  • Notice line 351: Undefined variable: username
  • Notice line 355: Undefined variable: username
  • Notice line 356: Undefined variable: username
  • Notice line 360: Undefined variable: username
  • Notice line 361: Undefined variable: username
  • Notice line 368: Undefined variable: username
  • Notice line 369: Undefined variable: username
  • Notice line 373: Undefined variable: username
  • Notice line 374: Undefined variable: username
  • Runtime Notice line 700: Non-static method CPGPluginAPI::filter() should not be called statically

I solved define username variable by changing the following lines in usermgr.php:

Quote
183.    if ($search) {
184.        $username = '&amp;username='.$search; //<--- this one up to line 182.

Best Regards

Αndré

I'm sure there are a lot of code sections that create such notices. The second issue would be fixed by adding something like
$username = '';
somewhere above
    if ($search) {
        $username = '&amp;username='.$search;

but as it doesn't affect Coppermine's functionality, we usually don't fix such notices. I hadn't looked at the first issue, but I assume it also doesn't affect anything than the debug notice output?

Niecher