Issues

ZF-7184: Zend_CodeGenerator_Php_File::fromReflection receives Warning: Illegal offset type in...

Issue Type: Bug Created: 2009-07-02T09:50:32.000+0000 Last Updated: 2009-09-18T07:39:40.000+0000 Status: Resolved Fix version(s): - 1.9.0 (31/Jul/09)

Reporter: Jayson Santos dos Reis (jaysonsantos) Assignee: Ralph Schindler (ralph) Tags: - Zend_CodeGenerator

Related issues: Attachments:

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

Comments

Posted by Ralph Schindler (ralph) on 2009-07-10T09:34:20.000+0000

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

<pre class="highlight">
<?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

<pre class="highlight">
~/tmp/test-codegenerator$ cat test.php 
<?php


class Foo
{

   public $bar = 5;

}

Posted by Jayson Santos dos Reis (jaysonsantos) on 2009-07-10T11:54:13.000+0000

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');

Posted by Ralph Schindler (ralph) on 2009-07-10T15:31:43.000+0000

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

Posted by Jayson Santos dos Reis (jaysonsantos) on 2009-07-10T18:19:23.000+0000

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

Posted by Benjamin Eberlei (beberlei) on 2009-09-18T07:39:40.000+0000

This seems to be fixed in 1.9

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts