Bug - Cannot Reproduce visit_url() not returning appropriate page

I'm not sure if it's the inner workings of the ASH interpreter failing to grab the string supplied to visit_url() or maybe Mafia's interface to the internet is acting wacky, but for some reason, when my charpane.php override attempts to access the kolmafia forums to check its version, the script is instead given the data for charpane.php.

The script continues to work on just fine, but I get two "is not an integer" errors (where the thing that isn't an integer appears to be a broken image) every page load (I could disable this, which would be a fine solution, but clearly something not-okay is happening in mafia.)

In an attempt to narrow the cause, I started a debug log, refreshed the character panel only, and then stopped the debug log, and now I'm here because you guys are awesome enough to figure it out.
 
Last edited:

Veracity

Developer
Staff member
Are you going to show us the debug log?

Edit: for that matter, how about the visit_url call in your script?

Thanks.
 
Last edited:
The debug log is attached, but when I was going in to make the script stop bugging me, I realized that that debug log might be (probably is) completely useless.

Turns out the reason I was repeatedly getting the error was because the String That Isn't An Integer was getting stored to a property, and then later calls to the script would use the stored version instead of attempting to retrieve it again.

So, I can't reliably get this error, but I have noticed it more than once (seems to only happen while the mafia login stuff is still going on, just after the login box closes and the main mafia frame opens)

For what it's worth, this is the relevant code:
Code:
	findver = get_property("_version_"+prop);
	if (findver == "") {
		vprint("Checking for updates...",1);
		page = visit_url("http://kolmafia.us/showthread.php?t="+thread);
		matcher pattern = create_matcher("<b>"+soft+" (.+?)</b>",page);
		if (pattern.find()) {
			findver = pattern.group(1);
			vprint("Latest version: " + findver,1);
			if (sameornewer(thisver,findver)) {
				vprint("You have a current version of "+soft+".","green",1); 
			} else {
				string msg = "<font color=red><b>New Version of "+soft+" Available: "+findver+"</b></font>";
				msg = msg + "<br><a href='http://kolmafia.us/showthread.php?t="+thread+"' target='_blank'><u>Upgrade from "+thisver+" to "+findver+" here!</u></a><br>";
				msg = msg + "<small>Think you are getting this message in error?  Force a re-check by typing \"set _version_"+prop+" =\" in the CLI.</small><br>";
				vprint_html(msg,1);
			}
		} else {
			findver = thisver;
			vprint("Unable to load current version info.","red",-1); 
		}
		set_property("_version_"+prop, findver);
	}
	
	//Build update brick if required
	if (!sameornewer(thisver,findver)) {
Only places in CHIT that sameornewer() gets called, which is where the error originates.


So, I can't recreate this bug (and until recently I had never seen it happen before) so I'm just gonna say it was a fluke. If it happens again I'll try to catch it.
(for now I'll delete the debug log I have posted since it's nearly 2MB)
 
Top