docblox/docblox — Issue #376: Installation on Windows 7 has Issues
Author: Chowarmaan
Created: 2012-02-14 18:51:59+00:00
State: open

If you install other packages before DocBlox on Windows 7, the pathing gets mixed up in the DocBlox.bat file. PHPUnit and PHP Project Wizard (PPW) were installed before DocBlox. The simple batch file used by DocBlox then has errors returned from the operating system, based on the current environment settings.

Current Batch File
@echo off
if "%PHPBIN%" == "" set PHPBIN=php.exe
if not exist "%PHPBIN%" fi "%PHP_PEAR_PHP_BIN%" neq "" goto USE_PEAR_PATH
GOTO RUN
:USE_PEAR_PATH
set PHPBIN="%PHP_PEAR_PHP_BIN%"
:RUN
"%PHPBIN%" "%PHP_PEAR_BIN_DIR%\docblox.php" %*

Error reported
Files was unexpected at this time.

SET Output snapshot
PHPBIN="C:\Program Files (x86)\PHP\php.exe"
PHPRC=C:\Program Files (x86)\PHP\
PHP_PEAR_BIN_DIR=C:\Program Files (x86)\PHP
PHP_PEAR_DATA_DIR=C:\Program Files (x86)\PHP\data
PHP_PEAR_DOC_DIR=C:\Program Files (x86)\PHP\docs
PHP_PEAR_INSTALL_DIR=C:\Program Files (x86)\PHP\pear
PHP_PEAR_PHP_BIN=C:\Program Files (x86)\PHP\php.exe
PHP_PEAR_SYSCONF_DIR=C:\Program Files (x86)\PHP
PHP_PEAR_TEST_DIR=C:\Program Files (x86)\PHP\tests

Easy correction, but real problem is the quoting of quoted texts in the batch file.
One of the other tools has the double quotes around the PHPBIN values. When the DocBlox script is executed, the double quotes in the script counter the double quotes from the Environment. This causes the error. If the double quotes are removed from the environment, then the problem is solved.

This may also be accomplished using the batch script operators to remove the extra quotes when processing strings. %~1 will remove enclosing quotes, to help with the pathing. Making the DOS batch file for complex could handle the situation.

Removing the double quotes in the environment corrects the problem, but PHPUnit will not function any longer.