[wp-testers] Re: fopen issue; wp-login.php issue

Otto otto at ottodestruct.com
Mon Dec 1 19:39:20 GMT 2008


On Mon, Dec 1, 2008 at 1:30 PM, Admin <admin at activeblogging.com> wrote:
> Appreciate the clarification on the other issues - for the two I was still
> interested in, here's some more details:
>
> Unfortunately, Windows is a law unto itself, so for greatest compatibility,
> specifying the binary flag should work well, since you're actually copying a
> file already including appropriate linefeeds/newlines - it does on my test
> bed. NOTE: the code I gave you was inaccurate - you want:
>
> $handle = fopen('../wp-config.php', 'wb');
> not
> $handle = fopen('../wp-config.php', 'w+b');

This was in specific regards to it adding a newline to the end of the
generated wp-config file.

Since WP uses the example wp-config file to generate the thing from,
One simple and easy fix for this is to remove the ending ?> from the
bottom of that sample file. Without the closing PHP tag, any created
newlines will have no effect.

This is actually a recommended best practice in virtually all PHP
circles, and it's one that I wish WP would adopt as well. If you want
to prevent unintentional output, you don't close the last PHP tag. PHP
assumes end-of-file = closed PHP tag, so it's unnecessary to have it
there.

-Otto


More information about the wp-testers mailing list