[DCOM-97] phpParser.php and 'use' keyword in anonymous functions Created: 13/Feb/12  Updated: 30/Mar/12  Resolved: 30/Mar/12

Status: Closed
Project: Doctrine Common
Component/s: Annotations
Affects Version/s: 2.1.4
Fix Version/s: 2.2

Type: Bug Priority: Major
Reporter: Thomas Lecarpentier Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None
Environment:

php 5.3, Symfony2, linux



 Description   

When i use the keyword 'use' in anonymous function (like describe in page http://php.net/manual/en/functions.anonymous.php)

Exemple :
...

/**
*

  • Extract event from all events for this day
  • @param int $year
  • @param int $month
  • @param int $day
  • @return ArrayCollection
    */
    public function getEventsForDate($year, $month, $day)
    Unknown macro: { $extractEvents = null; // check if date of item is inside day given $extractEvents = $this->events->filter( function ($item) use ($year, $month, $day) { $leftDate = new \DateTime($year.'-'.$month.'-'.$day.' 00:00'); $rigthDate = new \DateTime($year.'-'.$month.'-'.$day.' +1 day 00:00'); return ( ( $leftDate <= $item->getDateStart() ) && ( $item->getDateStart() < $rigthDate ) ); } ); return $extractEvents; }

...

The phpParser generate error

[ErrorException]
Notice: Undefined offset: -1 in /home/ent/project/Symfony/vendor/doctrine-common/lib/Doctrine/Common/Annotations/PhpParser.php line 117

It try to parse 'use ($year, $month, $day)' as Class



 Comments   
Comment by Fabio B. Silva [ 25/Mar/12 ]

I think this is fixed on the php parser rewrite. (2.2)

Comment by Fabio B. Silva [ 25/Mar/12 ]

Coverage added : https://github.com/doctrine/common/commit/7ec510dbb2279f76a00ecf3f911298879c6ba1a1

I think this could be closed..

Comment by Fabio B. Silva [ 30/Mar/12 ]

Fixed on php parser rewrite. (2.2)





[DCOM-32] Memcache cache relies on deprecated functions Created: 21/Dec/10  Updated: 28/Mar/12  Resolved: 27/Aug/11

Status: Resolved
Project: Doctrine Common
Component/s: Caching
Affects Version/s: 2.0.0-RC2
Fix Version/s: 2.2

Type: Bug Priority: Major
Reporter: Sebastian Hoitz Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: None


 Description   

The method getIds() in MemcacheCache relies on the old "cachedump" stat type.

But as you can read here: http://de2.php.net/manual/en/memcache.getextendedstats.php this has been removed due to security reasons.



 Comments   
Comment by Sebastian Hoitz [ 21/Dec/10 ]

Adding this to memcached before getting the extended stats cachedump fixed this issue for me:

if(!is_int($slabId)) {
    continue;
}
Comment by Guilherme Blanco [ 15/Feb/11 ]

This issue doesn't seen to be valid anymore based on commit of @hobodave on Jan 29th.

Please reopen if it is still valid. I could not reproduce.

Comment by Guilherme Blanco [ 18/Apr/11 ]

Memcache daemon 1.4.5 do not provide cachedump and triggers a couple of issues all around.
Here is a link that gives more information: http://www.pecl.php.net/bugs/bug.php?id=20375&edit=3

We need to think on a workaround since current state of Doctrine 2 is unusable with recent memcache.

Comment by Denis [ 07/May/11 ]

There additionally seems to be a hard-coded limit to the size of the dump:

http://stackoverflow.com/questions/4363904/is-there-any-length-limitation-of-result-by-stats-cachedump-in-memcached

http://lists.danga.com/pipermail/memcached/2007-April/003906.html

Comment by Guilherme Blanco [ 27/Aug/11 ]

Fixed in master by this commit: https://github.com/doctrine/common/commit/486169851ea87b3e14ed45d5bfd7d07b1d41af65

Comment by Przemek Sobstel [ 28/Mar/12 ]

@Guilherme, your fix introduced big performance issue as now for each fetch() call there are always 2 additional calls, which is kind of big overhead. See https://github.com/doctrine/common/pull/125 for details.





[DCOM-93] Add Reflection Abstraction Created: 28/Dec/11  Updated: 03/Jan/12  Resolved: 02/Jan/12

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

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

Issue Links:
Reference
is referenced by DDC-1577 Remove static Reflection dependency f... Resolved

 Description   

The Reflection code in ClassMetadata(Info*)s is getting out of control.

I want to remove the dependency by introducing a ReflectionService interface:

interface ReflectionService
{
    public function getClassShortName($class);
    public function getClassNamespace($class);
    public function getClass($class);
    public function getAccessibleProperty($class, $property);
    public function hasPublicMethod($class, $method);
}

The reflection methods are specifically allowed to return NULL, so that we can create a StaticReflectionService that works without the classes actually existing.



 Comments   
Comment by Benjamin Eberlei [ 28/Dec/11 ]

This issue is referenced in Github Pull-Request GH-89
https://github.com/doctrine/common/pull/89

Comment by Benjamin Eberlei [ 29/Dec/11 ]

Related Pull Request was closed: https://github.com/doctrine/common/pull/89

Comment by Benjamin Eberlei [ 02/Jan/12 ]

Implemented





[DCOM-84] Improve Proxy Naming Created: 01/Dec/11  Updated: 13/Dec/11  Resolved: 12/Dec/11

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

Type: Improvement Priority: Blocker
Reporter: Johannes Schmitt Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

see https://gist.github.com/b493493ecdb22c21590e



 Comments   
Comment by Benjamin Eberlei [ 12/Dec/11 ]

Implemented in https://github.com/doctrine/common/pull/83

Comment by Benjamin Eberlei [ 13/Dec/11 ]

This issue is referenced in Github Pull-Request GH-83
https://github.com/doctrine/common/pull/83





[DCOM-83] Rename ComparableInterface Created: 01/Dec/11  Updated: 12/Dec/11  Resolved: 12/Dec/11

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

Type: Improvement Priority: Minor
Reporter: Johannes Schmitt Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

see https://github.com/doctrine/common/commit/fce661a041aa1dc3634bd1c04cacd684619579fc for reasoning

I didn't want to do it myself, don't know what depends on this.



 Comments   
Comment by Benjamin Eberlei [ 12/Dec/11 ]

Fixed in 3ee9aea





[DCOM-79] Move Lifecycle Events into Doctrine\Common\Persistence\Events Created: 19/Nov/11  Updated: 12/Dec/11  Resolved: 12/Dec/11

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

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


 Comments   
Comment by Benjamin Eberlei [ 12/Dec/11 ]

Implemented in 29dbb7070058c8e7bb81bc5f9ef79d877b058887





[DCOM-85] GH-81: Add Proxy#__load() Created: 03/Dec/11  Updated: 12/Dec/11  Resolved: 12/Dec/11

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

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


 Description   

Pull-Request was automatically synchronized: https://github.com/doctrine/common/pull/81



 Comments   
Comment by Benjamin Eberlei [ 12/Dec/11 ]

Implemented in https://github.com/doctrine/common/pull/83





[DCOM-78] ZendDataCache, Can't use method return value in write context Created: 19/Nov/11  Updated: 19/Nov/11  Resolved: 19/Nov/11

Status: Resolved
Project: Doctrine Common
Component/s: Caching
Affects Version/s: 2.2
Fix Version/s: 2.2

Type: Bug Priority: Major
Reporter: Matti Niemelä Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

On line 70, empty($this->getNamespace()).

empty() works only with variables so you need to assign the namespace to something before using empty().

Fatal error: Can't use method return value in write context in Doctrine/Common/Cache/ZendDataCache.php on line 70



 Comments   
Comment by Benjamin Eberlei [ 19/Nov/11 ]

Fixed





[DCOM-71] Add save get_class() to Debug Util Created: 22/Oct/11  Updated: 23/Oct/11  Resolved: 23/Oct/11

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

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


 Comments   
Comment by Benjamin Eberlei [ 23/Oct/11 ]

Added.





[DCOM-43] Cache Stats Created: 05/Apr/11  Updated: 21/Sep/11  Resolved: 21/Sep/11

Status: Resolved
Project: Doctrine Common
Component/s: Caching
Affects Version/s: 2.0.1
Fix Version/s: 2.2

Type: New Feature Priority: Major
Reporter: Otavio Ferreira Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: None


 Description   

Doctrine should be able to retrieve stats from cache providers, such as Memcache and APC. Stats may list cache hits, cache misses, memory, and so forth.



 Comments   
Comment by Guilherme Blanco [ 21/Sep/11 ]

Implemented this support since this commit: https://github.com/doctrine/common/commit/34e060309ee1ae06f4be610d39d8721d2cfb1b90





[DCOM-58] Having class named Entity in the global namespace, interferes with the new annotation reader. Created: 04/Aug/11  Updated: 07/Sep/11  Resolved: 07/Sep/11

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

Type: Bug Priority: Minor
Reporter: Michael Nielsen Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: None
Environment:

Ubuntu 10.04, Zend Server CE 5.1.0 (Apache 2.2.14, PHP 5.3.5), Doctrine 2.1



 Description   

Having a class named Entity in the global namespace, results in exceptions: "Class xxx is not a valid entity or mapped super class."
The problem is not present in 2.0

The problem:

\Doctrine\Common\Annotations\DocParser.php
line 421: $reflClass = new \ReflectionClass($name);

$name is "Entity", and the reflection finds the non-doctrine Entity-class in the global namespace, and so doesn't find the "@Annotation" it's looking for when it examines the class.

If I force it to reflect on \Doctrine\ORM\Mapping\Entity instead, the next problem is instantiation:

\Doctrine\Common\Annotations\DocParser.php
line 435: return new $name($values);

Forcing that to the right class, brings a "Failed opening required 'Doctrine/ORM/Mapping/Doctrine/ORM/Mapping/Id.php' " - I haven't investigated further (yet at least).

/Michael



 Comments   
Comment by Guilherme Blanco [ 07/Sep/11 ]

Fixed https://github.com/doctrine/common/commit/481083226477b325decfd7202ff59c252397c392





[DCOM-66] Github-PR-55 by shesek: Use stream_resolve_include_path Created: 25/Aug/11  Updated: 28/Aug/11  Resolved: 28/Aug/11

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

Type: Improvement Priority: Major
Reporter: Benjamin Eberlei Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: None


 Description   

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

{username}

:

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

Message:

`Doctrine\Common\ClassLoader::fileExistsInIncludePath` behaves the same as `stream_resolve_include_path`, use that instead when available (PHP >= 5.3.2). It should be faster than doing that manually.



 Comments   
Comment by Guilherme Blanco [ 28/Aug/11 ]

Fixed in trunk.





[DCOM-59] ArrayCollection contains function - switch from in_array to foreach Created: 10/Aug/11  Updated: 28/Aug/11  Resolved: 28/Aug/11

Status: Resolved
Project: Doctrine Common
Component/s: Collections
Affects Version/s: 2.1
Fix Version/s: 2.2

Type: Improvement Priority: Minor
Reporter: PEM Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: None

Attachments: File inArray_vs_foreach.php    

 Description   

The function contains uses in_array to determine if an element provided as parameter is found in the array $this->_elements, and performs a strict comparison.
There might be a way to improve the performances of this function by using a foreach + if

In attachement you can find a small bench file to show the differences between in_array and foreach on object search.
You might want to run the bench with a doctrine Object to verify if this changes anything to the result.
For simple Objects, foreach is much faster when the array has less than 30k elements. Over 30k the difference flattens, and might revert around 50k (meaning that in_array might start being faster when the array has more than 50k entries).

Maybe we could provide two functions, one for smaller than 40-50k items (using foreach), and one for bigger arrays (using in_array) ?



 Comments   
Comment by Guilherme Blanco [ 28/Aug/11 ]

I created more test cases and indeed foreach is around 40% faster than in_array. I applied the change in our suite, this should be available in new versions of Doctrine Common.





Generated at Wed Oct 01 10:45:02 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.