php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23878 gzencode encodes invalid data only if you use variables
Submitted: 2003-05-29 17:54 UTC Modified: 2003-06-04 12:27 UTC
From: avaurus at schipplock dot de Assigned:
Status: No Feedback Package: Zlib related
PHP Version: 4.3.2 OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
23 - 20 = ?
Subscribe to this entry?

 
 [2003-05-29 17:54 UTC] avaurus at schipplock dot de
<?php

# look at this : 
  	# -----------------
  	# try to use just strings instead of variables -> will work :>
  	# try to use variables instead of just strings -> will NOT work :/
  	# -----------------
  	# it is really a mess with some functions of php under windows
  	$fontfile = str_rot13($id);
  	$gzfilename = str_replace(".ttf","",$fontfile);
  	
  	header("Content-Disposition: attachment; filename=\"$gzfilename.gz\"");
	header("Content-type: application/x-gzip");

    $data = implode("", file("fonts/".$fontfile));
    $gzdata = gzencode($data, 9);
    $fp = fopen("fonts/".$gzfilename.".gz", "w");
    fwrite($fp, $gzdata);
    fclose($fp);
    
	readfile("fonts/".$gzfilename.".gz");
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-30 01:54 UTC] derick@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.

 [2003-06-04 00:26 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2003-06-04 12:27 UTC] moriyoshi@php.net
You are most likely using file() function to retrieve binary files.

What if replacing  

$data = implode("", file("fonts/".$fontfile))

by

$data = file_get_contents("fonts/".$fontfile);

??

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 11 03:01:29 2024 UTC