Welcome Guest, Not a member yet? Register   Sign In
emptied POST?
#1

[eluser]stijnvdb[/eluser]
Hi,

recently, all my CI scripts on a certain host stopped functioning properly. The ones on different webservers however, still work.
The problem is that POST variables are emptied upon execution, leaving the user with a "field is required" error. I checked my php.ini file, and the max_post_size was set to 8M. This should be more than sufficient, but I tested it with 30M just to make sure. This obviously didn't solve the problem.
phpinfo and my htaccess file:

http://stijn.scl.be/info.php

Code:
# Turn on the Rewrite Engine
    Options +FollowSymLinks
    RewriteEngine On


    RewriteCond %{HTTP_HOST} ^stijn.scl.be/stijn [NC]
    RewriteCond $1 !^(index\.php|favicon\.ico|style\.css|documents|scripts|system|images|flash|robots\.txt)
    RewriteRule ^(.*)$ http://stijn.scl.be/stijn/$1 [R=301,L]


    
    # If the file or directory exists, show it
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d

  
    RewriteRule ^(.+) - [PT,L]
    
    # Blank queries get sent to the index
    RewriteRule ^$ index.php? [L]
    
    # All other queries get sent to the index as index.php/whatever
    RewriteRule ^(.*)$ index.php?/$1 [L]

I have been searching for the cause of this for several days now. The only 'progress' I've made, is to determine that the issue only exists within CI dirs. When I place a simple php file with a POST execution in the root dir, it works properly (given the same input as the CI ones). The input is no bigger than your average HTML page. $this->output->enable_profiler(TRUE); confirmed that the POST was empty.
fields names were 'title', 'link', 'body'. 'body' was emptied, the others were intact.

If anyone has any ideas, please let me know. I'm going crazy on this one :/
Thanks in advance,

StijnVDB
#2

[eluser]stijnvdb[/eluser]
Hi,

I still haven't been able to solve this problem myself. Some further testing has shown that it is definitely a CI-related issue. I wrote a script that simply lets users give input (textarea) and displays it after submit (through POST, obviously). When placed in the domain's root folder it works perfectly (using the same input that fails in CI). When placed in a CI folder (without actually being implemented into the framework), it still functions properly. However, when it's implemented in CI, that's when it goes bad. It stops accepting POST-data that exceeds a certain size. This is an issue that occurs in every script on my host, so I'm assuming it's not likely that a misconfiguration in one of my CI config files is causing this.

Any suggestions? Smile

Thanks in advance,

StijnVDB
#3

[eluser]Derek Jones[/eluser]
You cannot use a full URL as the target of a rewrite with mod_rewrite, or it actually redirects. And POST values are not retained in redirection.

Code:
RewriteRule ^(.*)$ http://stijn.scl.be/stijn/$1 [R=301,L]
#4

[eluser]stijnvdb[/eluser]
Hi Derek,

thanks a lot for your reply! However, I'm afraid I'm not sure how to correct this error.
Removing the line you indicated causes a 404 when trying the reach the script dir. I have to admit I know almost nothing about htaccess files, I've basically copy/pasted my htaccess from a thread somewhere on these forums... Smile

What exactly would need to be modified in order to get the htaccess to function properly?

The htaccess file worked properly before though. If what you said is correct (about the redirecting and POST values not being retained in redirection) then how is it that only POST values that exceed a certain size suffer from this?

I'll fiddle around a bit with the htaccess file (and read up about them) as I wait for your reply Smile

greetings,

StijnVDB
#5

[eluser]Derek Jones[/eluser]
I can't help you with your .htaccess since I am not familiar with your directory structure or your needs. But the first thing I'd do is remove it completely, and see if the issue still exists, so you can at least know definitively which tree needs barking up.
#6

[eluser]stijnvdb[/eluser]
I know it's been almost 5 months since I first reported this issue here, but I only just found the solution!
For the past couple of months I pretty much gave up on the server mentioned above for developing CI applications, since my host couldn't give me a list of recent updates they installed on the server and I was 100% certain I simply did not change anything before the error occured (and I définitely did not make the same change to every single one of my CI scripts, since all of them were affected by this).

Just a few minutes ago, this issue caught my attention when it occured agàin...I occured again while I was locally (XAMPP, btw) testing a CI script I just developed, I recognized the symptons immediately and knew this issue had come back to haunt me.

Going through my CI config, I noticed that I had global xss filtering enabled. I always enable it in every single one of my CI scripts for security reasons...

As you have guessed by now, disabling it was in fact the solution to my problem.

So as a heads up: If you have the same problem I had with the empty posts, and you have global xss filtering enabled...disabling might be something want to try before you give up and look the other way for 5 friggin months Wink
#7

[eluser]Derek Jones[/eluser]
lol thanks for the followup, stijnvdb, and glad you discovered the problem.
#8

[eluser]stijnvdb[/eluser]
thanks Derek Smile

I still have no idea whatsoever why the global xss filtering only empties my post-variables with those particular installs though Confused

either way, I'm happy it's finally fixed Big Grin
#9

[eluser]Derek Jones[/eluser]
It empties ALL of them ALL of the time? If you are using an older version of CI, I'd first point my finger at the PCRE setup, being incompatible with unicode patterns, which will actually NULL the string. I'd step through Input::xss_clean() and do a var_dump($str);exit; progressively after each line, and find out where your string is getting destroyed.
#10

[eluser]stijnvdb[/eluser]
[quote author="Derek Jones" date="1211505791"]It empties ALL of them ALL of the time? If you are using an older version of CI, I'd first point my finger at the PCRE setup, being incompatible with unicode patterns, which will actually NULL the string. I'd step through Input::xss_clean() and do a var_dump($str);exit; progressively after each line, and find out where your string is getting destroyed.[/quote]
well, not ALL of them, only when they exceed a certain size.

I've started using CI about a year ago now, I think. And to be honest, that's probably the version most of my installs still have (I wrote a CMS in CI back then which I *always* start from when I take on a new project).

So updating my CI files might not be such a bad idea I guess... Wink

Thanks a lot for all your help Derek! Smile

Cheers!




Theme © iAndrew 2016 - Forum software by © MyBB