Zend Framework

Zend_CodeGenerator_Php_File::fromReflection receives Warning: Illegal offset type in...

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: N/A N/A
  • Resolution: Fixed
  • Affects Version/s: 1.8.4
  • Fix Version/s: 1.9.0
  • Component/s: Zend_CodeGenerator
  • Labels:
    None

Description

When I call something like:
require 'test.php';
$file = new Zend_Reflection_File('test.php');
$a = Zend_CodeGenerator_Php_File::fromReflection($file);

I'm receiving this message:

Warning: Illegal offset type in /usr/share/php/Zend/CodeGenerator/Php/Class.php on line 294

Call Stack:
0.0008 106028 1. {main}() /home/jayson/Projetos/PHP_Organizer/organizer.php:0
0.0279 948648 2. Zend_CodeGenerator_Php_File::fromReflection() /home/jayson/Projetos/PHP_Organizer/organizer.php:188
0.0319 1131984 3. Zend_CodeGenerator_Php_Class::fromReflection() /usr/share/php/Zend/CodeGenerator/Php/File.php:153
0.0323 1134216 4. Zend_CodeGenerator_Php_Class->setProperties() /usr/share/php/Zend/CodeGenerator/Php/Class.php:127
0.0323 1134288 5. Zend_CodeGenerator_Php_Class->setProperty() /usr/share/php/Zend/CodeGenerator/Php/Class.php:270


Warning: Illegal offset type in /usr/share/php/Zend/CodeGenerator/Php/Class.php on line 294

Call Stack:
0.0008 106028 1. {main}() /home/jayson/Projetos/PHP_Organizer/organizer.php:0
0.0279 948648 2. Zend_CodeGenerator_Php_File::fromReflection() /home/jayson/Projetos/PHP_Organizer/organizer.php:188
0.0319 1131984 3. Zend_CodeGenerator_Php_Class::fromReflection() /usr/share/php/Zend/CodeGenerator/Php/File.php:153
0.0323 1134216 4. Zend_CodeGenerator_Php_Class->setProperties() /usr/share/php/Zend/CodeGenerator/Php/Class.php:127
0.0324 1134360 5. Zend_CodeGenerator_Php_Class->setProperty() /usr/share/php/Zend/CodeGenerator/Php/Class.php:270

Warning: Illegal offset type in /usr/share/php/Zend/CodeGenerator/Php/Class.php on line 294

Call Stack:
0.0008 106028 1. {main}() /home/jayson/Projetos/PHP_Organizer/organizer.php:0
0.0279 948648 2. Zend_CodeGenerator_Php_File::fromReflection() /home/jayson/Projetos/PHP_Organizer/organizer.php:188
0.0319 1131984 3. Zend_CodeGenerator_Php_Class::fromReflection() /usr/share/php/Zend/CodeGenerator/Php/File.php:153
0.0323 1134216 4. Zend_CodeGenerator_Php_Class->setProperties() /usr/share/php/Zend/CodeGenerator/Php/Class.php:127
0.0325 1134360 5. Zend_CodeGenerator_Php_Class->setProperty() /usr/share/php/Zend/CodeGenerator/Php/Class.php:270

I tried others PHP files and that error occurs in all that.

Best Regards
Jayson Reis

Activity

Hide
Ralph Schindler added a comment -

I cannot reproduce this, are you running against trunk?

can you tell me what your test.php looks like?

my files look like this:

codegen.php

<?php
error_reporting(E_ALL | E_STRICT);
set_include_path('/Users/ralphschindler/Projects/ZFStandardTrunk/library');
require_once 'Zend/Reflection/File.php';
require_once 'Zend/CodeGenerator/Php/File.php';

require 'test.php';
$file = new Zend_Reflection_File('test.php');
$a = Zend_CodeGenerator_Php_File::fromReflection($file);

echo $a->getClass()->getProperty('bar')->getDefaultValue()->getValue();

test.php

~/tmp/test-codegenerator$ cat test.php 
<?php


class Foo
{

   public $bar = 5;

}
Show
Ralph Schindler added a comment - I cannot reproduce this, are you running against trunk? can you tell me what your test.php looks like? my files look like this: codegen.php
<?php
error_reporting(E_ALL | E_STRICT);
set_include_path('/Users/ralphschindler/Projects/ZFStandardTrunk/library');
require_once 'Zend/Reflection/File.php';
require_once 'Zend/CodeGenerator/Php/File.php';

require 'test.php';
$file = new Zend_Reflection_File('test.php');
$a = Zend_CodeGenerator_Php_File::fromReflection($file);

echo $a->getClass()->getProperty('bar')->getDefaultValue()->getValue();
test.php
~/tmp/test-codegenerator$ cat test.php 
<?php


class Foo
{

   public $bar = 5;

}
Hide
Jayson Santos dos Reis added a comment -

Hello Ralph.
I'm running against version 1.8.4.
This is the code.

test.php
<?php
class Test
{
public $foo;

public function foo2($bar, $baz)

{ return $bar + $baz; }

}

testReflection.php
<?php
require_once 'test.php';
require_once 'Zend/Reflection/File.php';
require_once 'Zend/CodeGenerator/Php/File.php';
Zend_CodeGenerator_Php_File::fromReflectedFileName('test.php');

Show
Jayson Santos dos Reis added a comment - Hello Ralph. I'm running against version 1.8.4. This is the code. test.php <?php class Test { public $foo; public function foo2($bar, $baz) { return $bar + $baz; } } testReflection.php <?php require_once 'test.php'; require_once 'Zend/Reflection/File.php'; require_once 'Zend/CodeGenerator/Php/File.php'; Zend_CodeGenerator_Php_File::fromReflectedFileName('test.php');
Hide
Ralph Schindler added a comment -

Can you try running against trunk? There have been new features over the past few weeks.

Show
Ralph Schindler added a comment - Can you try running against trunk? There have been new features over the past few weeks.
Hide
Jayson Santos dos Reis added a comment -

Hello Ralph, running against trunk that work's fine.
Do you know when that trunk will be release as stable ?
Best Regards
Jayson Reis

Show
Jayson Santos dos Reis added a comment - Hello Ralph, running against trunk that work's fine. Do you know when that trunk will be release as stable ? Best Regards Jayson Reis
Hide
Benjamin Eberlei added a comment -

This seems to be fixed in 1.9

Show
Benjamin Eberlei added a comment - This seems to be fixed in 1.9

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: