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

HelloWorld sample code broken for php SDK

    XMLWordPrintable

Details

    Description

      Please route to the php SDK dev team.

      If you follow the instruactions, and take the sample Hello World code for the php SDK from:
      http://developer.couchbase.com/documentation/server/4.0/sdks/php-2.0/hello-couchbase.html

      Running this leads to an error:
      tom@haswell:~/cb/code/php$ php hello-couchbase.php
      PHP Notice: Trying to get property of non-object in /home/tom/cb/code/php/hello-couchbase.php on line 14
      PHP Notice: Trying to get property of non-object in /home/tom/cb/code/php/hello-couchbase.php on line 14
      , ABV:

      It appears this can be resolved by replacing the line:
      $doc = $result->value;

      With the line:
      $doc = json_decode($result->value);

      Not sure if the format type detection is supposed to be automatically detected by JSON, but it doesn't appear to work out the box.

      Version info:
      PHP 5.5.9-1ubuntu4.14 (cli) (built: Oct 28 2015 01:34:46)
      Copyright (c) 1997-2014 The PHP Group
      Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
      with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

      From phpinfo():
      couchbase

      Version => 2.1.0

      libcouchbase info:

      ./x86_64-linux-gnu/libcouchbase.so.2
      ./x86_64-linux-gnu/pkgconfig/libcouchbase.pc
      ./x86_64-linux-gnu/libcouchbase.so.2.0.33
      ./x86_64-linux-gnu/libcouchbase.so
      ./x86_64-linux-gnu/libcouchbase_libevent.so
      ./php5/20121212/couchbase.so

      Reporter: Tom
      E-mail: tom@chaoscube.xyz

      Attachments

        Issue Links

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

          Activity

            People

              avsej Sergey Avseyev
              docsite-collector Docs Site Collector
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty