Uploaded image for project: 'Couchbase PHP client library'
  1. Couchbase PHP client library
  2. PCBC-358

$result->value is a string, not an object

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • None
    • 2.0.7
    • docs
    • Security Level: Public

    Description

      When I execute the example,

      $result is:

      object(CouchbaseMetaDoc)#14 (4) {
      ["error"]=>
      NULL
      ["value"]=>
      string(1256) "

      {"name":"Juleøl","abv":5.9,"ibu":0.0,"srm":0.0,"upc":0,"type":"beer","brewery_id":"aass_brewery","updated":"2010-07-22 20:00:20","description":"The Norwegian Juleøl can be traced back more that 1000 years. The \"Gulatinglov\", one of the first Norwegian laws written in the 9th century, has a chapter on brewing beer for the midwinter celebration in January. The festivities were held to celebrate the Norse Gods; Odin, Frøy and Njord as well as the \"return\" of the sun.\r\nFurthermore, the tradition was adopted by the Vikings that brought Christianity to the country between 1000 and 1100. They moved the tradition to December in connection with the birth of Jesus. \r\nIn those days a farmer that did not set aside the best crop to produce the beer could lose his house to the king and the church. The law has been changed, but we promise you that we still use the very best of malt, yeast, hops, and pure Norwegian water to produce our Christmas beer.\r\n\r\nAass Juleøl has won most of the Norwegian Juleøl taste test conducted over time. For those of you that know what \"lutefisk\" is, Aass Juleøl is the perfect choice of beverage to this traditional Norwegian dish.","style":"Dark American-Belgo-Style Ale","category":"North American Ale"}

      "
      ["flags"]=>
      int(67108864)
      ["cas"]=>
      resource(35) of type (CouchbaseCAS)
      }

      You see that "value" is a string and therefore not directly accessible via getter methods (echo $doc->name . ', ABV: ' . $doc->abv . "\n"

      I have to do a $doc = json_decode($result->value); to get the sample running

      Reporter: Sebastian Schwaiger
      E-mail: ses@principiamentis.com

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            brett19 Brett Lawson
            docsite-collector Docs Site Collector
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty