phpcr / phpcr-utils

A set of helper classes and command line commands you want to use with phpcr, but that are not part of the API itself
phpcr.github.io
Other
72 stars 30 forks source link

NodeTouchCommand failing on windows #76

Closed vstm closed 11 years ago

vstm commented 11 years ago

The NodeTouchCommand uses dirname and basename for operations on PHPCR-paths. This causes problems because Windows might return \ instead of / as the root-path.

It breaks the unit test completely:

C:\[...]\jackalope-doctrine-dbal> phpunit
...  
Fatal error: Call to a member function addNode() on a non-object in C:\[...]\NodeTouchCommand.php on line 143

And just throws an exception if you want to "touch" a node:

C:\[...]\jackalope-doctrine-dbal> php bin\jackalope phpcr:node:touch /gopf --type nt:unstructured

  [PHPCR\RepositoryException]
  Not an absolute path '\'

This pull request solves the problem by simply replacing the "php-based" filesystem-functions with the PathHelper-counterparts.

dantleech commented 11 years ago

My bad :) Thanks for the fix!

lsmith77 commented 11 years ago

we should probably grep all bundles, jackalope and phpcr repositories for dirname calls

dbu commented 11 years ago

found one dirname in symfony-cmf that i fiexed https://github.com/symfony-cmf/SearchBundle/commit/27edcabebafe7ac9588ce76a0c132ac09ffa091e

dbu commented 11 years ago

and some basename calls fixed too https://github.com/symfony-cmf/TreeBrowserBundle/commit/38b4d06ab606e33170a888dfac1d09c9800f85f5 and https://github.com/symfony-cmf/RoutingBundle/commit/c5c1f9c1995093aeaeb160e7bd3bc37b8da300e6 and https://github.com/symfony-cmf/RoutingAutoBundle/commit/ac719e96fd8bcbb96c95c0ba819b38ad2dd116a6

dbu commented 11 years ago

jackalope and phpcr where cleaned up a moment ago when we created the PathHelper - i think this one just sneaked in. re-checked, there are no other occurrences currently.