Page 1 of 1

Php 4.3.4 => php 5.2.1

Posted: Mon Mar 19, 2007 4:31 pm
by rcmn
I'm migrating part of our php tools to php 5.2.1. the site is not fancy at all with a very simple structure. Anyway all the pages are referenced into index.php that way:

Code: Select all

if ($page == 'my_page') {
	$file_name	     	 = 'my_page.php';}
then if i click on http://myserver/index.php?page=mypage well i'm redirected to mypage
but in our case i'm stuck in index.php.

it work like a charm with Php 4.3.4 but not with 5.2.1 .

Posted: Mon Mar 19, 2007 4:36 pm
by RobertGonzalez
Post your redirect code and the code that sets those vars.

Posted: Tue Mar 20, 2007 4:14 pm
by rcmn
the code would be for a from

Code: Select all

<form method='post'  action='index.php?page=mypage'>
what ever i have to post
</form>

or for side bar ref it would be

Code: Select all

if (isset($sidebar_title)) {

$num_elements = count ($sidebar_link_title);

if ($num_elements >= 1) {
?>
	<td width="140" valign="top">
<table width="100%" cellspacing="0" & cellpadding="0" border="0">
  <tr>
    <td width="100%">
 <table width="140" border="0" cellspacing="0" cellpadding="0">  <tr>    <td background="/images/topLeftTemplateBackground.gif">      <table width="140" border="0" cellspacing="0" cellpadding="0">        <tr>           <td width="8"><img src="/images/leftNav/topHeaderLeft.gif" width="8" height="8"></td>          <td bgcolor="#31719C" width="100%"><img src="/images/leftNav/topHeaderMid.gif" width="126" height="8"></td>          <td width="6"><img src="/images/leftNav/topHeaderRight.gif" width="6" height="8"></td>        </tr>        <tr>           <td width="8"><img src="/images/leftNav/topLeftBlock.gif" width="8" height="15"></td>          <td bgcolor="#31719C" width="100%"><font color="#FFFFFF" face="Verdana, Arial" style='font-size: 10px'><b><? echo $sidebar_title ?></b></font></td>          <td width="6"><img src="/images/leftNav/topRightShadow.gif" width="6" height="15"></td>        </tr>        <tr>           <td width="8"><img src="/images/leftNav/bottomHeaderLeft.gif" width="8" height="19"></td>          <td bgcolor="#31719C" width="100%"><img src="/images/leftNav/bottomHeaderMid.gif" width="126" height="19"></td>          <td width="6"><img src="/images/leftNav/bottomHeaderRight.gif" width="6" height="19"></td>        </tr>      </table>    </td>  </tr></table>    </td>
  </tr>
  <tr>
<?
for ($idx = 0; $idx < $num_elements; ++$idx) {
	echo ("<tr>");
		echo ("<td width=100%>");
		echo ("<table width=140 border=0 cellspacing=0 cellpadding=0 background=/images/leftNav/innerCellBackground.gif>");
			echo ("<tr>");
				echo ("<td width=100%>");
				echo ("<table width=140 border=0 cellspacing=0 cellpadding=0 background=/images/spacer.gif>");
					echo ("<tr valign=top>");
						echo ("<td width=29>");
							echo ("<a href=".$sidebar_link_href[$idx].">");
							echo ("<img src=/images/leftNav/redStar.gif width=29 height=17 border=0></a>");
						echo ("</td>");
						echo ("<td width=105 bgcolor=#FFFFFF>");
							echo ("<b><font color=#000000 face='Verdana, Arial' style='font-size: 10px'><a href=".$sidebar_link_href[$idx].">".$sidebar_link_title[$idx]."</a><br><br></font></b>");
						echo ("</td>");
						echo ("<td width=6>");
							echo (" ");
						echo ("</td>");
					echo ("</tr>");
				echo ("</table>");
				echo ("</td>");
			echo ("</tr>");
		echo ("</table>");
		echo ("</td>");
	  echo ("</tr>");
}


echo ("<tr>");
	echo ("<td width=100%>");
	echo ("<table width=140 border=0 cellspacing=0 cellpadding=0>");
		echo (" <tr>");
			echo (" <td>");
				echo (" <img src=/images/leftNav/footer.gif width=140 height=16>");
			echo (" </td>");
		echo (" </tr>");
	echo (" </table>");
		echo (" <br> ");
	echo (" </td>");
		echo (" </tr>");
echo ("</table>");
echo ("    </td>");
}
}
and the ref in the index would be

Code: Select all

$sidebar_link_title[] = "My Page";
$sidebar_link_href[]  = "index.php?page=mypage";
and finally a simple

Code: Select all

http://myserver/prod/index.php?page=mypage

Posted: Tue Mar 20, 2007 4:41 pm
by feyd
Run the following in a new file and tell us the results please.

Code: Select all

<?php

$neg = array('off', 0, false, '', null);
$flags = array(
	'Register Globals' => 'register_globals',
	'Short Tags' => 'short_open_tag',
	'Display Errors' => 'display_errors',
	'Magic Quotes GPC' => 'magic_quotes_gpc',
	'Magic Quotes Runtime' => 'magic_quotes_runtime',
	'Magic Quotes Sybase' => 'magic_quotes_sybase',
);
$ve = phpversion();
$os = PHP_OS;
$er = intval(error_reporting());
foreach ($flags as $n => $v)
{
	$flags[$n] = (in_array(strtolower(ini_get($v)), $neg) ? 'Off' : 'On');
}
$flags['Config file'] = get_cfg_var('cfg_file_path');
if (empty($flags['Config file']))
{
	$flags['Config file'] = '-';
}
$cli = (php_sapi_name() == 'cli');
$eol = "\n";

$gle = get_loaded_extensions();
$rows = array();
$le = '';
$wide = 4;
$j = count($gle);
$pad = $wide - $j % $wide;
$len = max(array_map('strlen', $gle));
$func = create_function('$a', 'return str_pad($a, ' . intval($len) . ');');
$gle = array_map($func, $gle);
for($i = 0; $i < $j; $i += $wide)
{
	$le .= '   ' . implode('   ', array_slice($gle, $i, $wide)) . $eol;
}

$ec = array(
	'E_STRICT' => 2048, 'E_ALL' => 2047, 'E_USER_NOTICE' => 1024,
	'E_USER_WARNING' => 512, 'E_USER_ERROR' => 256, 'E_COMPILE_WARNING' => 128,
	'E_COMPILE_ERROR' => 64, 'E_CORE_WARNING' => 32, 'E_CORE_ERROR' => 16,
	'E_NOTICE' => 8, 'E_PARSE' => 4, 'E_WARNING' => 2, 'E_ERROR' => 1,
);

$e = array();
$t = $er;
foreach ($ec as $n => $v)
{
	if (($t & $v) == $v)
	{
		$e[] = $n;
		$t ^= $v;
	}
}
if (ceil(count($ec) / 2) + 1 < count($e))
{
	$e2 = array();
	foreach ($ec as $n => $v)
	{
		if (!in_array($n, $e) and $n != 'E_ALL')
		{
			$e2[] = $n;
		}
	}
	$er = $er . ' ((E_ALL | E_STRICT) ^ ' . implode(' ^ ', $e2) . '))';
}
else
{
	$er = $er . ' (' . implode(' | ', $e) . ')';
}

if (!$cli)
{
	echo '<html><head><title>quick info</title></head><body><pre>', $eol;
}

echo 'PHP Version: ', $ve, $eol;
echo 'PHP OS: ', $os, $eol;
echo 'Error Reporting: ', $er, $eol;
foreach ($flags as $n => $v)
{
	echo $n, ': ', $v, $eol;
}
echo 'Loaded Extensions:', $eol, $le, $eol;

if (!$cli)
{
	echo '</pre></body></html>', $eol;
}

?>