ZF-7464: zf.bat on Windows throws Undefined index: STORAGE_DIR Notice

Description

When I run zf show version on Windows, I get this notice:

PHP Notice: Undefined index: STORAGE_DIR in C:\www\zf-trunk\bin\zf.php on line 70 PHP Stack trace: PHP 1. {main}() C:\www\zf-trunk\bin\zf.php:0 PHP 2. zf_main() C:\www\zf-trunk\bin\zf.php:23 PHP 3. zf_setup_storage_directory() C:\www\zf-trunk\bin\zf.php:32 Zend Framework Version: 1.9.0a1

(Xdebug installed - also happens if Xdebug isn't installed.)

I tested trunk and release-1.9 and both have this problem.

Comments

Suggested patch:


Index: bin/zf.php
===================================================================
--- bin/zf.php  (revision 17369)
+++ bin/zf.php  (working copy)
@@ -66,13 +66,15 @@
     } elseif (isset($_zf['HOME']) && file_exists($_zf['HOME'] . '/.zf/')) {
         $_zf['STORAGE_DIR'] = $_ENV['HOME'] . '/.zf/';
     }
-    
-    $storageRealpath = realpath($_zf['STORAGE_DIR']);
-    
-    if ($storageRealpath) {
-        $_zf['STORAGE_DIR'] = $storageRealpath;
-    } else {
-        unset($_zf['STORAGE_DIR']);
+
+    if(isset($_zf['STORAGE_DIR'])) {
+        $storageRealpath = realpath($_zf['STORAGE_DIR']);
+
+        if ($storageRealpath) {
+            $_zf['STORAGE_DIR'] = $storageRealpath;
+        } else {
+            unset($_zf['STORAGE_DIR']);
+        }
     }
     
 }

Not Windows-specific. Happens on Mac OS X, too, with 1.9.0 final. Did not happen with 1.8.4PL1.

Also Occured using final version of 1.9 on a CentOS 5.2, apache 2, php 5.2.9, with ioncude, Zend ext Manager and Optimizer. Suggested patch resolves

Patch effective for vanilla install of Apache 2, PHP 5.3 under Windows (XP & 7). Nice work.

Fixed in trunk in r17522 and 1.9 release branch in r17524

Updating fix information