File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -350,6 +350,13 @@ public function buildPHPConfig()
350
350
} else if (isset ($ config [$ setting ]) && $ config [$ setting ] === 'true ' ) {
351
351
$ config [$ setting ] = true ;
352
352
}
353
+
354
+ // also handle 1 and 0 as booleans
355
+ else if (isset ($ config [$ setting ]) && $ config [$ setting ] === '0 ' ) {
356
+ $ config [$ setting ] = false ;
357
+ } else if (isset ($ config [$ setting ]) && $ config [$ setting ] === '1 ' ) {
358
+ $ config [$ setting ] = true ;
359
+ }
353
360
}
354
361
355
362
return $ config ;
Original file line number Diff line number Diff line change @@ -61,6 +61,22 @@ public function testLoggingLevel(
61
61
}
62
62
63
63
}
64
+
65
+ /**
66
+ * Tests to ensure bools are properly converted from "1" and "0" strings
67
+ *
68
+ * @ticket https://github.com/rollbar/rollbar-php-wordpress/issues/119
69
+ */
70
+ public function testSendMessageTraceBool (){
71
+ $ plugin = $ this ->subject ;
72
+
73
+ $ plugin ->setting ( 'send_message_trace ' , '1 ' );
74
+ $ plugin ->setting ( 'report_suppressed ' , '0 ' );
75
+ $ data = $ plugin ->buildPHPConfig ();
76
+
77
+ $ this ->assertTrue ( $ data ['send_message_trace ' ] );
78
+ $ this ->assertFalse ( $ data ['report_suppressed ' ] );
79
+ }
64
80
65
81
public static function loggingLevelTestDataProvider ()
66
82
{
You can’t perform that action at this time.
0 commit comments