Neriderc / GVExport

Repository for GVExport module for Webtrees
GNU General Public License v2.0
15 stars 6 forks source link

crash with new release #95

Closed schuco closed 2 years ago

schuco commented 2 years ago

After upload of the new release 2.1.5 the first execution worked fine, thereafter I get the appended error, whatever options are given. Firefox_Screenshot_2022-07-24T15-28-43 676Z

Neriderc commented 2 years ago

Could you see if clearing the cache in your browser helps?

schuco commented 2 years ago

Unfortunately it did not help. But it works on my Android-phone

Neriderc commented 2 years ago

What about if you click the "reset" button that resets options to default?

And what happens if you use a different starting individual?

I'm not able to reproduce the issue, which makes it hard to solve.

Neriderc commented 2 years ago

Can you check that your "Space" settings look ok? (the ones that used to be called nodesep and ranksep). These should be percentages (e.g. 100%). This should reset when you click the reset button, but this is what is handled on line 511 that your error message references. Entering an incorrect value in these should be impossible, but if you have saved values from before then that might be the problem.

Alternatively, a language difference might be the issue. Do you typically type a percentage differently than "100%" format?

schuco commented 2 years ago

@Neriderc _Can you check that your "Space" settings look ok? (the ones that used to be called nodesep and ranksep). These should be percentages (e.g. 100%). This should reset when you click the reset button, but this is what is handled on line 511 that your error message references. Entering an incorrect value in these should be impossible, but if you have saved values from before then that might be the problem.

These have been o.k.. I have reset them, cleared the cache, entered values manually - no effect

@Neriderc Alternatively, a language difference might be the issue. Do you typically type a percentage differently than "100%" format?_

See above about clearing cache. I switched to English. I used Chrome instead of Firefox (Clearing cache there too). - no effect Problem arised on desktop-PC and on laptop (both Windows 10) - no problem with Android phone and tablet

Neriderc commented 2 years ago

So we can confirm it's this change that's the problem, if you remove this version and install the previous one, does it work fine?

What version of PHP are you using?

schuco commented 2 years ago

It looks like the problem is on my side. Still with 2.1.5 I tried to clear the cache serverside (I don't know if I did this right deleting anything in data/cache/@/)

Neriderc commented 2 years ago

The same line of code is on line 509 in the previous version, so it looks like this is the issue.

That line of code deals with the space between generations.

Can you confirm that resetting to default does set this to 100%?

And what version of PHP are you using? You can see this in the control panel of webtrees, by clicking the "Server information" option (in the top section). Be careful with posting screenshots, this shows environment variables which may show sensitive information (like database passwords) depending on your setup. Just have a look for the version near the top.

schuco commented 2 years ago

Meanwhile I know about another modification in my webtrees and GVExport installation which might be an explanation for experts, but not for me. When I updated webtrees from 2.0 to 2.1.6 I tried it by the link for automatic update. This crashed with an error in GVExport (2.0) and I could not retry even after deleting the GVExport module. Thereafter I was successful with manual update following the very good webtrees manual in GenWiki. Before I had deleted all modules in modules_v4. However it was strange for me that after installation of wt2.1.6 in modules_v4 there was just one module: GVExport.disable. As the owner of this was root and I don't have permission, I asked my son to delete it. I did not wait that he finished that. Installed GVExort 2.1.4.3 and it worked properly until yesterday after I had updated to GVE 2.1.5. What I did not know until this morning was, that my son deleted the GVExport.disable file only today, maybe at the time of my update to 2.1.5. Is it possible that deleting this file can explain the crash? Why did that file appear?

schuco commented 2 years ago

@Neriderc I have PHP 7.4.30 I can't retry at the moment, but I am sure that resetting led to display of "100%" properly.

Which safer way could have shown the error list compared to a screenshot. I am completely inexperienced in that

Neriderc commented 2 years ago

I'm not familiar with that process as I use a different one, but I would guess that because the webtrees update ran into an issue, it probably disabled the extension so that the update could be run successfully.

I would not think removing this file would have any impact. The simple fact that this was automatically created (presumably by webtrees) implies that webtrees would ignore it. And in that case it shouldn't have any impact, in theory. The timing is suspicious though.

Just to confirm, the issue only comesbup the second time you run? If you reload the page and click Update, it works ok? Then you click Update, and it gives you the error? Then you reload the page and it works ok again (the first time)?

Neriderc commented 2 years ago

@Neriderc I have PHP 7.4.30 I can't retry at the moment, but I am sure that resetting led to display of "100%" properly.

Which safer way could have shown the error list compared to a screenshot. I am completely inexperienced in that

Thanks, I'm running PHP 8 so I will have to boot up my PHP 7 test instance a bit later to see if I see the issue.

A screen shot of the error is fine. What I was referring to is the "System information" page in webtrees. That page can sometimes show database passwords or other information that should be kept private, so I was just warning not to post a screenshot of that.

schuco commented 2 years ago

Regarding your hint on Screenshots- thank you.

Regarding the error: GVExport worked fine only the very first time after update. After the crash it never worked. Even reinstalling older versions brougt the error immediately with the first call.

Neriderc commented 2 years ago

Ah that's good to know, thanks. Could you try something for me? First go back to using GVExport 2.1.5.

Open the file "functions-dot.php" in a text editor (notepad would do), and find line 511 (in notepad you can use Edit->Go to option) which should look like this:

$out .= "ranksep=\"" . str_replace("%"," ",$this->settings["ranksep"])*$this->settings["space_base"]/100 . " equally\"\n";

Immediately before this line, add a new line:

echo "|".$this->settings["ranksep"]."|".$this->settings["space_base"]."|";

Save the file and update it on your server, then rerun the update in GVExport.

This should give you a different message, could you screenshot that and show me what it says?

Neriderc commented 2 years ago

Could you also test another change for me?

On the line mentioned above, as well as the next line, remove the space between the quotes. So that this:

$out .= "ranksep=\"" . str_replace("%"," ",$this->settings["ranksep"])*$this->settings["space_base"]/100 . " equally\"\n";
$out .= "nodesep=\"" . str_replace("%"," ",$this->settings["nodesep"])*$this->settings["space_base"]/100     . "\"\n";

Becomes this:

$out .= "ranksep=\"" . str_replace("%","",$this->settings["ranksep"])*$this->settings["space_base"]/100 . " equally\"\n";
$out .= "nodesep=\"" . str_replace("%","",$this->settings["nodesep"])*$this->settings["space_base"]/100  . "\"\n";

You could try this instead of the above change. Please let me know if this is getting a bit too unfamiliar, I can package a release with this change if you'd prefer then you can test and see if it fixes the issue.

schuco commented 2 years ago

It works!!!! It keeps going also after second start and complete restart. Removing spaces in both lines helped. Thank you very much for this big help. Sorry my answer is delayed due to the night in Germany in between.

Neriderc commented 2 years ago

That's great to hear! Though I didn't get to testing PHP 7, I'm 80% sure it's a difference in how the versions treat this empty space.

What's odd is that it has been this way since version 2.1.4. It's strange it only just became an issue for you now!

Sorry my answer is delayed due to the night in Germany in between.

It's not a problem. This format allows for responding in your own time, and since you were the only one (that we know of) with a broken installation, there was no hurry. However, now you've confirmed this fixes it, I'm going to package another release just to make sure anyone new is not going to run into this issue.

I'll close this issue now that the problem is resolved :) (you can still reply if you wish, closing it just keeps our board of issues tidy).

hartenthaler commented 2 years ago

A friend of mine reported exactly the same issue (in a private mail to me). I will ask him to test the next release of GVExport, too.

Neriderc commented 2 years ago

Thanks, it would be good to confirm it resolves the issue for him.

I have now reproduced the issue myself using PHP7.4.30.

I also confirmed that removing those extra spaces fixed it (they should never have been there to start with, that's my mistake). PHP8 must handle this differently, though it is odd that this change was made in the previous version and not in the latest version, yet people only started having issues now.