2

I'm developing an app using CakePHP and have encountered a strange problem: When I POST data to a particular method I get a 0 byte response and a simple 404 error in the access log.

psycho953.psych.susx.ac.uk - - [11/Oct/2011:10:17:43 +0100] "GET /research/ssd/aesthetics/participants/add HTTP/1.1" 200 3255 "-" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
psycho953.psych.susx.ac.uk - - [11/Oct/2011:10:17:44 +0100] "POST /research/ssd/aesthetics/participants/add HTTP/1.1" 404 - "http://webvm.psych.sussex.ac.uk/research/ssd/aesthetics/participants/add" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"

POSTing to other forms works, whether or not they use CakePHP or just regular PHP.

I can't figure out how to work beyond the 0 byte response. My question isn't so much "Why isn't this working?" as "How can I find out what's not working?"

For the record, php.ini is set to display errors and succeeds in doing so for syntax errors etc.

Shane Madden
  • 112,982
  • 12
  • 174
  • 248
Tom Wright
  • 914
  • 3
  • 12
  • 25

1 Answers1

3

OK, so the problem was due to an error, but I never found out what the error was. I only solved this by trial and (ahem) error and I'd still like to know how I could have done this more methodically.

For anyone interested, the problem was something to do with a missing field that Cake expected. I had disabled an input field that was prepopulated with data from elsewhere. I didn't realise that disabling the input would stop it's value being submitted. My workaround is to include a hidden field.

Again though, I've no idea why these errors weren't displayed and I'm not sure why the only clue was a 404 in the access log. I'll leave this question unanswered for a few days in case anyone wants to suggest a reason for this.


UPDATE: Turns out that it's a security "feature" of CakePHP. My form had a disabled input, which meant that the hash of field names that Cake passes with the form didn't match what it got back (disabled inputs don't get POSTED).

Tom Wright
  • 914
  • 3
  • 12
  • 25