=== PHP Validator === Contributors: manojtd Donate link: http://buy.thulasidas.com/php-validator Tags: developer tool, php, compile, debug, test plugin Requires at least: 2.5 Tested up to: 3.8 Stable tag: 1.21 PHP Validator is a pseudo-compiler for PHP to help developers locate undefined functions and methods. == Description == *PHP Validator* is a developer tool. It scans the file you specify and determines whether you have undefined functions or methods. Why not just run the PHP code, you say? Well, PHP is not a compiled language. It looks for functions during runtime. So if you have a segment of code not covered by your normal testing, and you have an undefined function in there, you will never know of the undefined function until it hits production when the particular conditions activating that particular code segment are met. In my case, in one of the projects I was working on (Easy PayPal, soon to become a WordPress plugin), I had a few include files defining functions in the global scope. I wanted to refactor them into three different classes and edit my ten or so source files the add `$class->` wherever necessary. Careful and systematic though I am, I kept missing a few function calls. Finally I got everything working. But I always had this fear that there were code paths that I may have missed, and there will be nasty surprises down the line, since the package is fairly complex and my test coverage is far from 100%. I thought it was silly to rely on tests to detect what in all other languages would be obvious compilation errors. So I started looking for compilers. I found some, but could never get any one of them work. So I decided to write a tool myself, which I named *PHP Validator*. I am happy to say that I managed to find a few undefined functions and methods (that I would have otherwise missed) using this tool. = Pro Version = *PHP Validator* is released as a Lite version here. It is fully functional and will locate all the undefineds as the [Pro version](http://buy.thulasidas.com/php-validator "Pseudo-compiler plugin for PHP to find undefined functions and methods, $0.99"). In the Pro version, it will also list the line numbers at which the undefined function occurs, which may make it a bit easier to locate. Also available is a [Stand-alone](http://buy.thulasidas.com/phpValidator "Pseudo-compiler package for PHP to find undefined functions and methods, $1.49") version that runs as an independent browser-based tool. == Upgrade Notice == Minor refactoring changes. == Screenshots == 1. PHP Validator in action == Installation == 1. Upload the PHP Validator plugin (the whole hitman) to the '/wp-content/plugins/' directory. 2. Activate the plugin through the 'Plugins' menu in WordPress. 3. Go to the Tools -> PHP Validator to load and validate your files. == Frequently Asked Questions == = What does this program do? = *PHP Validator* is a developer tool. It scans the file you specify and determines whether you have undefined functions or methods. = What do I enter in "List your php source files here"? = You enter the full path names of the files you would like to validate. Note that *PHP Validator* runs on a server, and the files need to be accessible by your web server. Please specify the files relative to the installation directory, or by typing in their full path names. = What do I enter in "Enter extra include file(s) if any"? = *PHP Validator* will look for definitions of methods and functions in the files specified by traversing the include directives in them. But if you have some of the defined elsewhere, you can list them here (again, relative to the installation directory) so that they are scanned as well, for function/class defintions. = What about "List additional include paths"? = This is to tell *PHP Validator* that you have files included from these locations. This way, you don't have to give the fully qualified name for the include files in the "Extra include files" list above. = What is the purpose of the "Include the files in autogenerated code" option? = This plugin works by scanning the PHP source file you specify for functions and methods and trying to locate them in the include files (in the source file as well as the ones you specify as "Extra include file(s)". In some (or most) cases, you have some functions/methods defined in the file you validating, in which case you have to include that one also, which is what this option specifies. = What is "Show methods, functions, includes etc. that are detected and validated." = By default, *PHP Validator* looks for methods and functions, and lists them in red if not found. But if you would like it to list all tokens like functions and includes, please check this option. = What is "Show the autogenerated code used for validation." = *PHP Validator* works by generating fake code and executing it and capturing error messages. This option lists the generated code, and is meant for debugging purposes. You may not want to check it unless you want to see the innards of *PHP Validator*. = Should I check "Show tokens"? = No. This is another debug option to list all the tokens found, and will generate large output. == Change Log == * V1.21: Minor refactoring changes. [Mar 24, 2014] * V1.20: Compatibility checks for WordPress V3.8. Adding more help on admin page. [Dec 20, 2013] * V1.10: Compatibility checks for WordPress V3.7. [Nov 11, 2013] * V1.03: Bug fixes (Fatal error: Call-time pass-by-reference has been removed). [Jan 28, 2013] * V1.02: Renaming the plugin to drop the word Lite. [May 12, 2012] * V1.01: Minor code changes. [April 20, 2012] * V1.00: Initial release. [April 3, 2012]