Jump to content

Compat-Test.php Inaccurate


Guest Brandon!

Recommended Posts

Guest Brandon!

I just realized that even though the compat-test page has a small error on it. When it tries to detect the version of gd, it anticipates a valid decimal for the version. My current version is 2.0.34, which is obviously not a valid decimal. I think that the preg_replace() that is used before the sprintf(%d) would be sufficient for script security.:

function detectGD() {

	if (extension_loaded('gd') && function_exists('gd_info')) {

		$gd = gd_info();

		$version = preg_replace('#[a-z\s]#i', '', $gd['GD Version']);

		return sprintf('%d', $version);

	}

	return false;

}




Becomes:


function detectGD() {

	if (extension_loaded('gd') && function_exists('gd_info')) {

		$gd = gd_info();

		return preg_replace('#[a-z\s]#i', '', $gd['GD Version']);

	}

	return false;

}

Just my $.02

Link to comment
Share on other sites

Yeah, the problem arises because the newer installations of PHP5 report the GD version differently than old versions. So we've had to revise the reporting. I'm all about killing a lot of the sprintf() calls in the code. :blink:

:wacko:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...