Menu

I cann't seem to get rid of this problem

Help
Anonymous
2000-09-21
2000-09-21
  • Anonymous

    Anonymous - 2000-09-21

    >php values.php
    When I run the above line i get the error message as follows:

    X-Powered-By: PHP/4.0.2
    Content-type: text/html

    <br>
    <b>Warning</b>:  Undefined offset:  1 in <b>/home/httpd/html/main.inc</b> on line <b>37</b><br>

    I'm using RH6.2, PHP/4.0.2, MySQL 3.22.30, Apache 1.3.12
    Any clues would be greatly appreciated, or just a prod in the right direction.
    I know that if I remove the bars from that line in main.inc it doesn't have this problem, but I may be breaking something else. Thank You.
    Jan G.
    gannon@cyberdawgs.com

     
    • Anonymous

      Anonymous - 2000-09-21

      Correction, I'm removing the bars from the Split Function above this particular line 37.

       
    • Jason Wies

      Jason Wies - 2000-09-21

      Quick fix:
      $split = preg_split ("/\//",preg_replace("/^http(.*):\/\//", "", $hostname), 2);

      Here is the longer explanation.  Looking at:
      $split = preg_split ("|/|",preg_replace("|^http(.*)://|", "", $hostname), 2);

      the "|/|", is just matching the '/' character to split around.  The same is true for the |^http(.*)://|.  The convention is to use "/pattern/" instead of "|pattern|".  But if I were to use /pattern/, with a '/' begin in the pattern, I would have to do this: '/\//' and '/^http(.*):\/\//', which is a bit less appealing.  However, its a small change, and I'll make it.  This must have been a change in the recent PHP 4.0.x series, because the documentation is still behind.  Included below is part of the section from the PHP manual dealing with PCRE (Perl Compatible Regular Expressions).

      LIV. Regular Expression Functions (Perl-Compatible)

      The syntax for patterns used in these functions closely resembles Perl. The expression should be enclosed in the delimiters, a forward slash (/), for example.
      Any character can be used for delimiter as long as it's not alphanumeric or backslash (\). If the delimiter character has to be used in the expression itself, it needs to be escaped by backslash.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.