mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 19:53:56 +00:00
Number translate bug PHP Fatal error: Uncaught Error: Cannot access private property xml (#7656)
* Number translation through exception unable load private property
PHP Fatal error: Uncaught Error: Cannot access private property
Under class defined
```
private $xml;
```
You can't access this properly under private constant
* Fix private property access under class for import()
PHP Fatal error: Uncaught Error: Cannot access private property.
This commit is contained in:
@@ -32,15 +32,16 @@
|
|||||||
|
|
||||||
if ($num_rows == 0) {
|
if ($num_rows == 0) {
|
||||||
//get the array of xml files
|
//get the array of xml files
|
||||||
$xml_list = glob($_SERVER["PROJECT_ROOT"] . "/*/*/resources/switch/conf/number_translation/*.xml");
|
$dir = dirname(__DIR__, 2) . "/app/number_translations/resources/switch/conf/number_translation";
|
||||||
|
|
||||||
//number_translation class
|
//number_translation class
|
||||||
$number_translation = new number_translations;
|
$number_translation = new number_translations;
|
||||||
|
|
||||||
//process the xml files
|
//process the xml files
|
||||||
|
$xml_list = array_diff(scandir($dir), array('..', '.'));
|
||||||
foreach ($xml_list as $xml_file) {
|
foreach ($xml_list as $xml_file) {
|
||||||
//get and parse the xml
|
//get and parse the xml
|
||||||
$number_translation->xml = file_get_contents($xml_file);
|
$file_content = file_get_contents($dir . '/' . $xml_file);
|
||||||
|
$number_translation->getxml($file_content);
|
||||||
$number_translation->import();
|
$number_translation->import();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,6 +87,16 @@ class number_translations {
|
|||||||
return $this->database->select($sql, $parameters, 'column') != 0 ? true : false;
|
return $this->database->select($sql, $parameters, 'column') != 0 ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Load properly private property xml
|
||||||
|
* @param string $file_content content of template files.
|
||||||
|
*/
|
||||||
|
public function getxml($file_content) {
|
||||||
|
$this->xml = $file_content;
|
||||||
|
return $this->xml;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Imports a number translation from either XML or JSON format.
|
* Imports a number translation from either XML or JSON format.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user