Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zend Framework 1 app inside Symfony2 - Session issues

I have added our legacy site into a legacy bindle in our new Symfony App.

I have an issue with sessions though.

If I use the default session handler for Symfony I get the following:

session has already been started by session.auto-start or session_start()

enter image description here

However if I use a session php_bridge as suggested for legacy app integration (most likely not for this but for $_SESSION) Then the site loads but the sessions won't persist or if they do they can't be destroyed.

enter image description here

My related question here

Any one have any suggestions?

Kind Regards Nathan

like image 825
Kal Avatar asked Jun 19 '26 18:06

Kal


1 Answers

few months ago, I wraped our legacy Zend application in a Symfony project too, using Zf1WrapperBundle. I faced the same "session already started" problem than u do. To quickly fix that, I edited Zend/library/Zend/Session.php. It's kinda dirty, but it works great. If you want to go this way, you have to do this (depending on your Zend 1 version, lines number may differ) :

line 462: Comment it // throw new Zend_Session_Exception('session has already been started by session.auto-start or session_start()');

line 480: Disable errors trigger $startedCleanly = @session_start();

line 490: Comment it // session_write_close();

line 493: Comment it // throw new Zend_Session_Exception(__CLASS__ . '::' . ____FUNCTION____ . '() - ' . Zend_Session_Exception::$sessionStartError);

line 728: Disable errors trigger @session_destroy();

That being said, in that case, editing Zend core file is not as bad as it sounds, because if you wrapped your legacy project inside Symfony, you're probably thinking of fully migrating your legacy zend project to symfony. In few months, you'll get rid of legacy zend code.

like image 89
VaN Avatar answered Jun 21 '26 06:06

VaN



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!