Issues

ZF-12155: Zend_Reflection_File doesn't handle complex parsed variable syntax properly

Description

Zend_Reflection_File::_reflect() doesn't handle T_CURLY_OPEN | T_DOLLAR_OPEN_CURLY_BRACES as $openBraces given a parsing error.

I fixed the problem adding:

class: Zend_Reflection_File 339: switch ($type) { 340: // Special curly open situations 341: case T_CURLY_OPEN | T_DOLLAR_OPEN_CURLY_BRACES : 342: $openBraces++; 343: continue;

Comments

Can you provide a sample of code which causes Zend_Reflection_File to misbehave?

function test ( ) { $hello = 'hello'; $world = 'world';

$phrase = "{$hello} {$world}"; }

function test2 () { // you wont see this function after parsing because {$ doesn't match a common { but } does. }

Attached reproducing unit test

Attached fix and updated test

Fixed in trunk (1.12.0): r24803

No ZF2 PR issued, as this feature is incomplete in ZF2. See: https://github.com/zendframework/zf2/…