Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: Using $this when not in object context #1

Closed
eReader opened this issue Feb 3, 2014 · 1 comment
Closed

Fatal error: Using $this when not in object context #1

eReader opened this issue Feb 3, 2014 · 1 comment

Comments

@eReader
Copy link

eReader commented Feb 3, 2014

Hello,

I'm very glad I found your library as I've been looking for exactly something like that to build an Amazon-based application for my website. Now, I'm trying to deploy your library on my server, but everything I get is a PHP warning which afaik is usually caused by calling a non-static method statically:

Fatal error: Using $this when not in object context in /home/some_dir/Amazon-master/index.php on line 28

Could you please push an working version of this library as I see it works just fine on your site.

Thanks in advance,

Alex

@chopin2256
Copy link
Owner

There is an error in my index file, but the library works correctly. Here is what you can do to fix the error:

Change:
$result .= $this->amazonLayout($i, $amazon);

To.

$result .= amazonLayout($i, $amazon);
Basically, I put a function called amazonLayout (its just a suggestion), and I called it incorrectly with the $this variable. The reason this is incorrect, is because $this only works on objects, and amazonLayout is simply a function, not within a class.
Date: Mon, 3 Feb 2014 12:42:15 -0800
From: notifications@github.com
To: Amazon@noreply.github.com
Subject: [Amazon] Fatal error: Using $this when not in object context (#1)

Hello,

I'm very glad I found your library as I've been looking for exactly something like that to build an Amazon-based application for my website. Now, I'm trying to deploy your library on my server, but everything I get is a PHP warning which afaik is usually caused by calling a non-static method statically:

Fatal error: Using $this when not in object context in /home/some_dir/Amazon-master/index.php on line 28

Could you please push an working version of this library as I see it works just fine on your site.

Thanks in advance,

Alex


Reply to this email directly or view it on GitHub.

@eReader eReader closed this as completed May 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants