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()
350350 } else if (isset ($ config [$ setting ]) && $ config [$ setting ] === 'true ' ) {
351351 $ config [$ setting ] = true ;
352352 }
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+ }
353360 }
354361
355362 return $ config ;
Original file line number Diff line number Diff line change @@ -61,6 +61,22 @@ public function testLoggingLevel(
6161 }
6262
6363 }
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+ }
6480
6581 public static function loggingLevelTestDataProvider ()
6682 {
You can’t perform that action at this time.
0 commit comments