Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

214
Visualizações
PHP Impoved error messaging on pages that fail parsing

This isn't quite a "fix my code" question, more of a configuration. I'm working with the HTML/Javascript/PHP/MySql stack. I'm a seasoned C#/TSQL developer but fairly new to this stack. I'm finding debugging very frustrating as compliation/parse errors are not shown during development. For example, after making a series of modifications, in one of my PHP libraries I've had the following:

    function sp_AssignNotificationsToUsr($CreateGUID, $UsrID, &$message) // boolean
    // This assigns any notifications with the CreateGUID passed, to the UsrID passed.
    // If successful, returns true, else false.
    // If false is returned, look in $message for an error message.
    {
        try
        {
            $sql = "";
            $sql .= "SET @CreateGUID = " . Str2SQL($CreateGUID) . ";" . PHP_EOL;
            $sql .= "SET @UsrID = " . $UsrID . ";" . PHP_EOL;
            $sql .= "" . PHP_EOL;
            $sql .= "CALL AssignNotificationsToUsr(@CreateGUID, @UsrID);" . PHP_EOL;
            $sql .= "" . PHP_EOL;

            $db = new DB;
            if (!$db->connect()) throw new Exception("Could not connect to database correctly.");           
            $dss = $db->executeMultiQuery2($sql);
            $db->disconnect();
            return true;
        }
        catch (Exception $e)
        {
            $message = $->getMessage();
            ErrorMessageEmail("sprocs.php:sp_AssignNotificationsToUsr", 1, $e);
            return false;
        }
    }

When I run the calling page, it returns empty with no errors. I have already executed the following during the page:

    ini_set('display_startup_errors', 1);
    ini_set('display_errors', 'On');
    error_reporting(E_ALL);

When this occurs (no output, no errors), I then spend time commenting in and out great swathes of code in various files, trying to pin down where the parse error is. In this instance, it turned out to be that:

$message = $->getMessage();

should have been:

$message = $e->getMessage();

I'm used to Visual Studio pointing out parse errors before I even try to run code, which obviously isn't how it works here. I'm using Notepad++ as an editor. Is there some configuration I can use to show compile time errors like this? The same with the client-side Javascript. If it has a parse error it just does nothing with no errors shown. How can I get the errors from the parser shown?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda