Fatal error: Call to undefined method Google_IO_Curl::authenticatedRequest() - php

When using the described in the Google Contacts API example simple.php, and the Google API PHP Client from GitHub, version 1.0.4-beta, I get the following error:
Fatal error: Call to undefined method Google_IO_Curl::authenticatedRequest()
However, when I change this line...
$val = $client_svc_contacts->getIo()->authenticatedRequest($req);
...to...
$val = $client_svc_contacts->getAuth()->authenticatedRequest($req);
...then it starts working again.
I am using version 1.0.4-beta unmodified except for the addition of the following line at the top of Client.php:
set_include_path(str_replace('/Google','',dirname(__FILE__)));
I recognize that simple.php was written for version 0.6, not v1+, but is the example just out of date compared to the version on GitHub? Or is there something wrong with my implementation?

Found a migration guide that had the answer ...
A new home for authenticatedRequest
The authenticatedRequest method has been moved from the io classes to
the auth classes.
So it appears that replacing getIo() with getAuth() was the correct course of action.

Related

How should I recode my Phalcon v2 PhalconCrypt php to work with v3?

I currently have this in my Phalcon v2 code:
$di->setShared('crypt', function () {
$crypt = new PhalconCrypt();
$crypt->setMode(MCRYPT_MODE_CFB);
$crypt->setKey('mysecretkey');
return $crypt;
});
I am getting this error when running it under Phalcon 3.4.5
PHP Fatal error: Uncaught Error: Call to undefined method Phalcon\Crypt::setMode()
How would I recode it for Phalcon 3.4.5? It isn't clear to me from the documentation how I set the encryption mode in the new version.
Looking at this line in the sourcecode: https://github.com/phalcon/cphalcon/blob/65183349743e899977adc643f103b887612ffe98/phalcon/crypt.zep#L391, it looks like you add it when you set the encryption cipher.
->setCipher('aes-256-cfb')
The documentation says the default cipher is aes-256-cfb, so it looks like you don't need to set the mode manually anymore.
https://docs.phalcon.io/3.4/en/crypt

CakePHP: Fatal error: Call to a member function image()

I'm using the following Helper: http://pastebin.com/qBs2GvG4 in my CakePHP 2.0 app to show a gravatar for a user like so:
<?php $this->Gravatar->image($profile['User']['email'], array('default'=>'mm','size'=>48)); ?>
However it gives the error:
Fatal error: Call to a member function image() on a non-object in /Users/cameron/Sites/social/app/View/Helper/GravatarHelper.php on line 97
Any ideas what the problem is? This worked in my 1.3 app so wondering if something has changed between 1.3 and 2.0 that causes this issue? Thanks
Helpers have slightly different dependencies in 2.0, especially if they require other helpers.I actually made the commits to fix this one in the CakeDC utils plugin.
You can find an updated version of that helper here: https://github.com/CakeDC/utils/blob/2.0/View/Helper/GravatarHelper.php
Looks like the GravatarHelper has a dependency on the HtmlHelper. Is Html in your list of helpers in the controller?

call to undefined function View::fetch cakePHP

I started experimenting with CakePHP version 2.x, I created a default.ctp layout file in View/Layouts inside of which I have codes like:
echo $this->fetch('css');
but I keep getting the following error:
Fatal error: Call to undefined method View::fetch() in C:\wamp\www\.......
I tried creating a block for this css in my view file like:
$this->start('css');
$this->Html->css('home_page', null, array('inline' => false));
$this->end();
But when I do this I get the following error:
Fatal error: Call to undefined method View::start() in C:\wamp\www\.......
Any help please?!!!
Thank you
View::fetch() is available since 2.1, what is your version?
I dont think you need fetch, start, end for including css, you can just use:
$this->Html->css(array('home_page.css'));
//OR
echo $this->fetch('css'); //from version 2.1
Ref: Css CakePHP
The book is a little ahead of the release atm! fetch() is from 2.1 code, which is still alpha.
Try generating a default layout using cake's bake tool and study that to see how 2.0 does it, and make sure do you don't follow bits of the book which say they are new in 2.1 until you are using the 2.1 codebase.

Zend AMF throwing InvocationTargetException

I am trying to make a service call to a php function from flex, through Zend AMF. Most of the functions get called fine, but for one particular function, it throws the following exception:
InvocationTargetException:There was an
error while invoking the operation.
Check your operation inputs or server
code and try invoking the operation
again.
Reason: Fatal error: Call to a member
function getInvokeArguments() on a
non-object in
D:\wamp\www\ZendFramework\library\Zend\Amf\Server.php
on line 328
I am not able to debug through this - has anyone faced any issue like this before, or have any ideas how this can be debugged?
At a quick glance through ZFW's source, this appears to be a bug on their framework.
// There is no check if $this->_table[$qualifiedName] is an object, implements an interface, extends a class, only if it's set (the key exists).
$info = $this->_table[$qualifiedName];
$argv = $info->getInvokeArguments(); // Here's when you get the error.
Source: http://framework.zend.com/code/filedetails.php?repname=Zend+Framework&path=/trunk/library/Zend/Amf/Server.php
I looked in their bug tracker and haven't found anything related to this, perhaps you should open a new issue?
Additionally, you can debug the problem by grabbing the message that Flex is sending to the PHP client and making a test case out of it.
We finally realized that this was a problem in the flex project setup - don't know exactly what it was, but once we deleted and created the project again, things started working fine!

Trying to install Auth for CI: Call to undefined method CI_Loader::setdata()

I have been trying to implement an auth system for Codeigniter. I wanted to save time, though it hasn't succeeded so far.
The system I'm trying to implement is: http://codeigniter.com/wiki/auth/
Currently I have some forms working, but the registration form generates a fatal error:
PHP Fatal error: Call to undefined method CI_Loader::setdata() in /Applications/MAMP/htdocs/CI+Login/system/application/controllers/auth.php on line 159
Anyone has an idea what that is about? Anyone has got this system running?
thx.
EDIT:
The code that generates the error is:
if ($this->config->item('auth_use_security_code'))
$this->authlib->register_init();
$data['countries'] = $this->Usermodel->getCountries();
$this->load->setdata($data);
The problem is that load does not contain a method named setdata, has it in a previous version of CI or what can I make of this?
Try this:
$this->load->vars($data);
or remove this line and use the second parameter of the $this->load->view() function.
$this->load->view($this->config->item('auth_register_view'),$data);

Categories