Summary

Hi, (sry for my english :p -> i'm french ! )

I got a problem with JRegistryFormatPHP::stringToObject() because this method just return true without parsing the data contained in my php file.

For exemple considering this as the php file :

<?php
class MyClass {
var $foo = 'bar';
}
?>

Now i want to get data from the file, so i use JRegistry like this :

jimport('joomla.filesystem.file');

$file = JPATH_COMPONENT.DS.'config.php';

$registry =& JFactory::getConfig();
$registry->loadFile($file, 'PHP', 'eConfig');


As you can see i use the namespace "eConfig".

After that i just have to do this to get my data :

$foo = $registry->getValue('eConfig.foo');

But when i call JRegistry::loadFile(), this method use JRegistryFormatPHP::stringToObject() to parse the data contain in the php file and as i said before this method return true.

So the namespace eConfig inside $registry contain data = true instead of be like this :

[eConfig] => Array
(
[data] => stdClass Object
(
[foo] => bar
)
)

I'm not sure this is a bug, but i can't find any way to get it work as it have to work.

In advance Thank you for your answers ^^

Opened On:
7 May 2010, 9:13 by Vincent Le Henaff
Status:
Open

Filed Under

  • Developer
  • Firefox 3.x
  • Joomla! Libraries
  • MySQL 4.0.x
  • PHP 4.4.x

Responses

Posted on 2 Feb 2014, 7:12 by Joseph Cardwell

Confirmed that in J3.2 JRegistryFormatPHP::stringToObject contains only the following code:

public function stringToObject($data, array $options = array()) { return true; }

 

Is this intentional? Its very misleading.