Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fails from php 8.0 #27

Open
tschiemer opened this issue May 18, 2023 · 9 comments
Open

fails from php 8.0 #27

tschiemer opened this issue May 18, 2023 · 9 comments
Assignees

Comments

@tschiemer
Copy link

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

php error in short that haystack of function in_array is null
quick fix that works for me

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

@tschiemer
Copy link
Author

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...

@tschiemer tschiemer mentioned this issue May 28, 2023
@rafic20
Copy link

rafic20 commented Nov 29, 2023

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

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
Copy link

rafic20 commented Mar 23, 2024

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

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
Copy link

rafic20 commented Mar 23, 2024

@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

did you also make changes in the html.inc.php file like @tschiemer mentioned in #27 (comment) ?

@alwayslearningalwaysexploring

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants