PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » PEAR » PEAR » Bug #7196

PEAR crashes when using autoload_prepend_file

Details

Submitted2006-03-24 14:07 UTC
FromRQuadling at GMail dot com
Assignedcellog
StatusClosed
PackagePEAR
PHP Version5_1 CVS-2006-03-24
OSWindows XP SP2
Roadmaps(Not assigned)

Comments

[2006-03-24 14:07 UTC] RQuadling at GMail dot com

Description:
------------
I've just started using an autoload file and have set the PHP-CLI.INI/PHP-ISAPI.INI setting of auto_prepend_file

The include path in the ini files contains ...

include_path="C:\PEAR\pear\;.\;D:\Data\PHP\Includes\"

The autoload.inc is in D:\Data\PHP\Includes\.

At the command prompt, if I type PEAR[ENTER] I get ...

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

Warning: Unknown: Failed opening 'auto_loader.php' for inclusion (include_path='C:\PEAR\PEAR') in Unknown on line 0

In looking at the pear.bat file, I put an echo in front of the run line and then re-ran pear.bat and got ...

"C:\PHP5\php.exe" -C -d output_buffering=1 -d safe_mode=0 -d open_basedir="" -d include_path="C:\PEAR\PEAR" -f "C:\PEAR\PEAR\pearcmd.php" --

This is the issue. The include path has been amended to NOT include the directory for my include files. No problem with that.

I would recommend that adding

-d auto_prepend_file=

to the run line ...

:RUN
"%PHP_PEAR_PHP_BIN%" -C -d output_buffering=1 -d safe_mode=0 -d open_basedir="" -d auto_prepend_file= -d include_path="%PHP_PEAR_INSTALL_DIR%" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9
:END

would alleviate this problem.

The following patch should achieve this.

Index: pear.bat
===================================================================
RCS file: /repository/pear-core/scripts/pear.bat,v
retrieving revision 1.24
diff -u -r1.24 pear.bat
--- pear.bat 23 Jan 2006 16:30:14 -0000 1.24
+++ pear.bat 24 Mar 2006 14:05:40 -0000
@@ -110,6 +110,6 @@
ECHO %PHP_PEAR_PHP_BIN%
GOTO END
:RUN
-"%PHP_PEAR_PHP_BIN%" -C -d output_buffering=1 -d safe_mode=0 -d open_basedir="" -d include_path="%PHP_PEAR_INSTALL_DIR%" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9
+"%PHP_PEAR_PHP_BIN%" -C -d output_buffering=1 -d safe_mode=0 -d open_basedir="" -d auto_prepend_file= -d include_path="%PHP_PEAR_INSTALL_DIR%" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9
:END
@ECHO ON
\ No newline at end of file

[2006-03-24 14:09 UTC] RQuadling at GMail dot com

Oh. Cutting and pasting the patch has made a mess.

Basically adding

-d auto_prepend_file=

is needed to not use any autoloading.

[2006-03-27 07:39 UTC] RQuadling at GMail dot com

Dozy me!

If PEAR is going to crash with auto_prepend_file, PEAR will also crash with auto_append_file!

-d auto_append_file=""

also needed.

P.S. Sorry for re-opening the bug.

Patch for pear.bat / pear.sh / peardev.bat / peardev.sh

Index: pear.bat
===================================================================
RCS file: /repository/pear-core/scripts/pear.bat,v
retrieving revision 1.25
diff -u -r1.25 pear.bat
--- pear.bat 25 Mar 2006 21:15:29 -0000 1.25
+++ pear.bat 27 Mar 2006 07:36:29 -0000
@@ -110,6 +110,6 @@
ECHO %PHP_PEAR_PHP_BIN%
GOTO END
:RUN
-"%PHP_PEAR_PHP_BIN%" -C -d output_buffering=1 -d safe_mode=0 -d open_basedir="" -d auto_prepend_file="" -d register_argc_argv="On" -d include_path="%PHP_PEAR_INSTALL_DIR%" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9
+"%PHP_PEAR_PHP_BIN%" -C -d output_buffering=1 -d safe_mode=0 -d open_basedir="" -d auto_prepend_file="" -d auto_append_file="" -d register_argc_argv="On" -d include_path="%PHP_PEAR_INSTALL_DIR%" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9
:END
@ECHO ON
\ No newline at end of file
Index: pear.sh
===================================================================
RCS file: /repository/pear-core/scripts/pear.sh,v
retrieving revision 1.5
diff -u -r1.5 pear.sh
--- pear.sh 25 Mar 2006 21:15:29 -0000 1.5
+++ pear.sh 27 Mar 2006 07:36:29 -0000
@@ -25,4 +25,4 @@
fi
fi

-exec $PHP -C -q $INCARG -d output_buffering=1 -d open_basedir="" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" $INCDIR/pearcmd.php "$@"
+exec $PHP -C -q $INCARG -d output_buffering=1 -d open_basedir="" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d auto_append_file="" $INCDIR/pearcmd.php "$@"
Index: peardev.bat
===================================================================
RCS file: /repository/pear-core/scripts/peardev.bat,v
retrieving revision 1.4
diff -u -r1.4 peardev.bat
--- peardev.bat 25 Mar 2006 21:15:29 -0000 1.4
+++ peardev.bat 27 Mar 2006 07:36:29 -0000
@@ -110,6 +110,6 @@
ECHO %PHP_PEAR_PHP_BIN%
GOTO END
:RUN
-"%PHP_PEAR_PHP_BIN%" -C -d memory_limit="-1" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d open_basedir="" -d output_buffering=1 -d include_path="%PHP_PEAR_INSTALL_DIR%" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9
+"%PHP_PEAR_PHP_BIN%" -C -d memory_limit="-1" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d auto_append_file="" -d open_basedir="" -d output_buffering=1 -d include_path="%PHP_PEAR_INSTALL_DIR%" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9
:END
@ECHO ON
\ No newline at end of file
Index: peardev.sh
===================================================================
RCS file: /repository/pear-core/scripts/peardev.sh,v
retrieving revision 1.4
diff -u -r1.4 peardev.sh
--- peardev.sh 25 Mar 2006 21:15:29 -0000 1.4
+++ peardev.sh 27 Mar 2006 07:36:29 -0000
@@ -25,4 +25,4 @@
fi
fi

-exec $PHP -d memory_limit="-1" -C -q $INCARG -d output_buffering=1 -d open_basedir="" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" $INCDIR/pearcmd.php "$@"
+exec $PHP -d memory_limit="-1" -C -q $INCARG -d output_buffering=1 -d open_basedir="" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d auto_append_file="" $INCDIR/pearcmd.php "$@"

Is this the best way to submit patches for bugs?

As an aside, the pecl.bat / pecl.sh use PHP -n ... no php.ini file. Could this be appropriate for PEAR? Save having to add all these -d's?