Plugin Directory

Changeset 1287135


Ignore:
Timestamp:
11/16/2015 02:33:34 PM (10 years ago)
Author:
clearent1
Message:

After more work and research this weekend, I fixed the Boolean quirkiness once and for all using php ===. I updated the function to force "false" and false to false and "true" and true to true. Successfully ran all tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • clearent-payments/trunk/main.php

    r1285858 r1287135  
    796796            'require_billing_address' => false,
    797797            'require_shipping_address' => false,
    798             'require_csc' => true,
    799             'foo' => 'bar'
     798            'require_csc' => true
    800799        ), $atts );
    801800
     
    808807            //$key = str_replace ( "_" , "-", $key);
    809808
    810             $this->clearent_util->logger("BEFORE: " .  $key . " = " . $value);
     809            $this->clearent_util->logger("BEFORE: " .  $key . " = " . json_encode($value));
    811810
    812811            $newKey = str_replace ( "_" , "-", $key);
    813             $newValue = $value == "false" ? false : $value;
    814             $newValue = $value == "true" ? true : $newValue;
     812
     813            if($value==="true"||$value===true) {
     814                $newValue = true;
     815                $this->clearent_util->logger( "converting to boolean: true" );
     816            }else if($value==="false"||$value===false){
     817                $newValue = false;
     818                $this->clearent_util->logger("converting to boolean: false");
     819            }else{
     820                $newValue = $value;
     821            }
    815822
    816823            $a[$newKey] = $newValue;
    817824
    818825            if($newKey != $key || $newValue != $value) {
    819                 $this->clearent_util->logger(" AFTER: " . $newKey . " = " . $newValue);
     826                $this->clearent_util->logger(" AFTER: " . $newKey . " = " . json_encode($newValue));
    820827            }
    821828
Note: See TracChangeset for help on using the changeset viewer.