Retention setting bug
-
I’m working on making some tweaks to this plugin to make it work correctly for my Multisite install, and I ran into a bug with the dh-do-retain option.
dreamobjects/lib/settings.php, line 399 (as of version 4.0 of the plugin)
if ( $input !== $retain || !array_key_exists( $retain, $retainarray ) ) {
You’re using
array_key_exists
to check for the value in the keys of $retainarray, which can be found back in a function on line 75.$retain = array('1','2','5','10','15','30','60','90','all');
This happens to validate lower numbers just fine because
array_key_exists
looks at the keys in $retainarray, which is just 0-8.Instead, you’re gonna want to use
in_array
, so it actually checks to see if the input is in the array itself. So, line 399 should read:if ( $input !== $retain || !in_array( $retain, $retainarray ) ) {
- The topic ‘Retention setting bug’ is closed to new replies.