[DCOM-234] Cache file fails on Windows - name too long Created: 19/Feb/14  Updated: 19/Feb/14

Status: Open
Project: Doctrine Common
Component/s: Caching
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: Matt Durak Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Windows 8.1 x64
Symfony CMF with Doctrine caching



 Description   

The filename component of the FileCache is unbounded. It is possible to attempt to create files that are too long for the Windows filesystem. This causes an exception.

Example from a Symfony CMF/PHPCR project:

file_put_contents(D:\web_workspace\study\app\cache\dev\doctrine\cache\71d059fe39968db8\3e485dbb27419897\dfb24337887ff42c\a7b85c70bfefa781\nodes[nodes weak references cmsprogrampagesThe Summer ProgramThe Calendar 5 weeks for all Europe, routeContent, default][49].doctrinecache.data): failed to open stream: Invalid argument in D:\web_workspace\study\vendor\doctrine\cache\lib\Doctrine\Common\Cache\FilesystemCache.php line 111

In this case, the ID was
"nodes[nodes weak references cmsprogrampagesThe Summer ProgramThe Calendar 5 weeks for all Europe, routeContent, default][49].doctrinecache.data"

That refers to a phpcr node:
cms/program/pages/The Summer Program/The Calendar 5 weeks for all Europe

Attempting to manually create that file in windows explorer shows that it is trunacted to
"nodes[nodes weak references cmsprogrampagesThe Summer ProgramThe Calendar 5 weeks for all Europe, routeContent, default][49].do" (128 characters)

Shouldn't the ID be truncated so this doesn't happen? Should this be fixed here or in the phpcr that is creating the long ID to begin with?






[DCOM-239] [GH-319] Add last modified time for metadata Created: 22/Mar/14  Updated: 22/Mar/14

Status: Open
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of c960657:

Url: https://github.com/doctrine/common/pull/319

Message:

This PR is part 1 of 2. Part 1 is for the doctrine/doctrine2 repository.

Read more in https://github.com/doctrine/doctrine2/pull/986






[DCOM-232] [GH-315] Ability to use alternate dump functions Created: 04/Feb/14  Updated: 04/Feb/14

Status: Open
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of pmeth:

Url: https://github.com/doctrine/common/pull/315

Message:

In most cases functions such as print_r provide much more readable output than var_dump. Some might also want to use var_export or write their own dump function. This should be a simple change that does not cause any BC breaks.






[DCOM-203] Ability to set defaultManager on ManagerRegistry Created: 21/Jun/13  Updated: 21/Jun/13

Status: Open
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Daniel Leech Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

We (in the CMF) need to be able to change the "default manager" name at runtime, to enable switching, for example, between Production and Staging workspaces.

This is currently not possible because defaultManager is private and there is no setter.

See: https://github.com/doctrine/DoctrinePHPCRBundle/issues/73






[DCOM-160] [GH-242] adds a simple manager registry Created: 10/Jan/13  Updated: 10/Jan/13

Status: Open
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of schmittjoh:

Url: https://github.com/doctrine/common/pull/242

Message:

This registry adds some sane defaults and just requires a simple callable to be fully functional.






[DCOM-80] Add common exceptions into Doctrine\Common Created: 19/Nov/11  Updated: 20/Dec/11

Status: Open
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: 2.3

Type: Improvement Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Following the ZF and SF2 Standard for Exceptions we should have base exceptions in Common






[DCOM-77] add a method to force removal of any unmapped data on flush for a given object Created: 16/Nov/11  Updated: 16/Nov/11

Status: Open
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major
Reporter: Lukas Kahwe Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

in order to ensure that any unmapped fields are set to their defaults or removed in the case of nosql right now there is no way to do this except with 2 flush calls: aka remove+flush, persist+flush

there should be some way to do this in one flush






[DCOM-73] CodeGeneration using Doctrine\Common\Persistence\Mapping\ObjectMetadata Created: 24/Oct/11  Updated: 03/Dec/13

Status: Open
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major
Reporter: Benjamin Eberlei Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Currently we have tons of code in the ODM/ORMs regarding code generation that are ugly to extend and maintain. We should extract all them into a new component, for example named: doctrine-code-generator

  • It should be feed by only instances of Doctrine\Common\Persistence\Mapping\ObjectMetadata into a twig template.
  • A base template for an entity/document is shipped
  • Maybe ORM/ODM specific child templates or twig traits are necessary to handle writing annotations. This could also be done by adding hooks into the code-generation somehow.
  • Each entity of the user can provide its own template, for examples from a configurable directory "code_templates/Vendor.ProjectBundle.Entity.User.twig" to extend the base template and add own code.
  • As a perspective we should aim for 5.4 generating a trait so that you can have your entity "class User { use UserBase; }

    "






[DCOM-67] Introduce immutable DateTime with __toString() Created: 27/Aug/11  Updated: 29/Jan/12

Status: Reopened
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: 2.3

Type: Improvement Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Comments   
Comment by Benjamin Eberlei [ 27/Aug/11 ]

Implemented

Comment by Koji Ando [ 11/Jan/12 ]

Though it is implemented once on https://github.com/doctrine/common/commit/7140ad3ba0ba2a94238976dd7f310ff92b478c96,
the class is removed on https://github.com/doctrine/common/commit/f845c1e267abf9069422eba8addfa976bc8d8685.

I think this issue must be reopened.

Comment by Benjamin Eberlei [ 11/Jan/12 ]

Code was removed due to implementation problems.





[DCOM-33] Allow to register callbacks in the EventManager Created: 01/Jan/11  Updated: 01/Jan/11

Status: Open
Project: Doctrine Common
Component/s: Event System
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Comments   
Comment by Benjamin Eberlei [ 01/Jan/11 ]

Consider to add a second queue for callbacks. Its not possible to simulate this by doing something like:

public function addCallbackListener($event, Closure $callback)
{
    $eventListener = new stdClass();
    $eventListener->$event = $callback;
    $this->addEventListener($event, $eventListener);
}

sad





[DCOM-74] Ideas for Event Manager Improvements Created: 31/Oct/11  Updated: 21/Apr/14

Status: Open
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Johannes Schmitt Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I have two ideas for improving the event manager.

1. Add a lazy-loading implementation as we discussed on IRC already (helpful for keeping the overhead of post generation schema listener down for example)
2. Providing better debugging information of what is going on (which listeners have been called for which event, similar to Symfony2's event dispatcher)



 Comments   
Comment by Guilherme Blanco [ 16/Jan/12 ]

I'm still a huge fan of DOM2 Events.

I even have the code somewhere here, but that would break BC.

Comment by Marijn Huizendveld [ 06/Feb/13 ]

Would you care to elaborate on your DOM2 Events implementation Guilherme?

Comment by Guilherme Blanco [ 21/Apr/14 ]

Marijn Huizendveld sure (like... 1 year later!)
DOM2 Events ( http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/ )
The idea is to create an event system where you can control the flow over the listeners, such as prevent the default operation or stop propagation.
I'm a big fan of this because that way any piece can be easily decoupled from the base system and become a specialized event if needed. It also can be controlled depending on the conditions to be introspected by an specific listener.

Comment by Guilherme Blanco [ 21/Apr/14 ]

I also provided a very initial draft 2 years ago, as of https://github.com/doctrine/common/pull/153





[DCOM-238] FileCache does not remove directories on flush Created: 21/Mar/14  Updated: 21/Mar/14

Status: Open
Project: Doctrine Common
Component/s: Caching
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Ryan Korczykowski Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Windows 7



 Description   

FileCache::doFlush() does not remove the directories that store the cache file. The cache file is correctly deleted. This results in hundreds of hanging directories when the cache is flushed / rebuilt.

The version of doctrine/cache is 1.3.0.



 Comments   
Comment by Marco Pivetta [ 21/Mar/14 ]

This is likely because of the iterator skipping directories:

https://github.com/doctrine/cache/blob/36c4eee5051629524389da376ba270f15765e49f/lib/Doctrine/Common/Cache/FileCache.php#L120-L122





[DCOM-224] If @ManyToOne targetEntity contains class name with double slashes, "Cannot redeclare class" error is raised Created: 30/Nov/13  Updated: 14/Dec/13

Status: Open
Project: Doctrine Common
Component/s: None
Affects Version/s: 2.4.1
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: Ville Mattila Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

If @ManyToOne (and apparently any other association annotation) contains targetEntity with "wrongly" defined fully qualified class name in format like My\\Entity
Class, Fatal error "Cannot redeclare class" is raised when running command to generate schema.

It would be more intuitive (and save some debugging hours if a proper exception of wrongly defined class name would be raised.



 Comments   
Comment by Luis Cordova [ 14/Dec/13 ]

i haven't tried annotations yet but in yml and on master this gives me:

[Doctrine\ORM\Mapping\MappingException]
The target-entity Acme\DemoBundle\Entity\UserX cannot be found in 'Acme\DemoBundle\Entity\Category#users
'.

let me try annotations ...

Comment by Luis Cordova [ 14/Dec/13 ]

yeah this should be pretty much closed @ocramius @beberlei

Comment by Luis Cordova [ 14/Dec/13 ]

https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php#L945

Comment by Marco Pivetta [ 14/Dec/13 ]

Copied comment from 2844:

The issue should try to create a mapping of the kind

@ManyToOne(targetEntity="Foo\\Bar")

explicitly using two backslashes in the namespace seperator and try if an error occurs. This might be autoloader and Operating System dependent. Even if there is no error, we should fix "Doctrine\ORM\Mapping\ClassMetadataInfo" to replace double backslashes everywhere with one backslash correctly. This affects targetEntity and DiscrimnatorMap.

Comment by Marco Pivetta [ 14/Dec/13 ]

I'd rather throw an exception to warn the user about the abuse of backslashes.

Comment by Marco Pivetta [ 14/Dec/13 ]

Moved to doctrine common, since it's an issue with how metadata is being loaded when referenced

Comment by Marco Pivetta [ 14/Dec/13 ]

Provided a hotfix at https://github.com/doctrine/common/pull/309





[DCOM-214] Collection Criteria isNull does not work well Created: 12/Sep/13  Updated: 12/Sep/13

Status: Open
Project: Doctrine Common
Component/s: Collections
Affects Version/s: 2.4.1
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Jan Pecek Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: collection, criteria, expression
Environment:

PHP 5.4.4, PostgreSQL 9.1



 Description   

I'm using the Collection project https://github.com/doctrine/collections and its Criteria building part. I'm not sure if I'm putting this bug to the good project. Please, correct me if not.

There is bug in method isNull: https://github.com/doctrine/collections/blob/master/lib/Doctrine/Common/Collections/ExpressionBuilder.php#L125

This produces SQL command where is 'IS ?' and null value is passed as param. This is fail.

Code example:

  $expr = Criteria::expr();
  $criteria = Criteria::create()
	->where($expr->lte('num', 42))
	->andWhere($expr->isNull('deleted'));
  return $this->myCollection->matching($criteria);

This produces SQL:

 SELECT ... FROM ... WHERE num <= ? AND deleted IS ? 

with params

[ 42, null ]





[DCOM-130] Paths in Doctrine\Common\Cache\FileCache could create large directory indexes Created: 23/Oct/12  Updated: 05/Jul/13

Status: Open
Project: Doctrine Common
Component/s: Caching
Affects Version/s: 2.3
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: R Churchill Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Any



 Description   

The way paths are created within FileCache currently, there is a theoretical maximum of 16^12 directories in the cache directory, which is quite a large number. Usually schemes like this are used to restrict the number of files in one directory.

Comparing with git, for example, the dirs are arranged

00/
1c/
...
ff/

and then the object store within those directories, which is a lot more manageable, say if you happen to type ls in the cache directory, you will get a maximum listing of 256 dirs. PhpThumb does something similar when caching images.

How about something like this for getFilename():

$idHash = md5($id);
$path = substr($idHash, 0, 2) . DIRECTORY_SEPARATOR . substr($idHash, 2, 2) . DIRECTORY_SEPARATOR . substr($idHash, 4);
$path = $this->directory . DIRECTORY_SEPARATOR . $path;

return $path . $id . $this->extension;

Not nearly so elegant, but I think this has better properties for the file system. Also I would be tempted to use one of the sha family hashes and not to include the $id within the filename, but perhaps this is helpful for debugging?



 Comments   
Comment by Julian Higman [ 10/May/13 ]

We hit this problem in a live system - with a lot of cached items, the number of subdirectories that FileCache creates can exceed the number that an ext3 filesystem allows in a single directory (about 32000).

After that, an attempt to cache a new item can get an error like this:

mkdir() [function.mkdir]: Too many links

Our solution was similar to that suggested:


    protected function getFilename($id) {
        $path = implode(str_split(md5($id), 2), DIRECTORY_SEPARATOR);
        $path = $this->directory . DIRECTORY_SEPARATOR . $path;
        return $path . DIRECTORY_SEPARATOR . $id . $this->extension;
    }

It splits the md5 of the item id into parts of length 2, rather than the original 12. This creates a deeply nested structure, but which won't ever exceed the limit on number of subdirectories in any one directory. It's the same subdirectory pattern used by default by Apache mod_disk_cache, as well.

Comment by Julian Higman [ 05/Jul/13 ]

After a couple of months in production, we ran into another problem with this - we reached the maximum number of inodes in the fielsystem.

The resulting errors look like this:

mkdir() [function.mkdir]: No space left on device

There is actually disk space left, but looking at the inodes shows that the limit has been hit:

-bash-3.2# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda1 6553600 6553600 0 100% /

The creation of directories and subdirectories can be constrained slightly by using 3 instead of 2 characters (with hex chars, that will give max of 16^3 = 4096 subdirectories per directory, still less than the ext3 limit of 32000)

$path = implode(str_split(md5($id), 2), DIRECTORY_SEPARATOR);

but ultimately the inodes will still all be used up.

The only other options are pruning the cache at intervals, or switching to a different caching strategy altogether.

Comment by Marco Pivetta [ 05/Jul/13 ]

Julian Higman I'd suggest file-based caching mechanisms are not suited for that environment. The file cache is really meant for all those environments where there's strict constraints (like shared hosting).





[DCOM-129] Annotation parser matches colon after annotation Created: 21/Oct/12  Updated: 21/Oct/12

Status: Open
Project: Doctrine Common
Component/s: None
Affects Version/s: 2.3
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Konstantin Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Code

/**
* Removes given $node from the tree and reparents its descendants
*
* @todo may be improved, to issue single query on reparenting
* @param object $node
* @throws RuntimeException - if something fails in transaction
* @return void
*/
public function removeFromTree($node)
{

fails with `[Semantical Error] The annotation "@todo:" in method Gedmo\Tree\Entity\Repository\ClosureTreeRepository::removeFromTree() was never imported. Did you maybe forget to add a "use" statement for this annotation?`.

As you see it tryes find annotation with name "@todo:". Don't know, maybe rtrim($name, ':') would enough.






[DCOM-189] Doctrine Proxies may conflict with interfaced constructors Created: 03/May/13  Updated: 24/Apr/14

Status: Reopened
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: 2.5.0

Type: Improvement Priority: Minor
Reporter: Harmen M Assignee: Marco Pivetta
Resolution: Unresolved Votes: 0
Labels: None


 Description   

The Doctrine ProxyGenerator generates for a proxy a constructor. The documentation of Doctrine states that the constructor is never called. For a project, I created a group of entities with a interfaced constructor in order to enforce a common interface. This results in a incompatible proxy and so a fatal error.



 Comments   
Comment by Marco Pivetta [ 03/May/13 ]

Cannot fix this - the constructor is required to override instantiation logic

Comment by Harmen M [ 03/May/13 ]

Edit: added the correct description. I accidentially submitted the form before editing the description.

Comment by Marco Pivetta [ 03/May/13 ]

Harmen M why do you have a constructor in an interface? That's a very bad practice, and it makes things quite hard to handle.

I can think of a workaround, but I first want to be sure there's a real advantage in changing the current implementation to use

unserialize()

just to handle this specific use case.

Comment by Benjamin Eberlei [ 03/May/13 ]

Adding __construct to an interface is an anti pattern and shouldn't be done.

Comment by Harmen M [ 03/May/13 ]

Ok, then I change my implementation.

But, maybe it is an idea to update the documentation of the ORM and state that constructor interfacing is not possible?
http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/architecture.html

Comment by Marco Pivetta [ 18/Dec/13 ]

I actually had more requests for this feature on a similar project ( https://github.com/Ocramius/ProxyManager/issues/115 ).
I will mark this as feature request, but can't guarantee that it will get into Doctrine 2.x, since it may be a BC break.

Comment by Guilherme Blanco [ 24/Apr/14 ]

Creating interfaces with __construct ties your contract preventing extensibility points. This is nature of OOP and I do not consider this should be documented because it's (in-theory) expected that people have some level of knowledge in OO design when coding.

Closing this as invalid.

Comment by Marco Pivetta [ 24/Apr/14 ]

Re-opening.

While interfaced constructors are a known bad practice, changing constructor parameters is also a well known LSP violation (a minor one).

I'll keep tracking this, but I'm blocked by HHVM's missing Closure::bind() as of https://github.com/facebook/hhvm/issues/1203





[DCOM-229]  DocParser - add support for php5 MyClass::class call to get path of the class Created: 06/Jan/14  Updated: 06/Jan/14

Status: Open
Project: Doctrine Common
Component/s: Annotations
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Trivial
Reporter: Umed Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

When I try to use in my annotations

 
Career::class

I get Semantical Error. Career is imported, so I dont want to use full class path name again. How about to add this feature to support by annotations?
We need to add some code like this (DocParser#Constant):

 
            if ($found) {
                 if ($const === 'class') {
                    return $className;
                 }

                 $identifier = $className . '::' . $const;
            }
        }

        if (!defined($identifier)) {
            throw AnnotationException::semanticalErrorConstants($identifier, $this->context);
        }

        return constant($identifier);





[DCOM-207] Add AnnotationReader::getFunctionAnnotations() Created: 09/Jul/13  Updated: 09/Jul/13

Status: Open
Project: Doctrine Common
Component/s: Annotations
Affects Version/s: 2.3
Fix Version/s: None

Type: New Feature Priority: Trivial
Reporter: Benjamin Morel Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Currently, the annotation reader supports reading annotations on class, method and property.
This could be extended to read annotations on any kind of function, by adding the following methods:

public function getFunctionAnnotations(\ReflectionFunctionAbstract $function);
public function getFunctionAnnotation(\ReflectionFunctionAbstract $function, $annotationName);

This could be done without breaking BC in the following ways:

  • Keep the Reader interface as it is
  • Add a new interface, for example FullReader, that would extend Reader to add these two methods
  • Add the new methods to AnnotationReader, CachedReader, etc.
  • Update these classes to implement FullReader; thus they would still implement Reader and stay compatible.

Then, on the next major release (3.0.0), we could:

  • Add the two methods to Reader
  • Remove FullReader
  • Add a note to the UPGRADE file to rename FullReader to Reader in application code.

In case you're wondering why I'm proposing this feature, I'm developing a lightweight framework, which allows any method, function, or closure to be used as a controller.
I can currently parse annotations when using a class method, but cannot provide support for annotations on the others.

That would be a great addition.
I've checked the code, and it looks like the only difficulty would be to parse "use" statements for the file where the function is declared, whereas for now it is always assumed that there is a class, and that the file name will be inferred from there. But as ReflectionFunctionAbstract provides a getFileName() method, it's technically feasible as well.

Let me know what you think!
If you have no objection to the concept, I can start working on a PR for this feature.






[DCOM-165] Entities seems not be recognized by AnnotationDriver Created: 02/Sep/12  Updated: 03/Dec/13

Status: Awaiting Feedback
Project: Doctrine Common
Component/s: Annotations
Affects Version/s: 2.2, 2.3
Fix Version/s: None

Type: Bug Priority: Trivial
Reporter: Maarten de Keizer Assignee: Marco Pivetta
Resolution: Unresolved Votes: 0
Labels: annotationdriver, realpath, symlink, windows
Environment:

Windows 7 Profesional, Enterprise and Windows Server 2003 and 2008; Common: 2.2.3 DBAL: 2.2.2 ORM: 2.2.3; PHP 5.4.5 and 5.3.5



 Description   

Problem:
--------
"$em->getMetadataFactory()->getAllMetadata()"
Will result in an empty array. The entitiy manager is correctly configured and the entities files are loaded (echo's in the files will be displayed).

Debug steps:
------------
Looking in the code for the problem I created the following debug points first:

file AnnotationDriver.php method getAllClassNames()
after the line: "$includedFiles[] = $sourceFile;"
add: "echo $sourceFile . ' is loaded' . PHP_EOL;"

file AnnotationDriver.php method getAllClassNames()
after the line: "$sourceFile = $rc->getFileName();"
add: "echo $className . ' is loaded from: ' . $sourceFile . ' in the includedFiles array? ' . (in_array($sourceFile, $includedFiles) ? 'YES' : 'not found ') . PHP_EOL;"

the following output will be displayed:
...
f:\workspace\nl.markei.posto-2.3\lib\relaties\Contact.php is loaded
...
nl\markei\posto\relaties\Contact is loaded from: F:\workspace\nl.markei.posto-2.3\lib\relaties\Contact.php in the includedFiles array? not found

It seems that Doctrine includes the file from f: but ReflectionClass say it is loaded from F:. The in_array() will fail and Doctrine will not recognized the entity.

But this is not the full problem. I created a new debug point:

file AnnotationDriver.php method getAllClassNames()
after the line: "foreach ($this->_paths as $path) {"
add: "echo 'path: ' . $path . ' after realpath: ' . realpath($path) . PHP_EOL;"

This will result in the following output:
"path: F:\domains\markei.nl\lib\nl.markei.posto\ after realpath: f:\workspace\nl.markei.posto-2.3\lib"

So the conversion of the F: to f: is done by realpath; its look like

A simple fix should be in AnnotationDriver.php / getAllClassNames()
replace: "$sourceFile = $rc->getFileName();"
by: "$sourceFile = realpath($rc->getFileName());"

After I did that, the problem still exists. So I add to echo's (one with realpath and one without at the part of the code). And both echo's result in a path starting with "F:".

So my first reaction was freaky!

After some frustrating hours I found the problem in the symlink I used.
"F:\domains\markei.nl\lib\nl.markei.posto" was a symlink to "f:\workspace\nl.markei.posto-2.3\lib" and realpath will not convert the driver char in the target of the symlink for some freaky reason. After changing the symlink target to "F:\workspace...." everything works fine.

Summary:
--------
realpath results are not consistent on Windows. This will resulting in problems under Windows.

Possible solutions:
-------------------
Saying "this is a PHP bug".
It is possible that there are more case sensitive problems hidding here on Windows. Maybe it is better to use (for Windows only!) a case insensitive in_array-alternative in AnnotationDriver.php getAllClassNames() (or convert all paths for to lowercase for Windows)



 Comments   
Comment by Marco Pivetta [ 23/Jan/13 ]

Maarten de Keizer looks like the issue is still there in doctrine/annotations. Are you able to come up with a failing test case?





Generated at Fri Apr 25 00:32:33 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.