Jump to content
Claudia M

PHP Warning

Recommended Posts

What does this PHP Warning mean?

[22-Nov-2019 19:23:19 America/Louisville] PHP Warning:  No callback method defined. in /home/claudias/public_html/classes/cubecart.class.php on line 321

Here is my code in classes/cubecart.class.php  lines 317 -328

 default:

                    foreach ($GLOBALS['hooks']->load('class.cubecart.construct.g_switch') as $hook) {

                        include $hook;

                    }

                    trigger_error('No callback method defined.', E_USER_WARNING);

                    httpredir('index.php');

            }

        } elseif (isset($_GET['_a']) && !empty($_GET['_a'])) {

            //Clear cart

            if (isset($_GET['empty-basket'])) {

                $GLOBALS['cart']->clear();

                httpredir(currentPage(array('empty-basket'), array('_a' => 'basket')));

Thanks for any and all explanations and help

Claudia

Share this post


Link to post
Share on other sites

A CubeCart URL of the form, index.php?_g=getSomething, it is usually the case that there is something happening in the page on your browser working behind the scenes.

In this case, getSomething is a request that CubeCart does not know what to do with.

Unfortunately, the error does not mention what item of information CubeCart was supposed to get.

As of CC628, the information CubeCart knows what to calculate and send back to the web browser are:

ajax_cookie_consent: to log when the customer agreed to accept cookies
ajax_price_format: respond with a properly formatted price with currency symbol, etc
ajax_mail: respond with whether or not this email address is available to use
ajaxadd: respond with new HTML to replace the existing Shopping Basket HTML code, having newly added an item
remote: respond with the result of making a module perform some action - usually check the validity of a transaction in progress with the payment processor

There is a hook to be able to use additional getSomething code snippets or plugins.

So, if the getSomething was not one of these five (or serviced by a code snippet) processes, CubeCart complains about no callback method available. (The web browser is making a "call back" to CubeCart to get something.)

If you can find the related URL that got logged in the web server's access logs, at the same time adjusted for timezone differences, you will learn what the getSomething was.

Edited by bsmither

Share this post


Link to post
Share on other sites

Hi Claudia

I have made a small change to the code on that line in order to highlight what the rogue "getSomething" is and will let you know

Ian

Share this post


Link to post
Share on other sites

For the life of me I could not find the corresponding error for

[22-Nov-2019 19:23:19 America/Louisville] PHP Warning:  No callback method defined. in /home/claudias/public_html/classes/cubecart.class.php on line 321

 

But I got more of the errors today and found the entries: What should I do?

[25-Nov-2019 06:59:00 America/Louisville] PHP Warning:  No callback method defined. in /home/claudias/public_html/classes/cubecart.class.php on line 321

[25-Nov-2019 06:59:16 America/Louisville] PHP Warning:  No callback method defined. in /home/claudias/public_html/classes/cubecart.class.php on line 321

[25-Nov-2019 07:31:46 America/Louisville] PHP Warning:  No callback method defined. in /home/claudias/public_html/classes/cubecart.class.php on line 321

 

216.246.6.170 - - [25/Nov/2019:11:59:00 +0000] "GET / HTTP/1.1" 200 14700 "https://my.supremesupport.com/staff/index.php?_m=tickets&_a=viewticket&ticketid=54859&noteconfirm=1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"

 

216.246.6.170 - - [25/Nov/2019:11:59:16 +0000] "GET /index.php?_g=getSomething HTTP/1.1" 302 20 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"

216.246.6.170 - - [25/Nov/2019:11:59:16 +0000] "GET / HTTP/1.1" 200 14700 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"

 

216.246.6.170 - - [25/Nov/2019:12:31:46 +0000] "GET / HTTP/1.1" 200 14700 "https://my.supremesupport.com/staff/index.php?_m=tickets&_a=viewticket&ticketid=54859&noteconfirm=1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"

Share this post


Link to post
Share on other sites

Hey Ian,

Did you change my code on line 321 to

   }
                    trigger_error('No useful GET['_g'] callback method defined. Got _g='.filter_var($_GET['_g'],FILTER_SANITIZE_STRING), E_USER_WARNING);
                    httpredir('index.php');
            }


That is why I was getting the white screen.  I changed it back to stock and now I can see my store.

  }
                    trigger_error('No callback method defined.', E_USER_WARNING);
                    httpredir('index.php');
            }

 

Me

I have 123 of these system errors in admin

Today, 11:16 [<strong>Exception</strong>] /home/claudias/public_html/classes/cubecart.class.php:321 - syntax error, unexpected '_g' (T_STRING), expecting ')'

Share this post


Link to post
Share on other sites

Well, the bold one is, no doubt, an experiment to show that CubeCart doesn't know what to do with getSomething.

The other two, where Supreme Support referred to your site, is simply asking for the homepage.

Ian meant to do this:

trigger_error("No useful GET['_g'] callback method defined. Got _g=".filter_var($_GET['_g'],FILTER_SANITIZE_STRING), E_USER_WARNING);

Needed to change some quote marks.

Share this post


Link to post
Share on other sites
6 minutes ago, bsmither said:

Needed to change some quote marks.

Yep, sorry about that - wrong quotes used in two places

Share this post


Link to post
Share on other sites

Yes you can - I have updated the class file with the correct code now (and checked your site worked !) so hopefully that will give us a clue as to what is going on

Share this post


Link to post
Share on other sites

My interest is why the code to deal with _g is happening.

The web access log says it is just GET / (the default doc - homepage) with no querystring.

So, something is adding a potentially unwanted querystring, or a plugin or code snippet is adding to the $_GET array during CubeCart's wake-up sequence.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...