------------------------------------------------------------
revno: 1080
committer: Roger Martin <[email protected]>
branch nick: aikiframework
timestamp: Mon 2012-02-06 21:31:23 +0100
message:
config_get can read not serialize data
modified:
libs/config.php
--
lp:aikiframework
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk
Your team Aiki Framework Developers is subscribed to branch lp:aikiframework.
To unsubscribe from this branch go to
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk/+edit-subscription
=== modified file 'libs/config.php'
--- libs/config.php 2012-02-04 23:36:18 +0000
+++ libs/config.php 2012-02-06 20:31:23 +0000
@@ -172,6 +172,16 @@
return $returnString ? implode("/", $ret) : $ret;
}
+
+
+ /**
+ * unserialize a value only if it seems like a serialized value
+ **/
+
+ private function _unserialize( $what ){
+ return $what=="N;" || preg_match ("/^[abidsO]:/", $what ) ? unserialize($what) : $what;
+ }
+
/**
* get a setting
*
@@ -188,6 +198,7 @@
* @global $aiki
*/
+
function get($setting, $default=false, $selector="CURRENT") {
global $db, $config, $aiki;
@@ -210,7 +221,7 @@
if ( is_null($value) ) {
return $default;
}
- $ret= unserialize($value);
+ $ret= $this->_unserialize($value);
$config[$setting]= $ret;
return $ret;
}
@@ -223,7 +234,7 @@
if (is_array($values)) {
foreach ($values as $value) {
if ($aiki->match_pair($value->config_selector, $site, $view, $language)) {
- $ret= unserialize($value->config_value);
+ $ret= $this->_unserialize($value->config_value);
$config[$setting]= $ret;
return $ret;
}
_______________________________________________
Mailing list: https://launchpad.net/~aikiframework-devel
Post to : [email protected]
Unsubscribe : https://launchpad.net/~aikiframework-devel
More help : https://help.launchpad.net/ListHelp