php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4321 <?php_track_vars?> does not always work
Submitted: 2000-05-04 09:52 UTC Modified: 2000-06-12 18:09 UTC
From: patrick at spacesurfer dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Release Candidate 1 OS: linux 2.2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: patrick at spacesurfer dot com
New email:
PHP Version: OS:

 

 [2000-05-04 09:52 UTC] patrick at spacesurfer dot com
I am running:
Apache/1.3.12 (Unix) mod_perl/1.21 PHP/4.0RC1 mod_ssl/2.6.2 OpenSSL/0.9.5
and I am getting an intermittent problem with <?php_track_vars?>
I have track_vars off as default but in one script I turn them on by putting <?php_track_vars?> in the first line of code. Most of the time all works fine but every so often the relevant variable ($HTTP_GET_VARS or $HTTP_POST_VARS) is not there. I have the following code in the page to test for the relevant variable:

// DEBUG
  $fp=fopen("/tmp/".$Script, "w+");
  fputs($fp, "action=".$action." email=".$email." key=".$key."\n");
  $vars=array();
  if ($HTTP_GET_VARS) {fputs($fp, "GET\n"); $vars=array_merge($vars, $HTTP_GET_VARS);}
  if ($HTTP_POST_VARS) {fputs($fp, "POST\n"); $vars=array_merge($vars, $HTTP_POST_VARS);}
  foreach(array_keys($vars) as $vn)
   {
   fputs($fp, $vn."=".$vars[$vn]." ");
   }
  fputs($fp, "\n");
  fclose($fp);
// END DEBUG

$action, $email, $key are all passed either by GET or POST and are not set within the script. Every so often the temp file has values for the former three variables, but neither $HTTP_GET_VARS $HTTP_POST_VARS exist!
I realise it is very hard to fix such a problem (It took me ages to detect it), but I am willing to help.

You can see the entire script below:
<?php_track_vars?>
<?php

 global $SCRIPT_NAME;
 global $SCRIPT_FILENAME;

 $tmp=split("/", $SCRIPT_FILENAME);
 array_pop($tmp);
 $RFn=join("/", $tmp);
 $tmp=split("/", $SCRIPT_NAME);
 $Script=array_pop($tmp);
 $Fn=$RFn."/d/gen/SecureTransfer/".$Script;
 if (file_exists($Fn))
  {
  include "$Fn";
  unlink("$SCRIPT_FILENAME");
  unlink("$Fn");
  include "index.php";
  }
 else
  {
  include "GlobalVars.phpi";
  GlobalInclude("HtmlHead.phpi");
  GlobalInclude("AuthComplex.phpi");

  $fp=fopen($Fn, "w+");
  flock($fp, LOCK_EX);
  fputs($fp, "<?php ");
  $vars=array();
  global $HTTP_GET_VARS;
  global $HTTP_POST_VARS;
  if ($HTTP_GET_VARS) {$vars=array_merge($vars, $HTTP_GET_VARS);}
  if ($HTTP_POST_VARS) {$vars=array_merge($vars, $HTTP_POST_VARS);}
  foreach(array_keys($vars) as $vn)
   {
   fputs($fp, "$".$vn."=\"".$vars[$vn]."\"; ");
   }
  fputs($fp, "?>");
  flock($fp, LOCK_UN);
  fclose($fp);

// DEBUG
  $fp=fopen("/tmp/".$Script, "w+");
  fputs($fp, "action=".$action." email=".$email." key=".$key."\n");
  $vars=array();
  if ($HTTP_GET_VARS) {fputs($fp, "GET\n"); $vars=array_merge($vars, $HTTP_GET_VARS);}
  if ($HTTP_POST_VARS) {fputs($fp, "POST\n"); $vars=array_merge($vars, $HTTP_POST_VARS);}
  foreach(array_keys($vars) as $vn)
   {
   fputs($fp, $vn."=".$vars[$vn]." ");
   }
  fputs($fp, "\n");
  fclose($fp);
// END DEBUG

  global $SERVER_NAME;
  $url="http://".$SERVER_NAME.$SCRIPT_NAME;
  echo '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'">';
  include "i/secure.phpi";
  }
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-06-01 14:55 UTC] stas at cvs dot php dot net
This script seems to be doing too much and isn't runnable on external system. 
Could you please come with something simpler and that doing nothing except demonstrating the problem?
 [2000-06-12 18:09 UTC] zeev at cvs dot php dot net
<?php_track_vars?> is now officially dead.  It stopped working somewhere along the development of PHP 4.0's betas, and there's no real way of implementing it any longer.

We'll add it to the incompatabilities list, and PHP now issues a warning when recognizing this pattern.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 06:01:32 2024 UTC