MyBB Community Forums

Full Version: Usage of phpinfo() in gd_version() of captcha.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
In gd_version() of captcha.php, you parse the phpinfo() result to retreive the GD version if GD is loaded.

GD provide the method gd_info() which return the version.

-> More easy to code
-> More easy to read
-> More efficient when phpinfo() is disabled by web hoster ;-)
Translation please?
It means we should use gd_info() to determine the version of GD installed instead of parsing the output of php_info().

In the comments section of the gd_info() page, a user provided a way to take advantage of gd_info on newer systems (PHP 4.3+) while falling back on php_info() for older versions of PHP. It also caches the gd version so it doesn't have to be recalculated every time.
MyBB still using phpinfo...

Since PHP 4.3.0 the func' is available, considering MyBB dropped support for PHP 4, why not gd_info()?

We also can read the constant GD_VERSION since PHP 5.2.4, so I would suggest to check it before the use of phpinfo().
we use gd_info for 1.6 and above. 1.4 still will stay compatible with PHP 4