0

I'm a sysadmin and want to fix one callback script on our website made with CMS.

After many hours of research I clearly identified that the problem is in this code:

$invoiceId = (int) App::getFromRequest("invoiceid");
$postData = [];
$postData["VPSTxId"] = App::getFromRequest("threeDSSessionData");
if (App::getFromRequest("cres")) {
    $postData["CRes"] = App::getFromRequest("cres");
} else {
    if (App::getFromRequest("PaRes")) {
        $postData["PARes"] = App::getFromRequest("PaRes");
        $postData["MD"] = App::getFromRequest("MD");
    } else {
        callback3DSecureRedirect($invoiceId, false);
    }
}

More specifically, I think this piece of code is not working as expected:

App::getFromRequest

Can someone explain to me what is App:: in PHP and how is defined?

I understand that "getFromRequest" is the name of this App::

I made the search about App::getFromRequest inside the CMS codes, and I found that many scripts use this, but I can not find where is its definition.

Thank you in advance!

CyberUser
  • 39
  • 4
  • 1
    `App` is the name of the class and `getFromRequest` is the static function defined inside it. – nice_dev Jul 04 '23 at 14:06
  • 1
    `App` is just some custom class in your application. `getFromRequest()` is a method in that class. The `::` is how you call static class methods and properties. How to best find that class depends on the implementation. Depending on how the site was built, a normal IDE can usually jump to the definition if you ctrl+click on the method name (depending on implementation, IDE and OS, ofc) – M. Eriksson Jul 04 '23 at 14:07
  • 1
    In your code base, you could try searching for: `function getFromRequest(`. That should find where any function/method called `getFromRequest` is defined. – M. Eriksson Jul 04 '23 at 14:10
  • 1
    Does this answer your question? [Reference Guide: What does this symbol mean in PHP? (PHP Syntax)](https://stackoverflow.com/questions/3737139/reference-guide-what-does-this-symbol-mean-in-php-php-syntax) – Mepix Jul 11 '23 at 04:55

1 Answers1

1

App is most likely a custom class. Here is PHP's documentation example of how to write a class:

<?php
class SimpleClass
{
    // property declaration
    public $var = 'a default value';

    // method declaration
    public function displayVar() {
        echo $this->var;
    }
}
?>

In your case, you should probably be looking for code that looks like this instead:

<?php
class App
{
    // Some other functions...

    // The function you need to look at
    public function getFromRequest() {
        // some more code implementing the function...
    }
}
?>

Chipster
  • 117
  • 7