Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 133155 - PHP/Upstream fread
Summary: PHP/Upstream fread
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Other
: High normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-12 16:56 UTC by Stefan de Konink
Modified: 2006-05-12 17:14 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan de Konink 2006-05-12 16:56:54 UTC
It seems fread intepretates contents. I don't know if this should be reported here, but it looks like a bug.

<?php
  $filename = 'maillist.php';
  $fp = fopen($filename, 'r+');
  /*$contents = '<?php exit; ?>a:1:{s:0:"";b:1;}';*/
  $contents = fread ($fp, filesize ($filename));
  echo substr($contents, 14);
  fclose($fp);
?>

maillist.php having contents: <?php exit; ?>a:1:{s:0:"";b:1;}

<?php
  $contents = '<?php exit; ?>a:1:{s:0:"";b:1;}';
  echo $contents;
  echo substr($contents, 14);
?>
Comment 1 Stefan de Konink 2006-05-12 16:58:14 UTC
Probably good to mention what is expected and what happens.

Expected:
a:1:{s:0:"";b:1;} as output of substr

Results with fread:
<?php exit; ?>a:1:{s:0:"";b:1;}
Comment 2 Stefan de Konink 2006-05-12 17:14:00 UTC
I missed the chars prepanding <?php exit; ?> which did show up in vim, but not in cat.