Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-393

BSON encoding should ignore protected/private properties

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.0.0-beta2
    • Affects Version/s: 1.0.0-alpha2
    • Component/s: None
    • None

      derick' BSON serialization document says protected/private properties should be discarded

      If an object is of any other class, without implementing any special interface, serialize as a BSON document. Keep only public properties, and ignore protected and private properties.

      Currently that is not the case:

      <?php
      class special {
        public $public = "public";
        protected $protected = "protected";
        private $private = "private";
      }
      $special = new Special;
      $ret = MongoDB\BSON\toPHP(MongoDB\BSON\fromPHP($special))
      var_dump($ret);
      ?>
      
      object(stdClass)#2 (3) {
        ["public"]=>
        string(6) "public"
        ["protected"]=>
        string(9) "protected"
        ["private"]=>
        string(7) "private"
      }
      

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            bjori Hannes Magnusson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: