[DCOM-271] [GH-352] SymfonyFileLocator: DIRECTORY_SEPARATOR instead of slash Created: 02/Feb/15  Updated: 25/Mar/15  Resolved: 25/Mar/15

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

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Incomplete Votes: 0
Labels: directory-separator, file-locator, windows


 Description   

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

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

Message:

It could case some odd behaviour especially on Windows.



 Comments   
Comment by Doctrine Bot [ 25/Mar/15 ]

A related Github Pull-Request [GH-352] was assigned:
https://github.com/doctrine/common/pull/352

Comment by Doctrine Bot [ 25/Mar/15 ]

A related Github Pull-Request [GH-352] was closed:
https://github.com/doctrine/common/pull/352





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





[DBAL-1194] [GH-832] Fix test failures on windows due to differing newlines Created: 08/Apr/15  Updated: 15/Apr/15  Resolved: 15/Apr/15

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.6
Security Level: All

Type: Bug Priority: Minor
Reporter: Doctrine Bot Assignee: Steve Müller
Resolution: Fixed Votes: 0
Labels: ci, newlines, tests, testsuite, windows


 Description   

This issue is created automatically through a Github pull request on behalf of zeroedin-bill:

Url: https://github.com/doctrine/dbal/pull/832

Message:

Some tests were failing on windows due to differing newlines.

The tests which were failing used inline newlines in the comparison string, which evaluate to \r\n on Windows and \n on *nix.

The tests have been changed to use explicit newlines "\n".

Failure messages:
```
E:\wwwroot\dbal>vendor\bin\phpunit -c nodb.xml --filter "(testGetPlaceholderPositions|testDriverExceptionIsWrapped)" tests\Doctrine\Tests\DBAL
PHPUnit 4.0.20 by Sebastian Bergmann.

Configuration read from E:\wwwroot\dbal\nodb.xml

FFFFF.....................F............

Time: 2.8 seconds, Memory: 33.25Mb

There were 6 failures:

1) Doctrine\Tests\DBAL\ConnectionTest::testDriverExceptionIsWrapped with data set #0 ('exec')
Failed asserting that exception message 'An exception occurred while executing 'MUUHAAAAHAAAA':

SQLSTATE[HY000]: General error: 1 near "MUUHAAAAHAAAA": syntax error' contains 'An exception occurred while executing 'MUUHAAAAHAAAA':

SQLSTATE[HY000]: General error: 1 near "MUUHAAAAHAAAA"'.

2) Doctrine\Tests\DBAL\ConnectionTest::testDriverExceptionIsWrapped with data set #1 ('query')
Failed asserting that exception message 'An exception occurred while executing 'MUUHAAAAHAAAA':

SQLSTATE[HY000]: General error: 1 near "MUUHAAAAHAAAA": syntax error' contains 'An exception occurred while executing 'MUUHAAAAHAAAA':

SQLSTATE[HY000]: General error: 1 near "MUUHAAAAHAAAA"'.

3) Doctrine\Tests\DBAL\ConnectionTest::testDriverExceptionIsWrapped with data set #2 ('executeQuery')
Failed asserting that exception message 'An exception occurred while executing 'MUUHAAAAHAAAA':

SQLSTATE[HY000]: General error: 1 near "MUUHAAAAHAAAA": syntax error' contains 'An exception occurred while executing 'MUUHAAAAHAAAA':

SQLSTATE[HY000]: General error: 1 near "MUUHAAAAHAAAA"'.

4) Doctrine\Tests\DBAL\ConnectionTest::testDriverExceptionIsWrapped with data set #3 ('executeUpdate')
Failed asserting that exception message 'An exception occurred while executing 'MUUHAAAAHAAAA':

SQLSTATE[HY000]: General error: 1 near "MUUHAAAAHAAAA": syntax error' contains 'An exception occurred while executing 'MUUHAAAAHAAAA':

SQLSTATE[HY000]: General error: 1 near "MUUHAAAAHAAAA"'.

5) Doctrine\Tests\DBAL\ConnectionTest::testDriverExceptionIsWrapped with data set #4 ('prepare')
Failed asserting that exception message 'An exception occurred while executing 'MUUHAAAAHAAAA':

SQLSTATE[HY000]: General error: 1 near "MUUHAAAAHAAAA": syntax error' contains 'An exception occurred while executing 'MUUHAAAAHAAAA':

SQLSTATE[HY000]: General error: 1 near "MUUHAAAAHAAAA"'.

6) Doctrine\Tests\DBAL\SQLParserUtilsTest::testGetPlaceholderPositions with data set #21 ('SELECT * FROM foo WHERE bar = \'it\\\'s a trap? \\\\\' OR bar = ?
AND baz = "\\"quote
" me on it? \\\\" OR baz = ?', true, array(58, 104))
Failed asserting that two arrays are equal.
— Expected
+++ Actual
@@ @@
Array (
0 => 58

  • 1 => 104
    + 1 => 105
    )

E:\wwwroot\dbal\tests\Doctrine\Tests\DBAL\SQLParserUtilsTest.php:71

FAILURES!
Tests: 39, Assertions: 44, Failures: 6.
```



 Comments   
Comment by Doctrine Bot [ 15/Apr/15 ]

A related Github Pull-Request [GH-832] was merged:
https://github.com/doctrine/dbal/pull/832





Generated at Sat Apr 18 03:28:24 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.