Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.3.0

Bug #4533 Error at file (file.php)
Submitted: 2005-06-06 05:34 UTC
From: kadefa_elmasry at hotmail dot com Assigned: yunosh
Status: Closed Package: VFS
PHP Version: 5.0.3 OS: WindowsXP
Roadmaps: (Not assigned)    

 [2005-06-06 05:34 UTC] kadefa_elmasry at hotmail dot com
Description: ------------ Just to get a flavour of the VFS, I tried the following code <?php include("VFS/VFS.php"); include("VFS/VFS/file.php"); $myfiles=new VFS_file(array('vfsroot'=>'.')); print_r( $myfiles->listFolders()); ?> This shows me an error at file: file.php line: 497 According to my understanding of the system, I think this line should be corrected to be: $folders[] = array('val' => $path . '/' . $files['name'], 'abbrev' => $files['name'], 'label' => $path . '/' . $files['name']);


 [2005-06-06 07:51 UTC] yunosh
What *is* the error, and why do you think that your code is correct?
 [2005-06-06 09:15 UTC] kadefa_elmasry at hotmail dot com
The original code is: foreach ($folderList as $files) { $folders[$folder['val']] = array('val' => $path . '/' . $files['name'], 'abbrev' => $files['name'], 'label' => $path . '/' . $files['name']); } The error is that the variable $folder is unidefined. If the idea is to just append the new folders to the list, My code would be correct.
 [2005-06-06 11:01 UTC] yunosh
I can't reproduce this, and you change breaks backward compatibility and makes the 'val' entry unavailable. What is the content of $folderList when you get this error?
 [2005-06-08 06:30 UTC] kadefa_Elmasry at hotmail dot com
The problem is there is no such a variable called $folder. So the code issues an error of undefined index $folder['val'] It could be a typo, I'm not understanding what should this $folder['val'] represent. If you want the folder list to be indexed by the file names, you may use $files['name']. Regards
 [2005-06-08 07:36 UTC] yunosh
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on In case this was a website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better. I must have been blind to not see this the first time. Thanks for the patience.