On Thu, 15 Mar 2012 11:30:20 -0400, Larry <lrr...@gmail.com> sent:
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 );


---- Request ----


---- Response --- ( expected )

:meh123:6 string(10) ":meh123:6 "

---- Contents of /tmp/wtf.log ----

Some sort of security setting in php.ini maybe? If so, I'm not only
curious in how to fix it but also how this actually happens. Does the
value assigned to $writeline not get immediately evaluated? I mean,
does $writeline "know" it contains variables from elsewhere, instead
of just containing a string of chars?


I'm not at all sure what's going on with your code and/or site. Please look at:

 < http://mouseha.us/demos/larryproblem.txt >

To see the php code, and:

 < http://mouseha.us/demos/larryproblem.php?q=meh123 >

to see the demo.

Tamara Temple
   aka tamouse__

May you never see a stranger's face in the mirror

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

Reply via email to