peej/phpdoctor

Adding phpdoc.php to execution path does not work

Closed this issue · 2 comments

Steps to reproduce (Unix):

  1. clone phpdoctor somewhere on your maching.
  2. cd /path/to/phpdoctor
  3. chmod +x phpdoc.php
  4. Add phpdoc.php to the environment path variable
    (I have a private bin directory from which I've created a symlink to /path/to/phpdoc.php
  5. cd /path/to/project
  6. Execute: phpdoc.php phpdoc.ini

Expected results:
phpdoctor should run

Actual results:

The following error is encountered:

PHP Warning:  require(classes/doc.php): failed to open stream: No such file or directory in /home/pgraham/projects/phpdoctor/classes/phpDoctor.php on line 40
PHP Fatal error:  require(): Failed opening required 'classes/doc.php' (include_path='.:/usr/share/php:/usr/share/pear:/home/pgraham/bin') in /home/pgraham/projects/phpdoctor/classes/phpDoctor.php on line 40

Patch:

The fix is pretty simple so I've included the diff here but if you prefer I can fork and make a Pull Request.

--- a/phpdoc.php
+++ b/phpdoc.php
@@ -32,7 +32,7 @@
 if (!isset($argv[0])) {
 }

 // include PHPDoctor class
-set_include_path(get_include_path() . PATH_SEPARATOR . dirname($argv[0]));
+set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__));
 require('classes'.DIRECTORY_SEPARATOR.'phpDoctor.php');

 // get name of config file to use
peej commented

Thanks for the fix pgraham, this has been committed to master.

No Problem. Thanks for the awesome documentation generator :)