Odd behavior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
Am having trouble with some code.
I have been developing a web based application on
a machine running php v4.3x, Apache 1.3x Mac OSX 10.3
The application works as expected on this machine.
So I copied the code to my server which is running FreeBSD
v6.0, Apache 1.3.34, php v5.1.2.
On this machine the exact same code does not work as expected
in some critical places.
Here is the code suspect of being troublesome:

include("process.php");
if(file_exists("in_tmp.php"))
  {
   include("in_tmp.php");
  }
if(file_exists("out_tmp.php"))
  {
   include("out_tmp.php");
  }
if(file_exists("save_tmp.php"))
  {
   include("save_tmp.php");
  }
if(file_exists("request_tmp.php"))
  {
   include("request_tmp.php");
  }

< code snipped>

function display($list, $in, $out, $save, $req, $x)
 {
   switch($list)
    {
      case 'in':
      for($i = 0; $i < count($in); $i++)
      {$j = $i + 1;
print "<a href=\"steps.php?list=$list&next=$j&x=$x\">$j</a><br><br>";
      // two sets of links displayed instead of one
       };
        break;
        case 'out':
         for($i = 0; $i < count($out); $i++)
          {$j = $i + 1;
print "<a href=\"steps.php?list=$list&next=$j&x=$x\">$j</a><br><br>";
            // two sets of links displayed instead of one
            };
         break;
         case 'save':
          for($i = 0; $i < count($save); $i++)
           {$j = $i + 1;
print "<a href=\"steps.php?list=$list&next=$j&x=$x\">$j</a><br><br>";
             // two sets of links displayed instead of one
            };
          break;
          case 'requests':
          for($i = 0; $i < count($req); $i++)
           {$j = $i + 1;
print "<a href=\"steps.php?list=$list&next=$j&x=$x\">$j</a><br><br>";
             // two sets of links displayed instead of one
           };
          break;
          };
      }
The print lines above are supposed to produce a list of links to files.
In the web display I get duplicate sets of links which seems to mean
that the loops in the function are running twice, and in one instance
three times instead of once. The arrays are taken from the included
files. These files are php scripts produced by a php script after a
directory is opened and read. The arrays a declared and initialized
in these scripts. If there are no files in the directories, the scripts are
not written (thus the code if(file_exists(so and so file) etc..).
Is there a difference in the behavior of include between php 4x and 5x?
I am also having problems with a regular expression:

$w = ereg("To:&nbsp;&nbsp;&nbsp;&nbsp;\n([ A-Za-z]*)", $data, $m);
$x = ereg("<recipient who='".$m[1]."' to='(.*)' />", $rout, $m_1);
 $dest = $m_1[1];

This code has opened and read a file and is picking out data from the file so it can use this data to copy the file to another directory. On my dev server this code works fine. On the production server this code will not pick up the
match from the first regex and so will not find a match in the second.

Is this a difference between versions of php, known bugs, possibly a
problem with the php or Apache installation on my production server?
If nothing comes to anyone's mind, I will have to do some digging.
but if there is I would appreciate suggestions advice.
Thanks in advance.
JK

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux