ZfcBase Module on ZF2 is not getting initiated - apache

I followed the installation instructions for ZfcUser.
composer.json looks like this:
{
"name": "zendframework/skeleton-application",
"description": "Skeleton Application for ZF2",
"license": "BSD-3-Clause",
"keywords": [
"framework",
"zf2"
],
"homepage": "http://framework.zend.com/",
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": ">2.2.0rc1",
"zendframework/zend-developer-tools": "dev-master",
"zendframework/zftool": "dev-master",
"zf-commons/zfc-user": "dev-master"
}
}
Then I ran following commands:
> php composer.phar self-update
> php compsoer.phar update
It installed both ./zfc-base and ./zfc-user into ./vendor/zf-commons folder with paths.
In config/application.config.php I added both modules 'ZfcBase' and 'ZfcUser' to 'modules' array.
After all of that I am geting error 500. Apache error-log stays the following:
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP Warning: include(/var/www/html/zf2-test/vendor/zf-commons/zfc-base/Module.php): failed to open stream: Permission denied in /var/www/html/zf2-test/vendor/composer/ClassLoader.php on line 185
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP Stack trace:
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 1. {main}() /var/www/html/zf2-test/public/index.php:0
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 2. Zend\\Mvc\\Application::init() /var/www/html/zf2-test/public/index.php:13
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 3. Zend\\ModuleManager\\ModuleManager->loadModules() /var/www/html/zf2-test/vendor/ZF2/library/Zend/Mvc/Application.php:253
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 4. Zend\\EventManager\\EventManager->trigger() /var/www/html/zf2-test/vendor/ZF2/library/Zend/ModuleManager/ModuleManager.php:109
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 5. Zend\\EventManager\\EventManager->triggerListeners() /var/www/html/zf2-test/vendor/ZF2/library/Zend/EventManager/EventManager.php:207
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 6. call_user_func() /var/www/html/zf2-test/vendor/ZF2/library/Zend/EventManager/EventManager.php:468
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 7. Zend\\ModuleManager\\ModuleManager->onLoadModules() /var/www/html/zf2-test/vendor/ZF2/library/Zend/EventManager/EventManager.php:468
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 8. Zend\\ModuleManager\\ModuleManager->loadModule() /var/www/html/zf2-test/vendor/ZF2/library/Zend/ModuleManager/ModuleManager.php:90
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 9. Zend\\ModuleManager\\ModuleManager->loadModuleByName() /var/www/html/zf2-test/vendor/ZF2/library/Zend/ModuleManager/ModuleManager.php:149
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 10. Zend\\EventManager\\EventManager->trigger() /var/www/html/zf2-test/vendor/ZF2/library/Zend/ModuleManager/ModuleManager.php:171
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 11. Zend\\EventManager\\EventManager->triggerListeners() /var/www/html/zf2-test/vendor/ZF2/library/Zend/EventManager/EventManager.php:207
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 12. call_user_func() /var/www/html/zf2-test/vendor/ZF2/library/Zend/EventManager/EventManager.php:468
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 13. Zend\\ModuleManager\\Listener\\ModuleResolverListener->__invoke() /var/www/html/zf2-test/vendor/ZF2/library/Zend/EventManager/EventManager.php:468
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 14. class_exists() /var/www/html/zf2-test/vendor/ZF2/library/Zend/ModuleManager/Listener/ModuleResolverListener.php:28
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 15. spl_autoload_call() /var/www/html/zf2-test/vendor/ZF2/library/Zend/ModuleManager/Listener/ModuleResolverListener.php:28
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 16. Composer\\Autoload\\ClassLoader->loadClass() /var/www/html/zf2-test/vendor/ZF2/library/Zend/ModuleManager/Listener/ModuleResolverListener.php:0
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP Warning: include(): Failed opening '/var/www/html/zf2-test/vendor/zf-commons/zfc-base/Module.php' for inclusion (include_path='.:/usr/bin/pear:/usr/bin/php') in /var/www/html/zf2-test/vendor/composer/ClassLoader.php on line 185
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP Stack trace:
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 1. {main}() /var/www/html/zf2-test/public/index.php:0
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 2. Zend\\Mvc\\Application::init() /var/www/html/zf2-test/public/index.php:13
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 3. Zend\\ModuleManager\\ModuleManager->loadModules() /var/www/html/zf2-test/vendor/ZF2/library/Zend/Mvc/Application.php:253
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 4. Zend\\EventManager\\EventManager->trigger() /var/www/html/zf2-test/vendor/ZF2/library/Zend/ModuleManager/ModuleManager.php:109
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 5. Zend\\EventManager\\EventManager->triggerListeners() /var/www/html/zf2-test/vendor/ZF2/library/Zend/EventManager/EventManager.php:207
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 6. call_user_func() /var/www/html/zf2-test/vendor/ZF2/library/Zend/EventManager/EventManager.php:468
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 7. Zend\\ModuleManager\\ModuleManager->onLoadModules() /var/www/html/zf2-test/vendor/ZF2/library/Zend/EventManager/EventManager.php:468
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 8. Zend\\ModuleManager\\ModuleManager->loadModule() /var/www/html/zf2-test/vendor/ZF2/library/Zend/ModuleManager/ModuleManager.php:90
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 9. Zend\\ModuleManager\\ModuleManager->loadModuleByName() /var/www/html/zf2-test/vendor/ZF2/library/Zend/ModuleManager/ModuleManager.php:149
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 10. Zend\\EventManager\\EventManager->trigger() /var/www/html/zf2-test/vendor/ZF2/library/Zend/ModuleManager/ModuleManager.php:171
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 11. Zend\\EventManager\\EventManager->triggerListeners() /var/www/html/zf2-test/vendor/ZF2/library/Zend/EventManager/EventManager.php:207
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 12. call_user_func() /var/www/html/zf2-test/vendor/ZF2/library/Zend/EventManager/EventManager.php:468
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 13. Zend\\ModuleManager\\Listener\\ModuleResolverListener->__invoke() /var/www/html/zf2-test/vendor/ZF2/library/Zend/EventManager/EventManager.php:468
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 14. class_exists() /var/www/html/zf2-test/vendor/ZF2/library/Zend/ModuleManager/Listener/ModuleResolverListener.php:28
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 15. spl_autoload_call() /var/www/html/zf2-test/vendor/ZF2/library/Zend/ModuleManager/Listener/ModuleResolverListener.php:28
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP 16. Composer\\Autoload\\ClassLoader->loadClass() /var/www/html/zf2-test/vendor/ZF2/library/Zend/ModuleManager/Listener/ModuleResolverListener.php:0
[Mon Jun 03 23:52:40 2013] [error] [client ::1] PHP Fatal error: Uncaught exception 'Zend\\ModuleManager\\Exception\\RuntimeException' with message 'Module (ZfcBase) could not be initialized.' in /var/www/html/zf2-test/vendor/ZF2/library/Zend/ModuleManager/ModuleManager.php:175
Stack trace:
#0 /var/www/html/zf2-test/vendor/ZF2/library/Zend/ModuleManager/ModuleManager.php(149): Zend\\ModuleManager\\ModuleManager->loadModuleByName(Object(Zend\\ModuleManager\\ModuleEvent))
#1 /var/www/html/zf2-test/vendor/ZF2/library/Zend/ModuleManager/ModuleManager.php(90): Zend\\ModuleManager\\ModuleManager->loadModule('ZfcBase')
#2 [internal function]: Zend\\ModuleManager\\ModuleManager->onLoadModules(Object(Zend\\ModuleManager\\ModuleEvent))
#3 /var/www/html/zf2-test/vendor/ZF2/library/Zend/EventManager/EventManager.php(468): call_user_func(Array, Object(Zend\\ModuleManager\\ModuleEvent))
#4 /var/www/html/zf2-test/vendor/ZF2/library/Zend/EventManager/EventManager.php(207): Zend\\EventManager\\EventManager->triggerListeners('loadModules', Object(Zend\\ModuleManager\\ModuleEvent), NULL)
#5 /var/www/ in /var/www/html/zf2-test/vendor/ZF2/library/Zend/ModuleManager/ModuleManager.php on line 175
I have set the permissions to the ./vendor folder to 0755 -R, but still, things do not work the way they should... I keep getting the same error... Without ZfcUser and ZfcBase application works fine...

Did you add in your application.config.php
'module_paths' => array(
'./module',
'./vendor',
'./vendor/zf-commons',
)

Related

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

RuntimeError: populate() isn't reentrant on CentOS 7 | django 1.9 | python3

Im deploying a django application on a intranet environment. I've already set up a testing server and everything is fine (after breaking my head fixing errors).
This time, im seting up the production server and after configuring everything, i got an error 500, here is the httpd/logs/error_log:
traceback
[Thu Oct 27 09:44:15.480662 2016] [:error] [pid 15250] [remote 10.105.40.106:200] mod_wsgi (pid=15250): Target WSGI script '/home/rortega/smce/smce/wsgi.py' cannot be loaded as Python module.
[Thu Oct 27 09:44:15.480706 2016] [:error] [pid 15250] [remote 10.105.40.106:200] mod_wsgi (pid=15250): Exception occurred processing WSGI script '/home/rortega/smce/smce/wsgi.py'.
[Thu Oct 27 09:44:15.480736 2016] [:error] [pid 15250] [remote 10.105.40.106:200] Traceback (most recent call last):
[Thu Oct 27 09:44:15.480764 2016] [:error] [pid 15250] [remote 10.105.40.106:200] File "/home/rortega/smce/smce/wsgi.py", line 16, in <module>
[Thu Oct 27 09:44:15.480805 2016] [:error] [pid 15250] [remote 10.105.40.106:200] application = get_wsgi_application()
[Thu Oct 27 09:44:15.480823 2016] [:error] [pid 15250] [remote 10.105.40.106:200] File "/home/rortega/smce_env/lib/python3.5/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
[Thu Oct 27 09:44:15.480852 2016] [:error] [pid 15250] [remote 10.105.40.106:200] django.setup()
[Thu Oct 27 09:44:15.480868 2016] [:error] [pid 15250] [remote 10.105.40.106:200] File "/home/rortega/smce_env/lib/python3.5/site-packages/django/__init__.py", line 18, in setup
[Thu Oct 27 09:44:15.480892 2016] [:error] [pid 15250] [remote 10.105.40.106:200] apps.populate(settings.INSTALLED_APPS)
[Thu Oct 27 09:44:15.480908 2016] [:error] [pid 15250] [remote 10.105.40.106:200] File "/home/rortega/smce_env/lib/python3.5/site-packages/django/apps/registry.py", line 78, in populate
[Thu Oct 27 09:44:15.480932 2016] [:error] [pid 15250] [remote 10.105.40.106:200] raise RuntimeError("populate() isn't reentrant")
[Thu Oct 27 09:44:15.480958 2016] [:error] [pid 15250] [remote 10.105.40.106:200] RuntimeError: populate() isn't reentrant
[Thu Oct 27 09:44:15.561544 2016] [:error] [pid 15250] [remote 10.105.40.106:54216] mod_wsgi (pid=15250): Target WSGI script '/home/rortega/smce/smce/wsgi.py' cannot be loaded as Python module.
[Thu Oct 27 09:44:15.561571 2016] [:error] [pid 15250] [remote 10.105.40.106:54216] mod_wsgi (pid=15250): Exception occurred processing WSGI script '/home/rortega/smce/smce/wsgi.py'.
[Thu Oct 27 09:44:15.561597 2016] [:error] [pid 15250] [remote 10.105.40.106:54216] Traceback (most recent call last):
[Thu Oct 27 09:44:15.561623 2016] [:error] [pid 15250] [remote 10.105.40.106:54216] File "/home/rortega/smce/smce/wsgi.py", line 16, in <module>
[Thu Oct 27 09:44:15.561658 2016] [:error] [pid 15250] [remote 10.105.40.106:54216] application = get_wsgi_application()
[Thu Oct 27 09:44:15.561675 2016] [:error] [pid 15250] [remote 10.105.40.106:54216] File "/home/rortega/smce_env/lib/python3.5/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
[Thu Oct 27 09:44:15.561703 2016] [:error] [pid 15250] [remote 10.105.40.106:54216] django.setup()
[Thu Oct 27 09:44:15.561719 2016] [:error] [pid 15250] [remote 10.105.40.106:54216] File "/home/rortega/smce_env/lib/python3.5/site-packages/django/__init__.py", line 18, in setup
[Thu Oct 27 09:44:15.561743 2016] [:error] [pid 15250] [remote 10.105.40.106:54216] apps.populate(settings.INSTALLED_APPS)
[Thu Oct 27 09:44:15.561774 2016] [:error] [pid 15250] [remote 10.105.40.106:54216] File "/home/rortega/smce_env/lib/python3.5/site-packages/django/apps/registry.py", line 78, in populate
[Thu Oct 27 09:44:15.561800 2016] [:error] [pid 15250] [remote 10.105.40.106:54216] raise RuntimeError("populate() isn't reentrant")
[Thu Oct 27 09:44:15.561824 2016] [:error] [pid 15250] [remote 10.105.40.106:54216] RuntimeError: populate() isn't reentrant
Another things i noticed before cheking funtionality:
When executing makemigrations, only one model file of my 4 apps made the migrations, like if there is only one app
python manage.py runserver without errors
RuntimeError: populate() isn't reentrant
In my experience this usually means there is an error in the Django project somewhere. It can be hard to locate. Also, don't forget to restart apache.
When executing makemigrations, only one model file of my 4 apps made the migrations, like if there is only one app
Try pointing makemigrations to the specific app:
python manage.py makemigrations appname
Don't forget to apply migrations afterward:
python manage.py migrate
For everyone getting this problem, it can be anything, like a wrong django configuration or something with de mod_wsgi.
in my case it was that i needed to build python 3 with the --enable-shared tag.
if this is also your case, you can follow this.

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!