Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,835
    Plugin Contributions
    31

    Default Undefined index: path in configure.php (using Apsona)

    Environment: Xampp 182 (Apache 2.4.3 (Win32), PHP 5.4.7) on a windows XP pc
    Shop is accessed by this url www.motorvista.local which is redirected to 127.0.0.1 in the hosts file and a virtual host configuration for the apache server that points to the fileset in D:\My Documents etc…

    To cut a long story short, I’ve been trying to solve a niggling problem with Apsona that boils down to the following:

    If php.ini has
    PHP Code:
    error_reporting E_ALL & ~E_NOTICE 
    it loads ok.

    Whereas if
    PHP Code:
    error_reporting E_ALL 
    it does not load and this error gets produced
    [03-Apr-2013 18:13:20 UTC] PHP Notice: Undefined index: path in D:\My Documents\blah_blahadmin\includes\configure.php on line 32
    [03-Apr-2013 18:13:20 UTC] PHP Notice: Undefined index: path in D:\My Documents\ blah_blahadmin \includes\configure.php on line 32
    line 32 is this:
    PHP Code:
    $t1 parse_url(HTTP_SERVER);$p1 $t1['path'];$t2 parse_url(HTTPS_SERVER);$p2 $t2['path']; 
    And the urls are
    PHP Code:
    define('HTTP_SERVER''http://www.motorvista.local');
      
    define('HTTPS_SERVER''https://www.motorvista.local'); 
    It is true that in all the PHP versions I have tested ['path'] is never set in this scenario.

    Now in normal ZC use this does not cause any error messages but if as a test I put the same line in the admin header, it causes the same error messages.
    Obviously the “problem” can be fixed easily by testing for the array element before assigning it, but my questions are:
    1) Why does normal ZC use not produce the error message? Is it just suppressed or there is some mechanism I don’t understand
    2) Is this something that should be fixed in configure.php with a test or is there something Apsona needs to include in their code to deal with this “correctly”?
    3) Why does logging/not-logging the error message break/allow the page?

    Thanks
    Steve
    Steve
    github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

  2. #2
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: Undefined index: path in configure.php (using Apsona)

    Quote Originally Posted by torvista View Post
    It is true that in all the PHP versions I have tested ['path'] is never set in this scenario.
    I suspect PHP is simply not recognizing ".local" as a valid TLD when running parse_url().

    Quote Originally Posted by torvista View Post
    1) Why does normal ZC use not produce the error message? Is it just suppressed or there is some mechanism I don’t understand
    2) Is this something that should be fixed in configure.php with a test or is there something Apsona needs to include in their code to deal with this “correctly”?
    3) Why does logging/not-logging the error message break/allow the page?
    1. ZC's default error reporting setting suppresses E_NOTICE
    2. Probably easily fixed by not using a ".local" TLD.
    3. When triggering but not suppressing E_NOTICE, PHP execution may halt, hence breaking the page.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,835
    Plugin Contributions
    31

    Default Re: Undefined index: path in configure.php (using Apsona)

    Thanks for that information.

    I tried other TLDs which did not fix it, and was thinking it was a virtualhost issue, but on further research I find other mentions of the error in Joomla and WP forums and then this:
    Note that older versions of PHP (e.g., 4.1) returned an blank string as the path for URLs without any path, such as http://www.php.net

    However more recent versions of PHP (e.g., 4.4.7) don't set the path element in the array, so old code will get a PHP warning about an undefined index.
    http://www.php.net/manual/en/functio...-url.php#77591

    I was unable to find this change documented anywhere.

    Anyway, I have used this in my local admin configure.php
    PHP Code:
    $t1 parse_url(HTTP_SERVER);(isset($t1['path']) ? $p1 $t1['path'] : $p1 '');$t2 parse_url(HTTPS_SERVER);(isset($t2['path']) ? $p2 $t2['path'] : $p2 ''); 
    Steve
    github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

 

 

Similar Threads

  1. v151 index.php?main_page=index& c Path= vs main_page=index&Path=
    By mespe in forum General Questions
    Replies: 7
    Last Post: 24 Mar 2015, 09:55 PM
  2. v139a Is it possible to change this path: index.php?main_page=login
    By AndyPortia in forum General Questions
    Replies: 6
    Last Post: 23 Aug 2012, 05:12 PM
  3. Replies: 3
    Last Post: 2 Jul 2009, 07:28 PM
  4. /index.php not comes: some configure file problem
    By vr4indian in forum Basic Configuration
    Replies: 1
    Last Post: 30 Oct 2006, 03:03 PM
  5. Replies: 3
    Last Post: 4 Sep 2006, 11:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg