php-general Digest 4 Dec 2008 07:36:37 -0000 Issue 5825
Topics (messages 284064 through 284080):
Re: adding key-> value pair to an array
284064 by: Yeti
284065 by: Jencisson Tsu
$_POST suddenly empty; $_GET and _$REQUEST fine
284066 by: Alex Kirk
284067 by: Nathan Rixham
284068 by: Wolf
284069 by: ceo.l-i-e.com
284070 by: Jim Lucas
284071 by: Chris
284072 by: Alex Kirk
284073 by: Chris
284074 by: Nathan Rixham
284075 by: Daniel P. Brown
284076 by: Alex Kirk
284077 by: Alex Kirk
284078 by: Alex Kirk
Re: [RESOLVED] Re: $_POST suddenly empty; $_GET and _$REQUEST fine
284079 by: Alex Kirk
Re: Short circuit evaluation and include
284080 by: David Ansermot
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
> ################
> //you can get really stupid with this..
> ${false} = 'some string here';
> echo ${''};
> //echos some string here
>
I like stupid things
--- End Message ---
--- Begin Message ---
haha,is funny, i like it.
> Date: Wed, 3 Dec 2008 12:40:39 -0800
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: [PHP] adding key-> value pair to an array
>
> > ################
> > //you can get really stupid with this..
> > ${false} = 'some string here';
> > echo ${''};
> > //echos some string here
> >
>
> I like stupid things
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
_________________________________________________________________
You live life online. So we put Windows on the web.
http://clk.atdmt.com/MRT/go/127032869/direct/01/
--- End Message ---
--- Begin Message ---
I've got an Apache 2.2.3 server running PHP 5.2.6 on top of FreeBSD
6.2. It's worked quite well for over a year now. However, as of some
time last night, phpBB broke; upon investigation, I realized that the
problem was that $_POST was never getting populated, even on properly
formed HTML forms.
Testing this to try to find the issue, I used the following script:
<?php
print "Testvar: " . $_POST['testvar'] . "<br/>\n";
?>
<form method="POST" action=http://www.newmars.com/test.php
name=formname enctype="multipart/form-data">
<input type=text name=testvar><br/>
<input type=submit value=Submit><br/>
</form>
It works like a charm on a different machine with an essentially
identical config (it's a newer version of FreeBSD, but that's about
it); however, it never displays the contents of $_POST['testvar'] on
the machine that suddenly quit functioning right last night.
Meanwhile, the rest of PHP seems to be working fine, as the phpBB
forum is accessible in a read-only fashion.
I've searched all over, and done things like restarting Apache;
checking phpinfo() for the POST data (it's not there on the broken
server, but it is on the functional one); writting a quick Perl script
that took POST input to verify that my browser was sending such data
properly (it is); and scouring the Apache/PHP error logs. The worst
part is, I didn't touch the config at all between when it worked and
when it didn't. So now I'm at a total loss as to what could be causing
this, or how I should go about troubleshooting.
Any thoughts on this would be greatly appreciated.
Alex Kirk
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
--- End Message ---
--- Begin Message ---
Alex Kirk wrote:
I've got an Apache 2.2.3 server running PHP 5.2.6 on top of FreeBSD 6.2.
It's worked quite well for over a year now. However, as of some time
last night, phpBB broke; upon investigation, I realized that the problem
was that $_POST was never getting populated, even on properly formed
HTML forms.
Testing this to try to find the issue, I used the following script:
<?php
print "Testvar: " . $_POST['testvar'] . "<br/>\n";
?>
<form method="POST" action=http://www.newmars.com/test.php name=formname
enctype="multipart/form-data">
<input type=text name=testvar><br/>
<input type=submit value=Submit><br/>
</form>
looks like you already fixed it.. works fine for me on your server:
array(1) { ["testvar"]=> string(2) "er" } NULL
(then all the phpinfo())
i posted "er" on the form at bottom..
--- End Message ---
--- Begin Message ---
-----Original Message-----
From: Alex Kirk
I've got an Apache 2.2.3 server running PHP 5.2.6 on top of FreeBSD
6.2. It's worked quite well for over a year now. However, as of some
time last night, phpBB broke; upon investigation, I realized that the
problem was that $_POST was never getting populated, even on properly
formed HTML forms.
Testing this to try to find the issue, I used the following script:
<?php
print "Testvar: " . $_POST['testvar'] . "<br/>\n";
?>
<form method="POST" action=http://www.newmars.com/test.php
name=formname enctype="multipart/form-data">
<input type=text name=testvar><br/>
<input type=submit value=Submit><br/>
</form>
It works like a charm on a different machine with an essentially
identical config (it's a newer version of FreeBSD, but that's about
it); however, it never displays the contents of $_POST['testvar'] on
the machine that suddenly quit functioning right last night.
Meanwhile, the rest of PHP seems to be working fine, as the phpBB
forum is accessible in a read-only fashion.
I've searched all over, and done things like restarting Apache;
checking phpinfo() for the POST data (it's not there on the broken
server, but it is on the functional one); writting a quick Perl script
that took POST input to verify that my browser was sending such data
properly (it is); and scouring the Apache/PHP error logs. The worst
part is, I didn't touch the config at all between when it worked and
when it didn't. So now I'm at a total loss as to what could be causing
this, or how I should go about troubleshooting...
==============
Did you check the apache logs or the php error logs?
How about disk space on the server location where it is storing it's temp files
for the server?
I've seen something similar when disk space was nil after some scripts ran
amok.
HTH,
Wolf
--- End Message ---
--- Begin Message ---
There are httpd.conf settings to reject POST requests, but I don't think it
would behave like that...
But maybe it's a bit more complicated than what I've ever seen for httpd.conf
--- End Message ---
--- Begin Message ---
Nathan Rixham wrote:
> Alex Kirk wrote:
>> I've got an Apache 2.2.3 server running PHP 5.2.6 on top of FreeBSD
>> 6.2. It's worked quite well for over a year now. However, as of some
>> time last night, phpBB broke; upon investigation, I realized that the
>> problem was that $_POST was never getting populated, even on properly
>> formed HTML forms.
>>
>> Testing this to try to find the issue, I used the following script:
>>
>> <?php
>> print "Testvar: " . $_POST['testvar'] . "<br/>\n";
>> ?>
>>
>> <form method="POST" action=http://www.newmars.com/test.php
>> name=formname enctype="multipart/form-data">
>> <input type=text name=testvar><br/>
>> <input type=submit value=Submit><br/>
>> </form>
>>
>
> looks like you already fixed it.. works fine for me on your server:
>
> array(1) { ["testvar"]=> string(2) "er" } NULL
> (then all the phpinfo())
>
> i posted "er" on the form at bottom..
>
Seems to be working for me also.
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Twelfth Night, Act II, Scene V
by William Shakespeare
--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
There are httpd.conf settings to reject POST requests, but I don't think it
would behave like that...
But maybe it's a bit more complicated than what I've ever seen for httpd.conf
Could be mod_security getting in the way and killing some content.
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
I've got an Apache 2.2.3 server running PHP 5.2.6 on top of FreeBSD
6.2. It's worked quite well for over a year now. However, as of some
time last night, phpBB broke; upon investigation, I realized that the
problem was that $_POST was never getting populated, even on properly
formed HTML forms.
Testing this to try to find the issue, I used the following script:
<?php
print "Testvar: " . $_POST['testvar'] . "<br/>\n";
?>
<form method="POST" action=http://www.newmars.com/test.php
name=formname enctype="multipart/form-data">
<input type=text name=testvar><br/>
<input type=submit value=Submit><br/>
</form>
looks like you already fixed it.. works fine for me on your server:
array(1) { ["testvar"]=> string(2) "er" } NULL
(then all the phpinfo())
i posted "er" on the form at bottom..
Seems to be working for me also.
I wish it were a real fix. I had switched the print statement back to
use $_REQUEST after I pasted the code in my message, just to be 100%
certain that I wasn't losing it, and didn't think to switch it back
before I left work for the evening - somehow I didn't anticipate you
guys actually using the live form. :-P
Did you check the apache logs or the php error logs?
Apache logs show no errors at all. The PHP error log is more
interesting - I turned on logging to /var/log/php.err once I started
trying to diagnose this, and that file has yet to be created. At one
point today, I intentionally wrote in a syntax error to a PHP script,
and the error message printed out into the Apache log, so at this
point I'm assuming that if PHP were going to give me a relevant error,
it'd be there.
How about disk space on the server location where it is storing it's temp
files for the server?
I've seen something similar when disk space was nil after some scripts ran
amok.
Temp files should be on /, which is only at 41% of capacity. Even if
it's /usr, that's at 90%, not 100%.
Alex
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
--- End Message ---
--- Begin Message ---
Did you check the apache logs or the php error logs?
Apache logs show no errors at all. The PHP error log is more interesting
- I turned on logging to /var/log/php.err once I started trying to
diagnose this, and that file has yet to be created.
Apache can't write to that location. You need to create it and chown it.
touch /var/log/php.err
chown apache:apache /var/log/php.err
adjust apache with your webserver user/group (check httpd.conf)
though I doubt anything will show up there.
Do you have mod_security enabled in apache? Maybe it's catching
something it shouldn't.
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
Alex Kirk wrote:
I've got an Apache 2.2.3 server running PHP 5.2.6 on top of FreeBSD
6.2. It's worked quite well for over a year now. However, as of some
time last night, phpBB broke; upon investigation, I realized that the
problem was that $_POST was never getting populated, even on properly
formed HTML forms.
Testing this to try to find the issue, I used the following script:
<?php
print "Testvar: " . $_POST['testvar'] . "<br/>\n";
?>
<form method="POST" action=http://www.newmars.com/test.php
name=formname enctype="multipart/form-data">
<input type=text name=testvar><br/>
<input type=submit value=Submit><br/>
</form>
looks like you already fixed it.. works fine for me on your server:
array(1) { ["testvar"]=> string(2) "er" } NULL
(then all the phpinfo())
i posted "er" on the form at bottom..
Seems to be working for me also.
I wish it were a real fix. I had switched the print statement back to
use $_REQUEST after I pasted the code in my message, just to be 100%
certain that I wasn't losing it, and didn't think to switch it back
before I left work for the evening - somehow I didn't anticipate you
guys actually using the live form. :-P
Did you check the apache logs or the php error logs?
Apache logs show no errors at all. The PHP error log is more
interesting - I turned on logging to /var/log/php.err once I started
trying to diagnose this, and that file has yet to be created. At one
point today, I intentionally wrote in a syntax error to a PHP script,
and the error message printed out into the Apache log, so at this
point I'm assuming that if PHP were going to give me a relevant error,
it'd be there.
How about disk space on the server location where it is storing it's
temp
files for the server?
I've seen something similar when disk space was nil after some
scripts ran
amok.
Temp files should be on /, which is only at 41% of capacity. Even if
it's /usr, that's at 90%, not 100%.
Alex
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
and if you remove the multipart/form-data from the form?
any includes in that script that script?
any .htaccess rewrites?
error_reporting(E_ALL | E_STRICT) set?
--- End Message ---
--- Begin Message ---
On Wed, Dec 3, 2008 at 6:03 PM, Alex Kirk <[EMAIL PROTECTED]> wrote:
>
> It works like a charm on a different machine with an essentially identical
> config (it's a newer version of FreeBSD, but that's about it); however, it
> never displays the contents of $_POST['testvar'] on the machine that
> suddenly quit functioning right last night.
Check your php.ini and make sure your EGPCS (variables_order) is okay.
--
</Daniel P. Brown>
http://www.parasane.net/
[EMAIL PROTECTED] || [EMAIL PROTECTED]
50% Off Hosting! http://www.pilotpig.net/specials.php
--- End Message ---
--- Begin Message ---
Quoting "Daniel P. Brown" <[EMAIL PROTECTED]>:
On Wed, Dec 3, 2008 at 6:03 PM, Alex Kirk <[EMAIL PROTECTED]> wrote:
It works like a charm on a different machine with an essentially identical
config (it's a newer version of FreeBSD, but that's about it); however, it
never displays the contents of $_POST['testvar'] on the machine that
suddenly quit functioning right last night.
Check your php.ini and make sure your EGPCS (variables_order) is okay.
It is. In fact, my config is virtually default:
[EMAIL PROTECTED] /usr/local/etc]$ diff -u php.ini php.ini-dist
--- php.ini Wed Dec 3 16:08:31 2008
+++ php.ini-dist Tue Jul 22 11:00:49 2008
@@ -328,7 +328,7 @@
;
; stdout (On) - Display errors to STDOUT
;
-;display_errors = On
+display_errors = On
; Even when display_errors is on, errors that occur during PHP's startup
; sequence are not displayed. It's strongly recommended to keep
@@ -338,7 +338,7 @@
; Log errors into a log file (server-specific log, stderr, or
error_log (below))
; As stated above, you're strongly advised to use error logging in place of
; error displaying on production web sites.
-log_errors = On
+log_errors = Off
; Set maximum length of log_errors. In error_log information about
the source is
; added. The default is 1024 and 0 allows to not apply any maximum
length at all.
@@ -384,7 +384,7 @@
;error_append_string = "</font>"
; Log errors to specified file.
-error_log = /var/log/php.err
+;error_log = filename
; Log errors to syslog (Event Log on NT, not valid in Windows 95).
;error_log = syslog
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
--- End Message ---
--- Begin Message ---
touch /var/log/php.err
chown apache:apache /var/log/php.err
adjust apache with your webserver user/group (check httpd.conf)
though I doubt anything will show up there.
Well, done anyway, just in case.
Do you have mod_security enabled in apache? Maybe it's catching
something it shouldn't.
Nope, unless "grep -iIR security *" in /usr/local/etc/apache22 is
lying to me. ;-)
Alex
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
--- End Message ---
--- Begin Message ---
I've got an Apache 2.2.3 server running PHP 5.2.6 on top of FreeBSD
6.2. It's worked quite well for over a year now. However, as of some
time last night, phpBB broke; upon investigation, I realized that the
problem was that $_POST was never getting populated, even on properly
formed HTML forms.
Testing this to try to find the issue, I used the following script:
<?php
print "Testvar: " . $_POST['testvar'] . "<br/>\n";
?>
<form method="POST" action=http://www.newmars.com/test.php
name=formname enctype="multipart/form-data">
<input type=text name=testvar><br/>
<input type=submit value=Submit><br/>
</form>
looks like you already fixed it.. works fine for me on your server:
array(1) { ["testvar"]=> string(2) "er" } NULL
(then all the phpinfo())
i posted "er" on the form at bottom..
Seems to be working for me also.
I wish it were a real fix. I had switched the print statement back
to use $_REQUEST after I pasted the code in my message, just to be
100% certain that I wasn't losing it, and didn't think to switch it
back before I left work for the evening - somehow I didn't
anticipate you guys actually using the live form. :-P
Did you check the apache logs or the php error logs?
Apache logs show no errors at all. The PHP error log is more
interesting - I turned on logging to /var/log/php.err once I
started trying to diagnose this, and that file has yet to be
created. At one point today, I intentionally wrote in a syntax
error to a PHP script, and the error message printed out into the
Apache log, so at this point I'm assuming that if PHP were going to
give me a relevant error, it'd be there.
How about disk space on the server location where it is storing it's temp
files for the server?
I've seen something similar when disk space was nil after some scripts ran
amok.
Temp files should be on /, which is only at 41% of capacity. Even
if it's /usr, that's at 90%, not 100%.
Alex
and if you remove the multipart/form-data from the form?
I actually added it in during my testing, since I'd seen some bugs
from 2005 or so related to that. I hadn't specified an encoding
previously.
any includes in that script that script?
None.
any .htaccess rewrites?
Hmmm, that's interesting: this is present in the docroot for www.newmars.com:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
mod_rewrite is indeed enabled in the main HTTP config (we use it on
other domains hosted on the box). /wordpress does exist on that
virtual host, but I admit, this is one area that I'm not super-well
versed on. Are there known issues with POST data and rewrites? It
seems sort of odd, since that .htaccess hasn't changed since 3/8/08,
but at this point I'll accept just about any solution. :-)
error_reporting(E_ALL | E_STRICT) set?
It is now...but the whole damn domain went down. WTF????
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
--- End Message ---
--- Begin Message ---
I've got an Apache 2.2.3 server running PHP 5.2.6 on top of FreeBSD
6.2. It's worked quite well for over a year now. However, as of some
time last night, phpBB broke; upon investigation, I realized that the
problem was that $_POST was never getting populated, even on properly
formed HTML forms.
Testing this to try to find the issue, I used the following script:
<?php
print "Testvar: " . $_POST['testvar'] . "<br/>\n";
?>
<form method="POST" action=http://www.newmars.com/test.php
name=formname enctype="multipart/form-data">
<input type=text name=testvar><br/>
<input type=submit value=Submit><br/>
</form>
looks like you already fixed it.. works fine for me on your server:
array(1) { ["testvar"]=> string(2) "er" } NULL
(then all the phpinfo())
i posted "er" on the form at bottom..
Seems to be working for me also.
I wish it were a real fix. I had switched the print statement back
to use $_REQUEST after I pasted the code in my message, just to be
100% certain that I wasn't losing it, and didn't think to switch
it back before I left work for the evening - somehow I didn't
anticipate you guys actually using the live form. :-P
Did you check the apache logs or the php error logs?
Apache logs show no errors at all. The PHP error log is more
interesting - I turned on logging to /var/log/php.err once I
started trying to diagnose this, and that file has yet to be
created. At one point today, I intentionally wrote in a syntax
error to a PHP script, and the error message printed out into the
Apache log, so at this point I'm assuming that if PHP were going
to give me a relevant error, it'd be there.
How about disk space on the server location where it is storing it's temp
files for the server?
I've seen something similar when disk space was nil after some scripts ran
amok.
Temp files should be on /, which is only at 41% of capacity. Even
if it's /usr, that's at 90%, not 100%.
Alex
and if you remove the multipart/form-data from the form?
I actually added it in during my testing, since I'd seen some bugs
from 2005 or so related to that. I hadn't specified an encoding
previously.
any includes in that script that script?
None.
any .htaccess rewrites?
Hmmm, that's interesting: this is present in the docroot for www.newmars.com:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
mod_rewrite is indeed enabled in the main HTTP config (we use it on
other domains hosted on the box). /wordpress does exist on that
virtual host, but I admit, this is one area that I'm not super-well
versed on. Are there known issues with POST data and rewrites? It
seems sort of odd, since that .htaccess hasn't changed since 3/8/08,
but at this point I'll accept just about any solution. :-)
error_reporting(E_ALL | E_STRICT) set?
It is now...but the whole damn domain went down. WTF????
OK, so first off, this "outage" is apparently something confined to
the XP laptop I'm currently sitting at. Remind me to go check for
spyware after I send this...
That said, I was checking with the other guy who has root on the box
before I rebooted the whole server, in case it was some bizarre
caching issue, and he asked that I remove the following line from
httpd.conf before I did so, since apparently he'd added it around the
time that PHP had eaten itself:
LoadModule python_module libexec/apache22/mod_python.so
Strangely enough, after rebooting Apache, it worked like a charm. The
only possible explanation that I can think of - since mod_python and
libphp5 shouldn't conflict - is that this line was immediately
preceded by:
LoadModule php5_module libexec/apache22/libphp5.so
...and Apache did some sort of dumb parsing thing. Though I guess that
wouldn't explain why PHP was only partially broken...
So at this point, I'd like to thank all of you for your extremely
rapid and thorough responses, and say that if anyone cares to probe
this further, I'm open to testing things out...but if we just want to
chalk it up to random weirdness, I'm OK with that, too.
Alex
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
--- End Message ---
--- Begin Message ---
include and include_once dont throw fatal exception.
You should use require or require_once and catch the exception with
try{}catch{} block
[EMAIL PROTECTED] a écrit :
include and require are not functions.
They are language constructs.
They probably don't "return values" nor short-circuit in the usual way.
Ditto for "echo"
If you can strip the parens and have it still work, it's for sure not a
function.
<?php
include_once $file;
echo $file;
?>
is perfectly valid code.
PS
All those disk calls are going to get pretty expensive if your site gets heavy
traffic...
You may want to just write a custom error_handler and use include_once which
will let you trap the error and do something intelligent with it...
--- End Message ---