Bunch of undefined indexes after update to 2.6.9 stable
again db model is changing bunch of notices for Undefined index: from
https://github.com/ThemeFuse/Unyson/blob/master/framework/helpers/class-fw-db-options-model.php#L199
and
https://github.com/ThemeFuse/Unyson/blob/master/framework/helpers/class-fw-db-options-model.php#L147
what is changed this time?
default vale are set , what now?
@moldcraft the reference removal messed up the indexes on my end https://github.com/ThemeFuse/Unyson/pull/2180
This also happens for me

I'm also able to confirm that this is a thing.
@WPJobs how are you calling that maintenance_mode variable , can yo show me please. Thnx , without reference the fw_akg seem like overriding second param unless we are doing something funky when calling the options.
So I can delete this repository?
How to test/reproduce? I don't have any notices
Maybe because I use PHP 7 ?
So I can delete this repository?
dont get mad , looks like many of us did not see the approval for this version
look at my email http://prntscr.com/dd5n0c
and when you changed the ref I changed the same thing on the copy of your function thz_akg and had no issues with it , so I assumed that the core one would be ok.
as for php version I am on 7.0.4
I dont know how to reproduce it thus I asked @WPJobs ,
I will try to find a way now . few min
look at my email http://prntscr.com/dd5n0c
I have disabled email notifications, I use only notifications on github site, they are grouped by repository

this might help to test , add to functions.php
function thz_test_option($id = null,$default= null){
global $thz_posthook;
if($thz_posthook){
return fw_get_db_post_option(get_the_ID(),$id ,$default);
}else{
return fw_get_db_settings_option($id ,$default);
}
}
and this in hooks
function _thz_action_load_options_hooks() {
global $thz_posthook;
$thz_posthook = false;
if ( !is_admin() ) {
$post_options = fw_get_db_post_option(get_the_ID(),'custom_post_options/0',array());
if(!empty ($post_options)){
$thz_posthook = true;
}
}
}
add_action( 'wp', '_thz_action_load_options_hooks' );
than call some option via
$someoption = thz_test_option ('mustbe/an/array', array());
if(!empty($someoption )){
return 'something';
}
undefined indexes come from fw_get_db_settings_option and not from fw_get_db_post_option so far I can tell , not sure why.
and test that on blog category page
function _test_action_debug() {
fw_print(fw_get_db_post_option(get_the_ID(), 'hello'));
fw_print(fw_get_db_settings_option('hello'));
}
add_action('wp_head', '_test_action_debug');
add_action('admin_notices', '_test_action_debug');
still no warning.
@danyj So when you add back the reference the warning is gone?
easier test
add this in theme/static.php
// bugs
$someoption= fw_get_db_settings_option('someoption/something',array());
$someoption2= fw_get_db_post_option(get_the_ID(),'someoption/something',array());
// no bugs
$someoption3= fw_get_db_settings_option('someoption',array());
$someoption4= fw_get_db_post_option(get_the_ID(),'someoption',array());
yes when I add ref back error is gone
dont use actual existing options , use as something
@danyj Thank you!
Notice: Undefined index: someoption in /.../wp-content/plugins/unyson/framework/helpers/class-fw-db-options-model.php on line 147
function _test() {
fw_get_db_settings_option('someoption/something', array());
fw_get_db_post_option(get_the_ID(), 'someoption/something', array());
}
add_action('admin_notices', '_test');
dont forget to test with number values like
function _test() {
fw_get_db_settings_option('someoption/something/0', array());
fw_get_db_post_option(get_the_ID(), 'someoption/something/1', array());
}
add_action('admin_notices', '_test');
function _test() {
function _test_value($value) {}
function _test_reference(&$value) {}
$arr = array('existing_key' => true);
fw_print(1, $arr);
_test_value($arr['existing_key']);
_test_value($arr['not_existing_key']);
fw_print(2, $arr);
_test_reference($arr['existing_key']);
_test_reference($arr['not_existing_key']); // This will create the key!
fw_print(3, $arr);
_test_value($arr['existing_key']);
_test_value($arr['not_existing_key']);
fw_print(4, $arr);
}
add_action('admin_notices', '_test');


http://stackoverflow.com/a/2030924/594423
by ref is overriding the existing array within the function