Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your <code>$gdClient</code> variable is intanciated outside of the <code>createPublishedPost</code> function :</p> <pre><code>$gdClient = new Zend_Gdata($client); </code></pre> <p>Inside a function, the variables that have been defined outside of it don't exist by default. <br>About that, you can take a look at the <a href="http://php.net/manual/en/language.variables.scope.php" rel="nofollow noreferrer">Variable scope</a> page of the manual.</p> <p>This means <code>$gdClient</code> doesn't exist inside the function ; hence, it is <code>null</code> ; so, not an object -- which explains the error message you are getting.</p> <p><br> To check that by yourself, you can use</p> <pre><code>var_dump($gdClient); </code></pre> <p>at the beginning of the function : it will allow you to see what kind of data it is ; if it's not an instance of the class you are willing to use, it's not a good sign ;-)</p> <p><br> You might want to either :</p> <ul> <li>pass that variable as a parameter to the <code>createPublishedPost</code> function</li> <li>or declare it as <a href="http://php.net/manual/en/language.variables.scope.php#language.variables.scope.global" rel="nofollow noreferrer"><code>global</code></a> inside the function <em>(so the function can "see" the variable as declared outside)</em></li> </ul> <p>The first solution is probably the cleanest one, I think ;-)</p> <p><br> As a sidenote, you might want to configure your <a href="http://php.net/manual/en/errorfunc.configuration.php#ini.error-reporting" rel="nofollow noreferrer"><code>error_reporting</code></a> level (<a href="http://php.net/manual/en/function.error-reporting.php" rel="nofollow noreferrer">see also</a>), so you get an <code>E_NOTICE</code> when you are using a variable that is not declared -- in this case, you should have gotten one, for instance ;-) <br><em>You might also want to enable <a href="http://php.net/manual/en/errorfunc.configuration.php#ini.display-errors" rel="nofollow noreferrer"><code>display_errors</code></a>, on your development machine, if it's not already on -- seems to be, as you got the Fatal error message</em></p> <p>It might seem a bit annoying at the beginning, but, once you get used to it, it is really great : allow to detect that kind of stuff a lot quicker ;-) <br>And it also helps detect typos in variable names ^^ <br>And it makes you code way cleaner !</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload