MAMP: Apache denying clients - apache

I am using localtunnel.me to tunnel between local machine and a remote HTTPS server, it's not working for me. in error log I am getting following:
[Sun Apr 17 13:12:37 2016] [error] [client ::1] client denied by server configuration: /Applications/MAMP/htdocs/.DS_Store
[Sun Apr 17 13:12:46 2016] [error] [client ::1] client denied by server configuration: /Applications/MAMP/htdocs/products/.DS_Store, referer: http://localhost/
[Sun Apr 17 13:29:37 2016] [error] [client 127.0.0.1] client denied by server configuration: /Applications/MAMP/htdocs/.DS_Store
[Sun Apr 17 13:29:37 2016] [error] [client 127.0.0.1] client denied by server configuration: /Applications/MAMP/htdocs/.DS_Store
[Sun Apr 17 13:29:51 2016] [error] [client 127.0.0.1] client denied by server configuration: /Applications/MAMP/htdocs/products/.DS_Store, referer: https://gdntrdlhyv.localtunnel.me/
[Sun Apr 17 14:46:17 2016] [error] [client 127.0.0.1] client denied by server configuration: /Applications/MAMP/htdocs/.DS_Store
[Sun Apr 17 14:46:38 2016] [error] [client 127.0.0.1] client denied by server configuration: /Applications/MAMP/htdocs/products/.DS_Store, referer: https://epvztmlgwo.localtunnel.me/
[Sun Apr 17 14:48:48 2016] [error] [client 127.0.0.1] client denied by server configuration: /Applications/MAMP/htdocs/.DS_Store
[Sun Apr 17 14:48:48 2016] [error] [client 127.0.0.1] client denied by server configuration: /Applications/MAMP/htdocs/.DS_Store
[Sun Apr 17 14:48:56 2016] [error] [client 127.0.0.1] client denied by server configuration: /Applications/MAMP/htdocs/products/.DS_Store, referer: https://grosjejjos.localtunnel.me/
[Sun Apr 17 14:57:43 2016] [error] [client 127.0.0.1] client denied by server configuration: /Applications/MAMP/htdocs/.DS_Store
[Sun Apr 17 14:57:50 2016] [error] [client 127.0.0.1] client denied by server configuration: /Applications/MAMP/htdocs/products/.DS_Store, referer: https://gpyzbdhwqk.localtunnel.me/
[Sun Apr 17 15:13:49 2016] [error] [client 127.0.0.1] client denied by server configuration: /Applications/MAMP/htdocs/.DS_Store
I am using Apache 2.2 version shipped with MAMP. I am not getting clue why is it and how it's finding .DS_Store files.

Related

"OSError: [Errno 88] Socket operation on non-socket" by flipflop

When trying to deploy an Flask application to my LAMP server, I got an error from flipflop, a FastCGI/WSGI gateway which enables my application to speak the FastCGI protocol.
~/minimal/run.py
from flask import Flask
from flipflop import WSGIServer
app = Flask(__name__)
#app.route('/')
def hello_world():
return 'hello, world'
if __name__ == '__main__':
WSGIServer(app).run()
Relevant part of the Apache configuration file, i.e. /etc/httpd/conf/httpd.conf:
<VirtualHost *:80>
ScriptAlias / /home/apps/minimal/run.py
ErrorLog /var/log/httpd/error_log
</VirtualHost>
Error report by Apache/2.2.15:
[apps#kernod0 ~]$ sudo head -n 20 /var/log/httpd/error_log
[sudo] password for apps:
[Wed Aug 16 16:39:16 2017] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Aug 16 16:39:16 2017] [notice] Digest: generating secret for digest authentication ...
[Wed Aug 16 16:39:16 2017] [notice] Digest: done
[Wed Aug 16 16:39:16 2017] [notice] Apache/2.2.15 (Unix) DAV/2 mod_fcgid/2.3.9 configured -- resuming normal operations
[Wed Aug 16 16:39:16 2017] [error] [client 100.116.224.219] Traceback (most recent call last):
[Wed Aug 16 16:39:16 2017] [error] [client 100.116.224.219] File "/home/apps/minimal/run.py", line 12, in <module>
[Wed Aug 16 16:39:16 2017] [error] [client 100.116.224.219] WSGIServer(app).run()
[Wed Aug 16 16:39:16 2017] [error] [client 100.116.224.219] File "/home/apps/minimal/flask/lib/python2.6/site-packages/flipflop.py", line 938, in run
[Wed Aug 16 16:39:16 2017] [error] [client 100.116.224.219] sock.getpeername()
[Wed Aug 16 16:39:16 2017] [error] [client 100.116.224.219] socket.error: [Errno 88] Socket operation on non-socket
[Wed Aug 16 16:39:16 2017] [error] [client 100.116.224.219] Premature end of script headers: run.py
[Wed Aug 16 16:39:17 2017] [error] [client 100.116.226.253] Traceback (most recent call last):
[Wed Aug 16 16:39:17 2017] [error] [client 100.116.226.253] File "/home/apps/minimal/run.py", line 12, in <module>
[Wed Aug 16 16:39:17 2017] [error] [client 100.116.226.253] WSGIServer(app).run()
[Wed Aug 16 16:39:17 2017] [error] [client 100.116.226.253] File "/home/apps/minimal/flask/lib/python2.6/site-packages/flipflop.py", line 938, in run
[Wed Aug 16 16:39:17 2017] [error] [client 100.116.226.253] sock.getpeername()
[Wed Aug 16 16:39:17 2017] [error] [client 100.116.226.253] socket.error: [Errno 88] Socket operation on non-socket
[Wed Aug 16 16:39:17 2017] [error] [client 100.116.226.253] Premature end of script headers: run.py
[Wed Aug 16 16:39:17 2017] [error] [client 100.116.226.205] Traceback (most recent call last):
[Wed Aug 16 16:39:17 2017] [error] [client 100.116.226.205] File "/home/apps/minimal/run.py", line 12, in <module>
In addition, even without using flipflop, it still doesn't work:
~/minimal/run.py
from flask import Flask
app = Flask(__name__)
#app.route('/')
def hello_world():
return 'hello, world'
if __name__ == '__main__':
app.run()
Error output:
[apps#kernod0 ~]$ sudo cat /var/log/httpd/error_log
[Wed Aug 16 20:47:24 2017] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Aug 16 20:47:24 2017] [notice] Digest: generating secret for digest authentication ...
[Wed Aug 16 20:47:24 2017] [notice] Digest: done
[Wed Aug 16 20:47:24 2017] [notice] Apache/2.2.15 (Unix) DAV/2 mod_fcgid/2.3.9 configured -- resuming normal operations
[Wed Aug 16 20:47:33 2017] [error] [client 100.116.226.182] * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] Traceback (most recent call last):
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] File "/home/apps/minimal/run.py", line 11, in <module>
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190]
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] app.run()
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] File "/home/apps/minimal/flask/lib/python2.6/site-packages/flask/app.py", line 841, in run
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190]
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] run_simple(host, port, self, **options)
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] File "/home/apps/minimal/flask/lib/python2.6/site-packages/werkzeug/serving.py", line 739, in run_simple
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190]
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] inner()
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] File "/home/apps/minimal/flask/lib/python2.6/site-packages/werkzeug/serving.py", line 699, in inner
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190]
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] fd=fd)
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] File "/home/apps/minimal/flask/lib/python2.6/site-packages/werkzeug/serving.py", line 593, in make_server
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190]
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] passthrough_errors, ssl_context, fd=fd)
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] File "/home/apps/minimal/flask/lib/python2.6/site-packages/werkzeug/serving.py", line 504, in __init__
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190]
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] HTTPServer.__init__(self, (host, int(port)), handler)
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] File "/usr/lib64/python2.6/SocketServer.py", line 412, in __init__
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190]
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] self.server_bind()
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] File "/usr/lib64/python2.6/BaseHTTPServer.py", line 108, in server_bind
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190]
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] SocketServer.TCPServer.server_bind(self)
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] File "/usr/lib64/python2.6/SocketServer.py", line 423, in server_bind
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190]
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] self.socket.bind(self.server_address)
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] File "<string>", line 1, in bind
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] socket
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] .
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] error
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] :
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] [Errno 98] Address already in use
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190]
[Wed Aug 16 20:47:37 2017] [error] [client 100.116.226.190] Premature end of script headers: run.py
[Wed Aug 16 20:48:33 2017] [warn] [client 100.116.226.182] Timeout waiting for output from CGI script /home/apps/minimal/run.py
[Wed Aug 16 20:48:33 2017] [error] [client 100.116.226.182] Script timed out before returning headers: run.py
[Wed Aug 16 20:49:33 2017] [warn] [client 100.116.226.182] Timeout waiting for output from CGI script /home/apps/minimal/run.py
I've managed to run your example, but there are some tweaking involved to make it work.
You might need to change paths on your system, because from your logs it seems that you're using system that runs python2.6 and older apache version which still uses httpd file.
If it is possible I would advise you to upgrade your environment.
Here is a step-by-step working solution:
1.Install virtualenvwrapper:
sudo -EH pip2 install virtualenvwrapper
2.Activte it:
source /usr/local/bin/virtualenvwrapper.sh
3.Create virtual env:
mkvirtualenv minimal
4.Install flask and flup:
pip install -U flask flup
flipflop is not working for me, but as it's README states
This module is a simplified fork of flup, written by Allan Saddi. It only has the FastCGI part of the original module.
so you can safely use it.
5.Install apache2:
sudo apt-get install apache2
6.Install libapache2-mod-fastcgi:
sudo apt-get install libapache2-mod-fastcgi
7.Create /var/www/minimal/run.py:
from flask import Flask
app = Flask(__name__)
#app.route('/')
def hello_world():
return 'hello, world'
8.Create /var/www/minimal/minimal.fcgi:
#!/usr/bin/python
import sys
import logging
logging.basicConfig(stream=sys.stderr)
activate_this = '/home/some_user/.virtualenvs/minimal/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
sys.path.insert(0,"/var/www/minimal/")
from flup.server.fcgi import WSGIServer
from run import app
if __name__ == '__main__':
WSGIServer(app).run()
9.Make minimal.fcgi executable:
sudo chmod +x minimal.fcgi
10.Create minimal.conf file (in /etc/apache2/sites-available on my server):
FastCgiServer /var/www/minimal/minimal.fcgi -idle-timeout 300 -processes 5
<VirtualHost *:80>
ServerName YOUR_IP_ADDRESS
DocumentRoot /var/www/minimal/
AddHandler fastcgi-script fcgi
ScriptAlias / /var/www/minimal/minimal.fcgi/
<Location />
SetHandler fastcgi-script
</Location>
</VirtualHost>
11.Enable new site:
sudo a2ensite minimal.conf
12.Change /var/www/ ownership to www-data user:
sudo chown -R www-data:www-data /var/www/
13.Restart apache2:
sudo /etc/init.d/apache2 restart
And voila! :)
If you visit your server address you should see hello, world in your browser:
Also when restarting apache you can view FastCGI starting in apache's error.log:
[Thu Aug 24 16:33:09.354544 2017] [mpm_event:notice] [pid 17375:tid 139752788969344] AH00491: caught SIGTERM, shutting down
[Thu Aug 24 16:33:10.414829 2017] [mpm_event:notice] [pid 17548:tid 139700962228096] AH00489: Apache/2.4.18 (Ubuntu) mod_fastcgi/mod_fastcgi-SNAP-0910052141 configured -- resuming normal operations
[Thu Aug 24 16:33:10.415033 2017] [core:notice] [pid 17548:tid 139700962228096] AH00094: Command line: '/usr/sbin/apache2'
[Thu Aug 24 16:33:10.415651 2017] [:notice] [pid 17551:tid 139700962228096] FastCGI: process manager initialized (pid 17551)
[Thu Aug 24 16:33:10.416135 2017] [:warn] [pid 17551:tid 139700962228096] FastCGI: server "/var/www/minimal/minimal.fcgi" started (pid 17556)
[Thu Aug 24 16:33:11.416571 2017] [:warn] [pid 17551:tid 139700962228096] FastCGI: server "/var/www/minimal/minimal.fcgi" started (pid 17618)
[Thu Aug 24 16:33:12.422058 2017] [:warn] [pid 17551:tid 139700962228096] FastCGI: server "/var/www/minimal/minimal.fcgi" started (pid 17643)
[Thu Aug 24 16:33:13.422763 2017] [:warn] [pid 17551:tid 139700962228096] FastCGI: server "/var/www/minimal/minimal.fcgi" started (pid 17651)
[Thu Aug 24 16:33:14.423536 2017] [:warn] [pid 17551:tid 139700962228096] FastCGI: server "/var/www/minimal/minimal.fcgi" started (pid 17659)
You can't run the fastcgi script from the terminal. This script is supposed to be executed by Apache. Typically you have it configured in a ScriptAlias directive in your Apache config file.
In general you should use mod_fastcgi and configuration simillar to:
<VirtualHost *:8091>
ServerName helloworld.local
DocumentRoot /home/fe/work/flipflop
FastCgiServer /home/fe/work/flipflop/run.py
ScriptAlias / /home/fe/work/flipflop/run.py
<Location />
Options none
</Location>
</VirtualHost>
So it will make run your script as FastCgi, but I'm not familiar with flipflop and can't make it works.
But if you are not limited to flipflop you could use uwsgi to run your application, mod_wsgi to run it with Apache (read more details in Flask documentation) or use Flask-Script runserver command to run your application in debug server (see example in Flask-Script documentation
First things first, looks like you're having already some app running/listening on port 5000.
You might want to find which with sudo sockstat |grep 5000 and then configure Apache consequently, or kill the process/service using localhost:5000.
Second, looks like your virtual host is not taken into account/not fully configured.

Invalid Content-Length and Client sent malformed Host header

I got this log from apache httpd log file
Can u help troubleshooting
Thanks
[Wed Apr 26 02:40:13 2017] [error] [client x.x.x.x] script not found or unable to stat: /var/www/cgi-bin/wa.exe
[Wed Apr 26 02:40:13 2017] [error] [client x.x.x.x] script not found or unable to stat: /var/www/cgi-bin/wa.exe
[Wed Apr 26 02:40:14 2017] [error] [client x.x.x.x] script not found or unable to stat: /var/www/cgi-bin/whois.cgi
[Wed Apr 26 02:40:14 2017] [error] [client x.x.x.x] script not found or unable to stat: /var/www/cgi-bin/whois.cgi
[Wed Apr 26 02:40:36 2017] [error] [client x.x.x.x] script '/var/www/cgi-bin/contact.php' not found or unable to stat
[Wed Apr 26 02:40:38 2017] [error] [client x.x.x.x] script not found or unable to stat: /var/www/cgi-bin/counter.exe
[Wed Apr 26 02:40:58 2017] [error] [client x.x.x.x] script not found or unable to stat: /var/www/cgi-bin/hosting
[Wed Apr 26 02:41:02 2017] [error] [client x.x.x.x] script '/var/www/cgi-bin/form.php' not found or unable to stat
[Wed Apr 26 02:41:05 2017] [error] [client x.x.x.x] script '/var/www/cgi-bin/comments.php' not found or unable to stat
[Wed Apr 26 02:41:08 2017] [error] [client x.x.x.x] script not found or unable to stat: /var/www/cgi-bin/projects_site
[Wed Apr 26 02:41:46 2017] [error] [client x.x.x.x] Invalid Content-Length
[Wed Apr 26 02:41:47 2017] [error] [client x.x.x.x] Invalid Content-Length
[Wed Apr 26 02:41:47 2017] [error] [client x.x.x.x] Invalid Content-Length
[Wed Apr 26 02:41:49 2017] [error] [client x.x.x.x] Invalid Content-Length
[Wed Apr 26 02:41:50 2017] [error] [client x.x.x.x] Invalid Content-Length
[Wed Apr 26 02:41:50 2017] [error] [client x.x.x.x] Invalid Content-Length
[Wed Apr 26 02:41:51 2017] [error] [client x.x.x.x] Invalid Content-Length
[Wed Apr 26 02:41:51 2017] [error] [client x.x.x.x] Invalid Content-Length
[Wed Apr 26 02:41:51 2017] [error] [client x.x.x.x] Invalid Content-Length
[Wed Apr 26 02:41:52 2017] [error] [client x.x.x.x] Invalid Content-Length
[Wed Apr 26 02:43:02 2017] [error] [client x.x.x.x] Invalid Content-Length
[Wed Apr 26 02:43:03 2017] [error] [client x.x.x.x] Invalid Content-Length
[Wed Apr 26 02:43:03 2017] [error] [client x.x.x.x] Invalid Content-Length
[Wed Apr 26 02:43:04 2017] [error] [client x.x.x.x] Invalid Content-Length
[Wed Apr 26 02:43:04 2017] [error] [client x.x.x.x] Invalid Content-Length
[Wed Apr 26 02:43:04 2017] [error] [client x.x.x.x] Invalid Content-Length
[Wed Apr 26 02:43:05 2017] [error] [client x.x.x.x] Invalid Content-Length
[Wed Apr 26 02:43:05 2017] [error] [client x.x.x.x] Invalid Content-Length
[Wed Apr 26 02:43:06 2017] [error] [client x.x.x.x] Invalid Content-Length
[Wed Apr 26 02:43:20 2017] [error] [client x.x.x.x] Client sent malformed Host header
[Wed Apr 26 02:43:20 2017] [error] [client x.x.x.x] Client sent malformed Host header
[Wed Apr 26 02:43:31 2017] [error] [client x.x.x.x] Client sent malformed Host header
[Wed Apr 26 02:43:31 2017] [error] [client x.x.x.x] Client sent malformed Host header
[Wed Apr 26 02:43:31 2017] [error] [client x.x.x.x] Client sent malformed Host header
what special configuration should I have for httpd
the x.x.x.x refers to our IP address so it is not an attack from outside.
No worries . Our security team was running scans that created this error.. I forget to check that : File does not exist: /var/www/error/nessus

drupal site on working on apache

my apache2 error.log shows:
[Sun Nov 10 18:40:46 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.8 with
Suhosin-Patch configured -- resuming normal operations
[Sun Nov 10 18:41:13 2013] [error] [client 127.0.0.1] File does not exist:
/home/vishal/Dropbox/sites/pw/js, referer: http://pw/
[Sun Nov 10 18:41:22 2013] [error] [client 127.0.0.1] File does not exist:
/home/vishal/Dropbox/sites/pw/node, referer: http://pw/
[Sun Nov 10 18:43:27 2013] [notice] caught SIGTERM, shutting down
[Sun Nov 10 18:43:28 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.8 with
Suhosin-Patch configured -- resuming normal operations
[Sun Nov 10 18:46:47 2013] [error] [client 127.0.0.1] File does not exist:
/home/vishal/Dropbox/sites/pw/js, referer: http://pw/
[Sun Nov 10 18:46:50 2013] [error] [client 127.0.0.1] File does not exist:
/home/vishal/Dropbox/sites/pw/user, referer: http://pw/
Here is my details of the default http://pastebin.com/sWFDN5Yr
the confusing thing is that other sites work but only the vhost for pw
gives error. The main page comes up however the inner pages does not come up.
Thank you,
Vishal
its most likely a problem with ur clean url.
type http://yoursite?q=user/login and see if ur login page comes up, if so its a issue with ur vhost entry is not set to allow redirect and clean urls

deploy issue on ckan 2.0 over apache2

I have the following problem after try to deploy ckan 2.0 over apache2.
here is the log from apache:
tail -f /var/log/apache2/demo.ckan.net.error.log
[Tue Apr 02 10:34:34 2013] [error] [client 127.0.0.1] return context.create()
[Tue Apr 02 10:34:34 2013] [error] [client 127.0.0.1] File "/home/ubuntu-ckan-last/pyenv/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 710, in create
[Tue Apr 02 10:34:34 2013] [error] [client 127.0.0.1] return self.object_type.invoke(self)
[Tue Apr 02 10:34:34 2013] [error] [client 127.0.0.1] File "/home/ubuntu-ckan-last/pyenv/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
[Tue Apr 02 10:34:34 2013] [error] [client 127.0.0.1] return fix_call(context.object, context.global_conf, **context.local_conf)
[Tue Apr 02 10:34:34 2013] [error] [client 127.0.0.1] File "/home/ubuntu-ckan-last/pyenv/lib/python2.6/site-packages/paste/deploy/util.py", line 56, in fix_call
[Tue Apr 02 10:34:34 2013] [error] [client 127.0.0.1] val = callable(*args, **kw)
[Tue Apr 02 10:34:34 2013] [error] [client 127.0.0.1] File "/home/ubuntu-ckan-last/pyenv/src/ckan/ckan/config/middleware.py", line 104, in make_app
[Tue Apr 02 10:34:34 2013] [error] [client 127.0.0.1] who_parser.parse(open(app_conf['who.config_file']))
[Tue Apr 02 10:34:34 2013] [error] [client 127.0.0.1] KeyError: 'who.config_file'
i followed the latest documentation on how to deploy a ckan 2.1a instance over apache or nginx...
thanks !
The error suggests it cannot find the who.config_file bit of your CKAN config file (e.g. std.ini):
[app:main]
...
who.config_file = %(here)s/who.ini
However this is the first point in the code which accesses this config file, so it suggests the something more fundamental is up with the config file.
Check your wsgi script file contains the correct path to your config file. The line looks like this:
config_file = '/usr/local/demo.ckan.net/pyenv/src/ckan/development.ini'

Symfony: problem saving a form object

I am using SF 1.4.8 with Propel ORM for a project. I have an action that allows a user to save their user profile. It looks something like this:
public function executeEditUser(sfwebRequest $request)
{
// some code commented out for brevity
$tainted_values = $user_profile->toArray(BasePeer::TYPE_FIELDNAME);
$this->form->bind(array_merge($tainted_values, $form_params), $file_params);
if ($this->form->isValid())
{
$this->form->save();
return $this->redirect('#user_account');
}
}
The User form class overrides the doSave() and Update() methods as follows:
protected function doSave($con = null)
{
$profile = $this->getObject();
// code commented out (saving files etc)
return parent::doSave($con);
}
public function updateObject($values = null)
{
$object = parent::updateObject($values);
$paththname = $object->getPictPath();
if (!empty($pathname))
{
$image_name = basename($pathname);
$object->setPictPath($image_name);
}
return $object;
}
When the user edits and saves the profile - the code runs as normal, but the object does not get updated in the database. I stepped through the code and in the save() method of the form, the object execution path indicates that no changes have been made to the object (even though the user entered values were correctly bound and the validate() method returned true.
Here is a stacktrace of warnings printed in the Apache error log file:
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 1. {main}() /home/voidstar/work/webdev/frameworks/symfony/sites/mywebsite/web/frontend_dev.php:0, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 2. sfContext->dispatch() /home/voidstar/work/webdev/frameworks/symfony/sites/mywebsite/web/frontend_dev.php:13, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 3. sfFrontWebController->dispatch() /lib/vendor/symfony/symfony-1.4.8/lib/util/sfContext.class.php:170, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 4. sfController->forward() /lib/vendor/symfony/symfony-1.4.8/lib/controller/sfFrontWebController.class.php:48, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 5. sfFilterChain->execute() /lib/vendor/symfony/symfony-1.4.8/lib/controller/sfController.class.php:238, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 6. sfRenderingFilter->execute() /lib/vendor/symfony/symfony-1.4.8/lib/filter/sfFilterChain.class.php:53, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 7. sfFilterChain->execute() /lib/vendor/symfony/symfony-1.4.8/lib/filter/sfRenderingFilter.class.php:33, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 8. sfGuardRememberMeFilter->execute() /lib/vendor/symfony/symfony-1.4.8/lib/filter/sfFilterChain.class.php:53, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 9. sfFilterChain->execute() /home/voidstar/work/webdev/frameworks/symfony/sites/mywebsite/plugins/sfGuardPlugin/lib/sfGuardRememberMeFilter.class.php:53, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 10. sfBasicSecurityFilter->execute() /lib/vendor/symfony/symfony-1.4.8/lib/filter/sfFilterChain.class.php:53, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 11. sfFilterChain->execute() /lib/vendor/symfony/symfony-1.4.8/lib/filter/sfBasicSecurityFilter.class.php:72, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 12. sfGoogleAnalyticsFilter->execute() /lib/vendor/symfony/symfony-1.4.8/lib/filter/sfFilterChain.class.php:53, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 13. sfFilterChain->execute() /home/voidstar/work/webdev/frameworks/symfony/sites/mywebsite/plugins/sfGoogleAnalyticsPlugin/lib/filter/sfGoogleAnalyticsFilter.class.php:45, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 14. sfExecutionFilter->execute() /lib/vendor/symfony/symfony-1.4.8/lib/filter/sfFilterChain.class.php:53, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 15. sfExecutionFilter->handleAction() /lib/vendor/symfony/symfony-1.4.8/lib/filter/sfExecutionFilter.class.php:42, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 16. sfExecutionFilter->executeAction() /lib/vendor/symfony/symfony-1.4.8/lib/filter/sfExecutionFilter.class.php:78, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 17. sfActions->execute() /lib/vendor/symfony/symfony-1.4.8/lib/filter/sfExecutionFilter.class.php:92, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 18. userActions->executeEditProfile() /lib/vendor/symfony/symfony-1.4.8/lib/action/sfActions.class.php:60, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 19. sfFormObject->save() /home/voidstar/work/webdev/frameworks/symfony/sites/mywebsite/apps/frontend/modules/user/actions/actions.class.php:68, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 20. UserProfileForm->doSave() /lib/vendor/symfony/symfony-1.4.8/lib/form/addon/sfFormObject.class.php:130, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 21. sfFormObject->doSave() /home/voidstar/work/webdev/frameworks/symfony/sites/mywebsite/lib/form/core/UserProfileForm.class.php:119, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 22. UserProfileForm->updateObject() /lib/vendor/symfony/symfony-1.4.8/lib/form/addon/sfFormObject.class.php:159, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 23. sfFormObject->updateObject() /home/voidstar/work/webdev/frameworks/symfony/sites/mywebsite/lib/form/core/UserProfileForm.class.php:136, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP 24. sfFormPropel->processValues() /lib/vendor/symfony/symfony-1.4.8/lib/form/addon/sfFormObject.class.php:181, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP Warning: array_key_exists() expects parameter 2 to be array, null given in /home/voidstar/work/webdev/frameworks/symfony/sites/mywebsite/lib/model/core/om/BaseUserProfile.php on line 2903, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
[Thu Jun 09 12:46:49 2011] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://mywebsite.localhost/frontend_dev.php/members/user/profile
Answer is the same as for this question: Symfony form values missing
i.e. overriden postValidate() method not returning $values was the culprit!