kolber / stacey

Cheap & easy content management
http://staceyapp.com
MIT License
1.04k stars 132 forks source link

php version issue #160

Open kannik2018 opened 5 years ago

kannik2018 commented 5 years ago

Hello,

Years ago I've made my website with stacey 2.3, recently my provider stopped supporting php 5.6 and upgraded to 7.2. My website doesn't work correctly anymore.

The problem seems to be rule 113 in page-data.inc.php : $page->page_name = ucfirst(pregreplace('/[-](.)/e', "' '.strtoupper('\1')", $page->data['@slug']));

Can I change this rule to make it compatible to 7.2 php?

Thank you, K

o-l-e commented 5 years ago

Hey @kannik2018 did you ever find a solution for this? I am having the same problem with a site for a friend. The host upgraded their php, and now the site breaks.

kannik2018 commented 5 years ago

No. Tried to correct the php, but didn't succeed. Fixed the site by making an unique template for each page with all the text information in it. Put an empty .txt files in the project folder with the name of the unique template. Loading the image files from the folders luckily still works. First tried to upgrade the stacey version but that turned out as a nightmare in my case. Ugly solution but my company website wasn't offline to long. When I find some time I'm gonna remake the website with a different cms.

Hope you do find a solution, K

o-l-e commented 5 years ago

Thanks for your reply @kannik2018, i will keep you updated if i find any solution to this.

o-l-e commented 5 years ago

Hi @kannik2018 i got my version working with php 7+ with help from a friend, but i see now that you are using the Stacey 2 version. I am using Stacey 3, which means that you won't be able to use this fix.

o-l-e commented 5 years ago

I created a separate issue with the fix here

shamlian commented 5 years ago

I have the same problem with Stacey 2 and PHP 7. I am no PHP expert but am going to try to poke around to see if I can figure out a fix. BTW is there a github page for Stacey 2.x? Staceyapp.com seems to be gone; the wayback machine last archived it in April 2018.

shamlian commented 5 years ago

@kannik2018 I was hoping the fix would be as simple as replacing line 113 of page-data.inc.php $page->page_name = ucfirst(preg_replace('/[-_](.)/e', "' '.strtoupper('\\1')", $page->data['@slug']));

with

$page->page_name = ucfirst(preg_replace_callback('/[-_](.)/', function ($matches) { return "' '.strtoupper('\\1')"; }, $page->data['@slug']));

But no such luck. This gets rid of the error but for whatever reason, the variables still don't get replaced properly.

kannik2018 commented 5 years ago

Thanks @shamlian for looking into it. I should have shared this before, but I also tried replacing that line, without luck. That's why I used a workaround. Hope somebody knows which other lines need to be corrected.

shamlian commented 5 years ago

Unless someone comments otherwise, I'm assuming Stacey 2.3 is even more of a dead end than 3.0 and at this point, it may be worth spending the time to update to 3.0 in the short term. Hoping I don't have to switch CMSes long term; @kannik2018 where did you end up?

desbest commented 4 years ago

I also had problems using Stacey 2.3 with php 7. I think I have fixed the problem with this issue. #163