summaryrefslogtreecommitdiff
path: root/include/ini.h
diff options
context:
space:
mode:
authorvalmat <ufabiz@gmail.com>2014-04-10 13:04:34 +0600
committervalmat <ufabiz@gmail.com>2014-04-10 13:04:34 +0600
commit14b63ee87dde3688fea7e58fa25b73362117ae11 (patch)
tree0611b2d6ccc4edfb27e350f4925cbe169c2520a7 /include/ini.h
parent1a6b709b8f732ea8a91b07a74f64928e0484b1f6 (diff)
Fixed problem with duplicate names ini entries.
Mentioned https://github.com/CopernicaMarketingSoftware/PHP-CPP/issues/64#issuecomment-39838004 Now in the case of duplication name of ini entriy the new value overrides the old one. Before was incorrect handling of this situation.
Diffstat (limited to 'include/ini.h')
-rw-r--r--include/ini.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/include/ini.h b/include/ini.h
index 2223bee..9d4cbd9 100644
--- a/include/ini.h
+++ b/include/ini.h
@@ -116,9 +116,20 @@ namespace Php {
* @param int module_number
*/
void fill(_zend_ini_entry *ini_entry, int module_number);
-
+ /**
+ * Compare by name
+ * A predicate that takes two arguments of type Ini.
+ * Used when adding elements of type Ini in the container std::set
+ */
+ struct Compare
+ {
+ int operator()(const std::shared_ptr<Ini> &s1, const std::shared_ptr<Ini> &s2) const
+ {
+ return s1->_name.compare(s2->_name);
+ }
+ };
private:
@@ -128,7 +139,7 @@ namespace Php {
}
// ini entry name
- const char* _name;
+ std::string _name;
// ini entry value
std::string _value;