Skip to content

Commit

Permalink
Merge pull request #829 from kjdev/master
Browse files Browse the repository at this point in the history
parsing of ini files.
  • Loading branch information
Phalcon committed Jul 12, 2013
2 parents 660ba13 + 8a8509e commit a9069f1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ext/config/adapter/ini.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,23 @@ PHP_METHOD(Phalcon_Config_Adapter_Ini, __construct){
PHALCON_GET_HKEY(section, ah0, hp0);
PHALCON_GET_HVALUE(directives);

if (unlikely(Z_TYPE_P(directives) != IS_ARRAY)) {
Z_ADDREF_P(directives);
if (phalcon_array_update_zval(&config, section, &directives, 0 TSRMLS_CC) != SUCCESS) {
Z_DELREF_P(directives);
}
zend_hash_move_forward_ex(ah0, &hp0);
continue;
}

phalcon_is_iterable(directives, &ah1, &hp1, 0, 0);

if (zend_hash_num_elements(ah1) == 0) {
phalcon_array_update_zval(&config, section, &directives, 0 TSRMLS_CC);
zend_hash_move_forward_ex(ah0, &hp0);
continue;
}

while (zend_hash_get_current_data_ex(ah1, (void**) &hd, &hp1) == SUCCESS) {

PHALCON_GET_HKEY(key, ah1, hp1);
Expand Down

0 comments on commit a9069f1

Please sign in to comment.