k0a1a / hotglue2

HOTGLUE is a Content Manipulation System which allows to construct websites directly in a web-browser.
http://hotglue.me/demo
GNU General Public License v3.0
275 stars 38 forks source link

fails from php 8.0 #27

Open tschiemer opened 1 year ago

tschiemer commented 1 year ago

https://github.com/k0a1a/hotglue2/blob/ff69c8d66f164bf8be93d08342058c0afaecdd84/html.inc.php#L299

php error in short that _haystack of function inarray is null quick fix that works for me

if (is_array($elem) && is_array($elem['class']) && @in_array($c, $elem['class'])) {

tschiemer commented 1 year ago

sorry, not fully tested.

page is shown after above quick fix, but not yet all incompatibilities fixed. error message upon trying to delete an object

<br />
<b>Fatal error</b>:  Uncaught Error: Call to undefined function get_magic_quotes_gpc() in /home/filouse/www/koko.filou.se/json.php:52
Stack trace:
#0 {main}
  thrown in <b>/home/filouse/www/koko.filou.se/json.php</b> on line <b>52</b><br />

no time right now to follow up further, meeting coming up...

rafic20 commented 9 months ago

I was having a similar problem on my webserver. I get a 500 error when trying to edit a page. The server log says:

PHP Fatal error: Uncaught Error: Call to undefined function get_magic_quotes_gpc() in /app/data/public/hotglue2-dev/json.php:47\nStack trace:\n#0 {main}\n thrown in /app/data/public/hotglue2-dev/json.php on line 47

Looking up the error on Stack Overflow, it says the get_magic_quotes function was deprecated:

To be able to load the editor, I commented out the code block containing the get_magic_quotes_gpc function in json.php, and reloaded the root page.

After I created an edited a page, I quit the application. Then, when trying to reload the page, I got a blank screen.

Then, I edited the html.inc.php file at line 299 with the suggested code block by tschiemer, and was able to access it again.

Posting this in case other people have similar issues. It took a while to figure all this out from Stack Overflow and the Issues section of this Github.

Tech Stack:

I am running Cloudron's LAMP app on a Digital Ocean VPS. PHP version is 7.4. Not sure about Apache version.

alwayslearningalwaysexploring commented 5 months ago

Hello, I've tried setting up hotglue on my server and I'm finding the same problems mentioned by @tschiemer and @rafic20

I edited the html.inc.php page with the suggested edits and I changed line 47 in the json.php file to 'if( function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc())'

When I try to edit a new hotglue page, I get: "The glue gun manufacturer says: There was a problem communicating with the server (ready state 4, status 500)"

Any ideas how to move forward?

rafic20 commented 5 months ago

Hi @alwayslearningalwaysexploring , does your json.php look like this for the lines in question?

Note that I am commenting out the 3 lines beneath the foreach line with a double backslash \\. This means that the code in those lines will be ignored when the webserver parses the script. The script runs successfully once those lines are commented out.

In your example, you appear to still have those lines active in your script.

foreach ($_POST as $key=>$val) {
    // if (get_magic_quotes_gpc()) {
    //  $val = stripslashes($val);
    // }
    $dec = @json_decode($val, true);
    if ($dec === NULL) {
        $err = response('Error decoding the argument '.quot($key).' => '.var_dump_inl($val), 400);
        echo json_encode($err);
        log_msg('warn', 'json: '.$err['#data']);
        die();
    } else {
        $args[$key] = $dec;
    }
}
break;
alwayslearningalwaysexploring commented 5 months ago

thanks for the advice @rafic20! i have these lines commented out and I've also made the change suggested by @tschiemer are you using the .zip file or did you git clone the dev branch that has some minor changes?

rafic20 commented 5 months ago

@alwayslearningalwaysexploring I'm using the ZIP download. I extracted the files and put it on my webserver but it didn't work. After making the changes mentioned in this thread, it is working for me.

alwayslearningalwaysexploring commented 5 months ago

did you also make changes in the html.inc.php file like @tschiemer mentioned in https://github.com/k0a1a/hotglue2/issues/27#issue-1715840592 ?

alwayslearningalwaysexploring commented 5 months ago

ok! the problem i was encountering had to do with the config file, a complete different issue that i will post in another thread. thanks @rafic20 !

alwayslearningalwaysexploring commented 5 months ago

@rafic20 i posted the actual issue i stumbled upon: #30