ZF-7338: $parentDirectoriesArray not working in Zend_Tool_Project_Provider_Abstract::_loadProfile on windows

Issue Type: Bug Created: 2009-07-21T08:25:37.000+0000 Last Updated: 2009-08-18T07:04:28.000+0000 Status: Resolved Fix version(s): Reporter: Christian Opitz (metti) Assignee: Nick Belhomme (nbelhomme) Tags: - Zend_Tool

Related issues: Attachments: - Zend_Tool_Project_Provider_Abstract.patch


<pre class="highlight">
C:\xampp\htdocs\zf1.9>zf.bat create project --path C:\xampp\htdocs\zf1.9\
Creating project at <a>C:/xampp/htdocs/zf1.9</a>

C:\xampp\htdocs\zf1.9>zf.bat show profile

Warning: split(): REG_EESCAPE in C:\xampp\htdocs\zf1.9\library\Zend\Tool\Project
\Provider\Abstract.php on line 124
                       An Error Has Occurred
 A project profile was not found in

Zend Framework Command Line Console Tool v1.9.0a1
Details for action "Show" and provider "Profile"
    zf show profile


Sorry but i didn't know where to post the solution but here it is:

<pre class="highlight">

//It is the backslash on windows paths that causes the error. preg_quote fixes this:

$parentDirectoriesArray = split(preg_quote(DIRECTORY_SEPARATOR), ltrim($projectDirectory, DIRECTORY_SEPARATOR));


Posted by Christian Opitz (metti) on 2009-07-21T08:51:30.000+0000

The solution was not complete. There was an error on line 126 that made the path on windows look like this "\C:\xampp...". My solution is now:

<pre class="highlight">
//line 124 in Zend_Tool_Project_Provider_Abstract

$parentDirectoriesArray = split(preg_quote(DIRECTORY_SEPARATOR), ltrim($projectDirectory, DIRECTORY_SEPARATOR));
        while ($parentDirectoriesArray) {
            if (DIRECTORY_SEPARATOR == "\\") { // Seems to be a windows path
              $projectDirectoryAssembled = implode(DIRECTORY_SEPARATOR, $parentDirectoriesArray);
            } else {
              $projectDirectoryAssembled = DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $parentDirectoriesArray);


Posted by Tim Holmes (djaekimaar) on 2009-08-02T14:40:07.000+0000

Hope this sort of comment is ok here - This is brilliant, had the problem listed - applied the fix supplied to my downloaded code - all worked ok - very impressed, this is the first time that has happened . Thanks a lot

Posted by Rob Allen (rob) on 2009-08-10T01:11:20.000+0000

Duplicate of ZF-7465

Posted by DiegoAlberto BernalPabon (diegoalberto) on 2009-08-16T13:45:50.000+0000

Christian Opitz solution worked like a charm, thanks.

Posted by Christian Opitz (metti) on 2009-08-16T15:37:37.000+0000

Thank you for making me smile and thanks to Nick for applying the solution that quick. If every fixed bug here is praised like that, the ZF developers must be very proud people ;) Aloha

Posted by Murad Jamal (unpresedented) on 2009-08-17T23:33:39.000+0000

Christian, when i try to run this command: zf create action add index

using Zend Tool from inside Zend Studio 7 .. the message was the same:

An Error Has Occurred A project profile was not found.

Zend Framework Command Line Console Tool v1.8.4 Details for action "Create" and provider "Action" Action zf create action name controller-name[=index] view-included[=1] module

I searched for the file Abstract.php file, found it under: C:\Program Files\Zend\ZendServer\share\ZendFramework\library\Zend\Tool\Project\Provider and searched for line 126, as you mentioned above,still can't find where to put the fixing statements you posted above ...

anyhelp would be highly appreciated ....

Posted by Murad Jamal (unpresedented) on 2009-08-18T03:27:19.000+0000

sorry, but this solution didn't work with my project ... it still gives me the same error message : a project profile was not found ...

is there any other possible solution ..?

Posted by Christian Opitz (metti) on 2009-08-18T04:54:49.000+0000

Hi Murad,

maybe a dumb question - but are you sure that you have a .zfproject.xml file in your project? (If you worked with Zend Tool before you should) Zend Tool requires this file to work...

Why don't you update the complete Zend_Tool to 1.9? I did this and it works fine (Even when the rest of the ZF-library is from 1.8). In your case i would make a backup of this folder C:\Program Files\Zend\ZendServer\share\ZendFramework\library\Zend\Tool and update the contents to the same folder from 1.9


Posted by Murad Jamal (unpresedented) on 2009-08-18T06:44:53.000+0000

hi christian, I found out that the zend studio 7 i have produces the error from this file:

C:\Program Files\Zend\Zend Studio - 7.0.0\plugins\org.zend.php.framework.resource_7.0.0.v20090531-1639\resources\ZendFramework-1\library\Zend\Tool\Project\Provider

I did an upgrade to version 1.9 after i did a backup as you advised me; opened the file abstract.php, edited the exact statement above, without any effect, the error is this:

C:\Users\Administrator\Zend\workspaces\DefaultWorkspace7>"C:/Program Files/Zend/Zend Studio - 7.0.0/plugins/org.zend.php.framework.resource_7.0.0.v20090531-1639/resources/ZendFramework-1/bin//zf.bat" create action edit index An Error Has Occurred
A project profile was not found.

Zend Framework Command Line Console Tool v1.9.1
Details for action "Create" and provider "Action"
    zf create action name controller-name[=index] view-included[=1] module

I have a doubt about ( // ) exactly before zf.bat (look above carefully); i think this is the reason of the error ...

p.s. yes of course i have the .zfproject.xml in my project folder ...

what should i exactly do to get rid of this error ...?

Posted by Christian Opitz (metti) on 2009-08-18T07:04:27.000+0000

Hm - i'm not using Zend Studio (sorry, forgot to mention that above) and i'm not a Zend developer so i can not help you further.

I think your Zend Tool uses the wrong path - maybe you can configure the right path to your project in it - but as i don't use the Studio i really don't want to guess around. Probably you should contact s.o. from Zend.


Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.