Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-3661

Console output sequence from PHP is in wrong order and changes randomly on errormessages

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 11.2, 12.4
    • None
    • None

    Description

      The output from PHP scripts in the built-in console is not consistent with the output from running the same script without netbeans using just PHP directly. There seems to be some kind of output buffering which changes on each script run.
      As far as I can tell, only PHP Error-messages are affected.

       

      sample code:

      <?php
      print ("1\n");
      throw new Exception('help');
      print ("2\n");
      
      

      expected output:

      "C:\php\php.exe" "C:\Users\Niko\Documents\NetBeansProjects\ConsoleOutputError\index.php"
      1
      PHP Fatal error:  Uncaught Exception: help in C:\Users\Niko\Documents\NetBeansProjects\ConsoleOutputError\index.php:3
      Stack trace:
      #0 {main}
        thrown in C:\Users\Niko\Documents\NetBeansProjects\ConsoleOutputError\index.php on line 3
      Done.
      

      actual output:

      (varies, see screenshots)

      "C:\php\php.exe" "C:\Users\Niko\Documents\NetBeansProjects\ConsoleOutputError\index.php"
      1
      PHP Fatal error:  Uncaught Exception: help in C:\Users\Niko\Documents\NetBeansProjects\ConsoleOutputError\index.php:3
      Stack trace:
      Done.
      #0 {main}
        thrown in C:\Users\Niko\Documents\NetBeansProjects\ConsoleOutputError\index.php on line 3
      
      

      OR

      "C:\php\php.exe" "C:\Users\Niko\Documents\NetBeansProjects\ConsoleOutputError\index.php"
      PHP Fatal error:  Uncaught Exception: help in C:\Users\Niko\Documents\NetBeansProjects\ConsoleOutputError\index.php:3
      Stack trace:
      1
      #0 {main}
      Done.
        thrown in C:\Users\Niko\Documents\NetBeansProjects\ConsoleOutputError\index.php on line 3
      

      OR

      "C:\php\php.exe" "C:\Users\Niko\Documents\NetBeansProjects\ConsoleOutputError\index.php"
      PHP Fatal error:  Uncaught Exception: help in C:\Users\Niko\Documents\NetBeansProjects\ConsoleOutputError\index.php:3
      1
      Stack trace:
      Done.
      #0 {main}
        thrown in C:\Users\Niko\Documents\NetBeansProjects\ConsoleOutputError\index.php on line 3
      

      and so on. Interestingly the coloring is respected and not broken. Also, when I use xdebug to step through the code, the order is always correct. PHP Output buffering settings and/or using flush() has apparently no effect.

      Running the script directly in the windows console works as expected every time:

      C:\Users\Niko>php -f c:\users\niko\Documents\NetBeansProjects\ConsoleOutputError\index.php
      1
      PHP Fatal error:  Uncaught Exception: help in C:\Users\Niko\Documents\NetBeansProjects\ConsoleOutputError\index.php:3
      Stack trace:
      #0 {main}
        thrown in C:\Users\Niko\Documents\NetBeansProjects\ConsoleOutputError\index.php on line 3
      

       

       

       

      Attachments

        1. resultScreenshots.zip
          48 kB
          Nikolai Neff
        2. netbeanssettings.zip
          509 kB
          Nikolai Neff
        3. ConsoleOutputErrorNBProjectFiles.zip
          2 kB
          Nikolai Neff

        Activity

          People

            Unassigned Unassigned
            NikolaiNeff Nikolai Neff
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: