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); ?>
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;}
I missed the chars prepanding <?php exit; ?> which did show up in vim, but not in cat.