Zend Framework

$parentDirectoriesArray not working in Zend_Tool_Project_Provider_Abstract::_loadProfile on windows

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Blocker Blocker
  • Resolution: Duplicate
  • Affects Version/s: Next Major Release
  • Fix Version/s: None
  • Component/s: Zend_Tool
  • Labels:
    None

Description

Windows CMD
C:\xampp\htdocs\zf1.9>zf.bat create project --path C:\xampp\htdocs\zf1.9\
Creating project at C:/xampp/htdocs/zf1.9

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"
  Profile
    zf show profile


C:\xampp\htdocs\zf1.9>

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

//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));

Activity

Hide
Christian Opitz added a comment -

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:

//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);
            }

//...
Show
Christian Opitz added a comment - 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:
//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);
            }

//...
Hide
Tim Holmes added a comment -

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

Show
Tim Holmes added a comment - 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
Hide
Rob Allen added a comment -

Duplicate of ZF-7465

Show
Rob Allen added a comment - Duplicate of ZF-7465
Hide
DiegoAlberto BernalPabon added a comment -

Christian Opitz solution worked like a charm, thanks.

Show
DiegoAlberto BernalPabon added a comment - Christian Opitz solution worked like a charm, thanks.
Hide
Christian Opitz added a comment -

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

Show
Christian Opitz added a comment - 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
Hide
Murad Jamal added a comment -

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 ....

Show
Murad Jamal added a comment - 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 ....
Hide
Murad Jamal added a comment -

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 ..?

Show
Murad Jamal added a comment - 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 ..?
Hide
Christian Opitz added a comment -

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

Cheers

Show
Christian Opitz added a comment - 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 Cheers
Hide
Murad Jamal added a comment -

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"
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 ...?

Show
Murad Jamal added a comment - 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" 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 ...?
Hide
Christian Opitz added a comment -

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.

Cheers

Show
Christian Opitz added a comment - 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. Cheers

People

Vote (0)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
Not Specified
Original Estimate - Not Specified
Remaining:
0m
Remaining Estimate - 0 minutes
Logged:
40m
Time Spent - 40 minutes