laruence                                 Fri, 16 Dec 2011 19:25:03 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=321074

Log:
Fixed bug #60523 (PHP Errors are not reported in browsers using built-in SAPI)

Bug: https://bugs.php.net/60523 (Assigned) PHP Errors are not reported in 
browsers using built-in SAPI
      
Changed paths:
    U   php/php-src/branches/PHP_5_4/NEWS
    U   php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c
    A   php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_015.phpt
    U   php/php-src/trunk/sapi/cli/php_cli_server.c
    A   php/php-src/trunk/sapi/cli/tests/php_cli_server_015.phpt

Modified: php/php-src/branches/PHP_5_4/NEWS
===================================================================
--- php/php-src/branches/PHP_5_4/NEWS   2011-12-16 19:02:52 UTC (rev 321073)
+++ php/php-src/branches/PHP_5_4/NEWS   2011-12-16 19:25:03 UTC (rev 321074)
@@ -8,8 +8,11 @@
 - CLI SAPI:
   . Fixed bug #60477 (Segfault after two multipart/form-data POST requests,
     one 200 RQ and one 404). (Laruence)
+  . Fixed bug #60523 (PHP Errors are not reported in browsers using built-in
+    SAPI). (Laruence, Derick)
 - Pdo Firebird:
-  . Fixed bug #48877 ("bindValue" and "bindParam" do not work for PDO 
Firebird).(Mariuz)
+  . Fixed bug #48877 ("bindValue" and "bindParam" do not work for PDO 
Firebird).
+    (Mariuz)

 08 Dec 2011, PHP 5.4.0 RC3
 - Core:

Modified: php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c
===================================================================
--- php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c      2011-12-16 
19:02:52 UTC (rev 321073)
+++ php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c      2011-12-16 
19:25:03 UTC (rev 321074)
@@ -1913,6 +1913,7 @@
                destroy_request_info(&SG(request_info));
                return FAILURE;
        }
+       PG(during_request_startup) = 0;

        return SUCCESS;
 }

Added: php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_015.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_015.phpt         
                (rev 0)
+++ php/php-src/branches/PHP_5_4/sapi/cli/tests/php_cli_server_015.phpt 
2011-12-16 19:25:03 UTC (rev 321074)
@@ -0,0 +1,49 @@
+--TEST--
+Bug #60523 (PHP Errors are not reported in browsers using built-in SAPI)
+--SKIPIF--
+<?php
+include "skipif.inc";
+?>
+--INI--
+display_errors=1
+--FILE--
+<?php
+include "php_cli_server.inc";
+php_cli_server_start('require("syntax_error.php");');
+$dir = realpath(dirname(__FILE__));
+
+file_put_contents($dir . "/syntax_error.php", "<?php non_exists_function(); 
?>");
+
+list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
+$port = intval($port)?:80;
+$output = '';
+
+$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
+if (!$fp) {
+  die("connect failed");
+}
+
+if(fwrite($fp, <<<HEADER
+GET /index.php HTTP/1.1
+Host: {$host}
+
+
+HEADER
+)) {
+       while (!feof($fp)) {
+               $output .= fgets($fp);
+       }
+}
+echo $output;
+@unlink($dir . "/syntax_error.php");
+fclose($fp);
+?>
+--EXPECTF--
+HTTP/1.1 200 OK
+Host: %s
+Connection: closed
+X-Powered-By: PHP/%s
+Content-type: text/html
+
+<br />
+<b>Fatal error</b>:  Call to undefined function non_exists_function() in 
<b>%ssyntax_error.php</b> on line <b>%s</b><br />

Modified: php/php-src/trunk/sapi/cli/php_cli_server.c
===================================================================
--- php/php-src/trunk/sapi/cli/php_cli_server.c 2011-12-16 19:02:52 UTC (rev 
321073)
+++ php/php-src/trunk/sapi/cli/php_cli_server.c 2011-12-16 19:25:03 UTC (rev 
321074)
@@ -1913,6 +1913,7 @@
                destroy_request_info(&SG(request_info));
                return FAILURE;
        }
+       PG(during_request_startup) = 0;

        return SUCCESS;
 }

Added: php/php-src/trunk/sapi/cli/tests/php_cli_server_015.phpt
===================================================================
--- php/php-src/trunk/sapi/cli/tests/php_cli_server_015.phpt                    
        (rev 0)
+++ php/php-src/trunk/sapi/cli/tests/php_cli_server_015.phpt    2011-12-16 
19:25:03 UTC (rev 321074)
@@ -0,0 +1,49 @@
+--TEST--
+Bug #60523 (PHP Errors are not reported in browsers using built-in SAPI)
+--SKIPIF--
+<?php
+include "skipif.inc";
+?>
+--INI--
+display_errors=1
+--FILE--
+<?php
+include "php_cli_server.inc";
+php_cli_server_start('require("syntax_error.php");');
+$dir = realpath(dirname(__FILE__));
+
+file_put_contents($dir . "/syntax_error.php", "<?php non_exists_function(); 
?>");
+
+list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
+$port = intval($port)?:80;
+$output = '';
+
+$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
+if (!$fp) {
+  die("connect failed");
+}
+
+if(fwrite($fp, <<<HEADER
+GET /index.php HTTP/1.1
+Host: {$host}
+
+
+HEADER
+)) {
+       while (!feof($fp)) {
+               $output .= fgets($fp);
+       }
+}
+echo $output;
+@unlink($dir . "/syntax_error.php");
+fclose($fp);
+?>
+--EXPECTF--
+HTTP/1.1 200 OK
+Host: %s
+Connection: closed
+X-Powered-By: PHP/%s
+Content-type: text/html
+
+<br />
+<b>Fatal error</b>:  Call to undefined function non_exists_function() in 
<b>%ssyntax_error.php</b> on line <b>%s</b><br />

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to