Re: Variables are empty only in fwrite

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 15, 2012 at 11:30, Larry <lrrrgg@xxxxxxxxx> wrote:
> Hello, when I pass a variable whose value originally came from $_GET
> or $_REQUEST to fwrite, fwrite behaves as if it was passed an empty
> string. Note that the file is successfully opened and written to by
> the script, but the variable that originally came from $_GET does not
> have its value interpolated in the text file, even though it does get
> interpolated in the echo().
>
> ---- Code ----
> <?
> $meh = $_GET["q"];
> $writeline = ":" . $meh . ":" . strlen($meh) . PHP_EOL;
> echo ( $writeline );
>
> $fp = fopen("/tmp/wtf.log","w+");
> fwrite($fp, $writeline );
> fclose($fp);
>
> var_dump($writeline);
> ?>

    Are you sure it's not a permissions-based issue, perhaps when
writing as the normal user, then the user as which the web server
runs, et cetera?  What happens if you completely remove /tmp/wtf.log
and re-run your script with the appended query string?

-- 
</Daniel P. Brown>
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux