Problem with PHP SDK, The second argument should be either an array or an object |
![]() ![]() |
Problem with PHP SDK, The second argument should be either an array or an object |
| Armand Brahaj |
Sep 15 2009, 01:10 PM
Post
#1
|
|
Group: Members Posts: 4 |
I am trying to start testing the PHP SDK but I cannot get much out of it. It seems strange error and I wonder if anyone is having the same problems:
I have a simple code in PHP QUOTE <?php When I call this file in the browser I get: <br /> <b>Warning</b>: array_key_exists() [<a href='function.array-key-exists'>function.array-key-exists</a>]: The second argument should be either an array or an object in <b>/home/lajme2/public_html/yahoo/yosdk/lib/Yahoo.inc</b> on line <b>1507</b><br /> <br /> <b>Warning</b>: array_key_exists() [<a href='function.array-key-exists'>function.array-key-exists</a>]: The second argument should be either an array or an object in <b>/home/lajme2/public_html/yahoo/yosdk/lib/Yahoo.inc</b> on line <b>1498</b><br /> <br /> <b>Warning</b>: Cannot modify header information - headers already sent by (output started at /home/lajme2/public_html/yahoo/yosdk/lib/Yahoo.inc:1507) in <b>/home/lajme2/public_html/yahoo/yosdk/lib/Yahoo.inc</b> on line <b>341</b><br /> Any suggestions as what might be wrong? I checked the Line 1507 and it seems a normal call on a return from the function below: QUOTE function hasAccessToken() { |
|
|
|
| Jonathan LeBlanc |
Sep 15 2009, 02:21 PM
Post
#2
|
|
Group: Yahoos Posts: 942 |
Try removing the app id from the require_session call (only input the first two arguments for consumer and secret keys)...see if that works. If not, make sure that nothing else is being echoed out to the screen (like spaces) because the header call will fair with that error if that's the case.
Jonathan LeBlanc Technology Evangelist Yahoo! Developer Network Twitter: jcleblanc This post has been edited by Jonathan LeBlanc: Sep 15 2009, 02:22 PM |
|
|
|
| Armand Brahaj |
Sep 15 2009, 02:28 PM
Post
#3
|
|
Group: Members Posts: 4 |
Try removing the app id from the require_session call (only input the first two arguments for consumer and secret keys)...see if that works. If not, make sure that nothing else is being echoed out to the screen (like spaces) because the header call will fair with that error if that's the case. Thank you for the reply. I tried removing and still the same error. I also tried the code from: http://developer.yahoo.com/yos/code_exs/my...ource_code.html mysocial.php (by adding ofcourse a new API Key (OAuth consumer key)). This time I tried in another server and still the same error (first try on Debian , this time on CentOS). Can someone confirm that the examples work fine? |
|
|
|
| Armand Brahaj |
Sep 15 2009, 02:30 PM
Post
#4
|
|
Group: Members Posts: 4 |
Thank you for the reply. Ah, in the mysocial.php the code is: $yahoo_session = YahooSession::requireSession(API_KEY, SHARED_SECRET); |
|
|
|
| Jonathan LeBlanc |
Sep 16 2009, 07:27 AM
Post
#5
|
|
Group: Yahoos Posts: 942 |
That's odd - the code that you are using is the same that I am for one of you apps. Can you try the following please:
1. Remove all content for the app with the exception of the following. Test again and see if that loads: CODE 2. Do you have the most recent version of the PHP SDK? Just to make sure can you get the files directly from: http://github.com/yahoo/yos-social-php Try those two and see if it loads up. - Jon This post has been edited by Jonathan LeBlanc: Sep 16 2009, 07:27 AM |
|
|
|
| Jonathan LeBlanc |
Sep 16 2009, 09:04 AM
Post
#6
|
|
Group: Yahoos Posts: 942 |
I was just speaking with one of my colleagues who brought up an issue that he gets when using the PHP SDK - one that produces errors like what you are seeing. It appears that in some instances this problem may come from the lack of specifying a session. If those previous two suggestions don't work, try adding the following to the top of the PHP block:
session_start(); That may be the issue. - Jon |
|
|
|
| Armand Brahaj |
Sep 16 2009, 11:46 PM
Post
#7
|
|
Group: Members Posts: 4 |
I was just speaking with one of my colleagues who brought up an issue that he gets when using the PHP SDK - one that produces errors like what you are seeing. It appears that in some instances this problem may come from the lack of specifying a session. If those previous two suggestions don't work, try adding the following to the top of the PHP block: Hello Jon, I confirm that session_start(); was the problem. Now I can make use of the rest of the files. Thank you for your support! rgds, Armand |
|
|
|
| Jonathan LeBlanc |
Sep 17 2009, 06:03 AM
Post
#8
|
|
Group: Yahoos Posts: 942 |
Not a problem - thank you for letting me know what it was. Since this is the first time I've heard of this issue I'll try to find some way of integrating it into some FAQs in case anyone runs into the same blocker.
- Jon |
|
|
|
| Bing |
Oct 4 2009, 02:41 AM
Post
#9
|
|
Group: Members Posts: 1 |
The same issue met, and resolved:)
Thanks so much! |
|
|
|
| Jonathan LeBlanc |
Oct 4 2009, 07:36 AM
Post
#10
|
|
Group: Yahoos Posts: 942 |
Bing, there was a recent revision to the PHP SDK to fix an OAuth issue. Can you please try downloading the SDK again from http://www.github.com/yahoo and give try again?
That may solve the issue. - Jon |
|
|
|
![]() ![]() |