8.3.1 Symphony error

Permalink 1 user found helpful
Hi,

I've an issue when duplicating a form in the Formidable Addon. The addon give the following error: Call to a member function isActive() on null
File: /concrete/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php
After some searching I found this on Git:https://github.com/symfony/symfony/issues/24934...

Any ideas?

Best,

Corretje

DeWebmakers
View Replies:
olacom replied on at Permalink Reply
olacom
Hi !

I had the same issue, you can find a fix here :https://github.com/symfony/symfony/pull/24952/files...

You can replace /vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php with the file you'll find in the link I provided.

Hope it helps!

JF
SmoothPixel replied on at Permalink Reply
SmoothPixel
Thanks for posting your solution.

I had the same error, though not for the Formidable Addon. I have some code in my page templates (which checks whether a user is logged in) that triggers this error.

Have you flagged this up with the C5 dev team on Github? I think it’s important that they update to the latest version of Symfony for the next release.
gordonc200 replied on at Permalink Reply
I'm getting this error also. It's being caused by a custom block I created.

When a page is loaded the block sets a cookie value using $session->set. The cookie value is based upon a custom page attribute.

It worked fine before I updated to 8.3.2

Unfortunately the symphony fix didn't work for me however.
DeWebmakers replied on at Permalink Reply
DeWebmakers
Hmmm.... Could you see if it does work with a predefined variable, not an attribute.
See if the combination causes the issue.
gordonc200 replied on at Permalink Reply
I've never messed with the Core before as I know it isn't generally good practice. I think I may therefore have made an error with the symphony file update.

I had updated the file in the root concrete folder but the way I do updated the 8.3.2 update is in the updates folder. I'm therefore thinking it should be the file in 8.3.2 concrete folder I should be updating for it to have an effect?

Probably a rookie error. I'll give it a go as soon as I can and report back.

Which symphony branch should I be using? The Master or a specific branch.

Thanks for helping.
SmoothPixel replied on at Permalink Reply
SmoothPixel
Yes, you will need to update the files in the ‘updates’ folder (not the site's root). I didn’t update the whole Symfony directory – just the single file. It’s messy and definitely not best practice, but it worked for me. Looking at the code revisions, I don’t think they'll cause problems elsewhere.

This is the version I used:
https://github.com/nicolas-grekas/symfony/blob/38186aab2fbfffad55c05...
gordonc200 replied on at Permalink Reply
OK, I've done that and its had an effect but I now have Class 'PHPUnit\Framework\TestCase' not found.

I could start adding files but wondering if I shouldn't try changing a line or two first?
gordonc200 replied on at Permalink Reply
C5's documentation suggests that symfony is version 2.5

https://documentation.concrete5.org/developers/appendix/php-vendor-l...

I assume the C5 documentation is out of date as symfony version 2.5 stopped getting security updates in July 2015

https://symfony.com/roadmap?version=2.5#checker...
gordonc200 replied on at Permalink Reply
Scratch that

https://www.concrete5.org/about/blog/core-releases/version-80-and-57...

states

"Symfony components updated to version 3"
SmoothPixel replied on at Permalink Reply
SmoothPixel
Yes, as far as the Updater release notes say, Symfony was last updated at version 8.0.
gordonc200 replied on at Permalink Reply
Do you know if the Core Team customise the Vendor Library? Or can you swop out the whole Symfony component folders?

Way over my head here!
SmoothPixel replied on at Permalink Reply
SmoothPixel
I don’t know if they customise the Vendor Library but I suspect they might, which is why I just replaced the single file.
gordonc200 replied on at Permalink Reply
Thanks. My Block uses cookies to pass variables to a script in a tools folder via Ajax. The view sets the session variable and the tools file reads the session variable. I'm going to have to try and work out the "new way" of doing Ajax in C5. I gave up the last time!
gordonc200 replied on at Permalink Reply
Having done a bit of research as to how Composer actually works I'm tempted to run a composer update command on the 8.3.2 folder and see what happens! This would probably update loads of other things too but as I can't find any vendor folder in the concrete5 github I'm thinking modification/customisation of the required libraries simply isn't done. I wonder if anyone could enlighten on this?

The symfony version required in composer.json file is 3.* which I think means the latest version 3 available.

Composer file is here

https://github.com/concrete5/concrete5/blob/release/8.3.2/concrete/c...
gordonc200 replied on at Permalink Reply
OK, I got this working but it only works using PHP 7.1 (7.0 might work but I haven't tested that). It doesn't work in PHP 5.6 for me.

I didn't use the file you had found though as it uses the library PHPUnit which isn't part of C5 as far as I can tell.

Copying files from the symfony 3.4 branch I replaced the following file in the updates/concrete5-8.3.2/concrete/vendor/symfony/http-foundation/Session/Storage folder

https://github.com/symfony/symfony/blob/3.4/src/Symfony/Component/Ht...

in the folder updates/concrete5-8.3.2/concrete/vendor/symfony/http-foundation/Session/Storage/Handler I created the file

https://github.com/symfony/symfony/blob/3.4/src/Symfony/Component/Ht...

and in the same folder I also created the file

https://github.com/symfony/symfony/blob/3.4/src/Symfony/Component/Ht...

Ensuring the files were all owned by www-data this seemed to do the trick.

I hope this is caught in a C5 update as I really have no place messing about in the C5 core and cannot recommend anyone else do this.
SmoothPixel replied on at Permalink Reply
SmoothPixel
Thanks for the update.

Like you, I'm not comfortable hacking the core files. I have done what I can to get this sorted - just hope someone takes notice.
gordonc200 replied on at Permalink Reply
Comment scratched. Thought this was sorted in 8.4.0rc1 but it isn't.
SmoothPixel replied on at Permalink Reply
SmoothPixel
I have just filed a bug report for this issue:

https://www.concrete5.org/developers/bugs/8-3-2/symfony-needs-updati...

If everyone on this thread could add a confirmation, hopefully it will help get it fixed in the next update.

Thanks.
gordonc200 replied on at Permalink Reply
Done.
SmoothPixel replied on at Permalink Reply
SmoothPixel
Thanks.

Good luck with rewriting your block.
JohntheFish replied on at Permalink Reply
JohntheFish
To get resolve that needs to be filed as a github issue.
SmoothPixel replied on at Permalink Reply
SmoothPixel
Thanks for pointing that out - I have now added this to GitHub:
https://github.com/concrete5/concrete5/issues/6381...

Everything I have read on the submission guidelines says that it should be a Bug Report, not a GitHub issue, so I hope you're right :-)
SmoothPixel replied on at Permalink Reply
SmoothPixel
Quick update:

Andrew Embler has closed my GitHub issue - Symfony will be updated in the next release (8.3.3).

https://github.com/concrete5/concrete5/issues/6381...