mirror of
https://github.com/php/php-src.git
synced 2026-04-23 07:58:20 +02:00
Merge branch 'PHP-5.5' of ssh://git.php.net/php-src into PHP-5.5
This commit is contained in:
@@ -3,11 +3,13 @@ PHP NEWS
|
||||
?? ??? 201?, PHP 5.5.0 Beta 1
|
||||
|
||||
- Core:
|
||||
. Fixed bug #64135 (Exceptions from set_error_handler are not always
|
||||
propagated). (Laruence)
|
||||
. Fixed bug #63830 (Segfault on undefined function call in nested generator).
|
||||
(Nikita Popov)
|
||||
. Fixed bug #60833 (self, parent, static behave inconsistently
|
||||
case-sensitive). (Stas, mario at include-once dot org)
|
||||
. Implemented FR #60524 (specify temp dir by php.ini). (ALeX Kazik).
|
||||
. Fixed bug #63830 (Segfault on undefined function call in nested generator).
|
||||
(Nikita Popov)
|
||||
|
||||
- CLI server:
|
||||
. Fixed bug #64128 (buit-in web server is broken on ppc64). (Remi)
|
||||
|
||||
@@ -17,18 +17,16 @@ $undefined->foo();
|
||||
--EXPECTF--
|
||||
Error handler called (Undefined variable: undefined)
|
||||
|
||||
Warning: Uncaught exception 'ErrorException' with message 'Undefined variable: undefined' in %sbug61767.php:13
|
||||
Fatal error: Uncaught exception 'ErrorException' with message 'Undefined variable: undefined' in %sbug61767.php:%d
|
||||
Stack trace:
|
||||
#0 %sbug61767.php(13): {closure}(8, 'Undefined varia...', '%s', 13, Array)
|
||||
#0 %sbug61767.php(%d): {closure}(%s, 'Undefined varia...', '%s', %d, Array)
|
||||
#1 {main}
|
||||
thrown in %sbug61767.php on line 13
|
||||
|
||||
Fatal error: Call to a member function foo() on a non-object in %sbug61767.php on line 13
|
||||
thrown in %sbug61767.php on line %d
|
||||
Shutting down
|
||||
Array
|
||||
(
|
||||
[type] => 1
|
||||
[message] => Call to a member function foo() on a non-object
|
||||
[message] => %a
|
||||
[file] => %sbug61767.php
|
||||
[line] => 13
|
||||
[line] => %d
|
||||
)
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #64135 (Exceptions from set_error_handler are not always propagated)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function exception_error_handler() {
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
set_error_handler("exception_error_handler");
|
||||
try {
|
||||
$undefined->undefined();
|
||||
} catch(Exception $e) {
|
||||
echo "Exception is thrown";
|
||||
}
|
||||
--EXPECT--
|
||||
Exception is thrown
|
||||
@@ -2462,6 +2462,10 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
FREE_OP2();
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
|
||||
}
|
||||
|
||||
|
||||
@@ -8947,6 +8947,10 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCO
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
|
||||
}
|
||||
|
||||
@@ -9801,6 +9805,10 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
zval_dtor(free_op2.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
|
||||
}
|
||||
|
||||
@@ -10660,6 +10668,10 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
|
||||
}
|
||||
|
||||
@@ -12094,6 +12106,10 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
|
||||
}
|
||||
|
||||
@@ -15319,6 +15335,10 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCO
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
|
||||
}
|
||||
|
||||
@@ -17660,6 +17680,10 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
zval_dtor(free_op2.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
|
||||
}
|
||||
|
||||
@@ -19966,6 +19990,10 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
|
||||
}
|
||||
|
||||
@@ -23407,6 +23435,10 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
|
||||
}
|
||||
|
||||
@@ -25033,6 +25065,10 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_O
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
|
||||
}
|
||||
|
||||
@@ -26441,6 +26477,10 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPC
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
zval_dtor(free_op2.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
|
||||
}
|
||||
|
||||
@@ -27755,6 +27795,10 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPC
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
|
||||
}
|
||||
|
||||
@@ -29490,6 +29534,10 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCO
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
|
||||
}
|
||||
|
||||
@@ -32718,6 +32766,10 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCOD
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
|
||||
}
|
||||
|
||||
@@ -34831,6 +34883,10 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
zval_dtor(free_op2.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
|
||||
}
|
||||
|
||||
@@ -37003,6 +37059,10 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
|
||||
}
|
||||
|
||||
@@ -40167,6 +40227,10 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_H
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
|
||||
}
|
||||
|
||||
|
||||
+12
-11
@@ -1111,8 +1111,7 @@ static int php_snmp_parse_oid(zval *object, int st, struct objid_query *objid_qu
|
||||
static int netsnmp_session_init(php_snmp_session **session_p, int version, char *hostname, char *community, int timeout, int retries TSRMLS_DC)
|
||||
{
|
||||
php_snmp_session *session;
|
||||
char *pptr;
|
||||
char buf[MAX_NAME_LEN];
|
||||
char *pptr, *host_ptr;
|
||||
int force_ipv6 = FALSE;
|
||||
int n;
|
||||
struct sockaddr **psal;
|
||||
@@ -1126,8 +1125,6 @@ static int netsnmp_session_init(php_snmp_session **session_p, int version, char
|
||||
}
|
||||
memset(session, 0, sizeof(php_snmp_session));
|
||||
|
||||
strlcpy(buf, hostname, sizeof(buf));
|
||||
|
||||
snmp_sess_init(session);
|
||||
|
||||
session->version = version;
|
||||
@@ -1138,13 +1135,15 @@ static int netsnmp_session_init(php_snmp_session **session_p, int version, char
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "emalloc() failed while copying hostname");
|
||||
return (-1);
|
||||
}
|
||||
*(session->peername) = '\0';
|
||||
/* we copy original hostname for further processing */
|
||||
strlcpy(session->peername, hostname, MAX_NAME_LEN);
|
||||
host_ptr = session->peername;
|
||||
|
||||
/* Reading the hostname and its optional non-default port number */
|
||||
if (*hostname == '[') { /* IPv6 address */
|
||||
if (*host_ptr == '[') { /* IPv6 address */
|
||||
force_ipv6 = TRUE;
|
||||
hostname++;
|
||||
if ((pptr = strchr(hostname, ']'))) {
|
||||
host_ptr++;
|
||||
if ((pptr = strchr(host_ptr, ']'))) {
|
||||
if (pptr[1] == ':') {
|
||||
session->remote_port = atoi(pptr + 2);
|
||||
}
|
||||
@@ -1154,7 +1153,7 @@ static int netsnmp_session_init(php_snmp_session **session_p, int version, char
|
||||
return (-1);
|
||||
}
|
||||
} else { /* IPv4 address */
|
||||
if ((pptr = strchr(hostname, ':'))) {
|
||||
if ((pptr = strchr(host_ptr, ':'))) {
|
||||
session->remote_port = atoi(pptr + 1);
|
||||
*pptr = '\0';
|
||||
}
|
||||
@@ -1162,11 +1161,13 @@ static int netsnmp_session_init(php_snmp_session **session_p, int version, char
|
||||
|
||||
/* since Net-SNMP library requires 'udp6:' prefix for all IPv6 addresses (in FQDN form too) we need to
|
||||
perform possible name resolution before running any SNMP queries */
|
||||
if ((n = php_network_getaddresses(hostname, SOCK_DGRAM, &psal, NULL TSRMLS_CC)) == 0) { /* some resover error */
|
||||
if ((n = php_network_getaddresses(host_ptr, SOCK_DGRAM, &psal, NULL TSRMLS_CC)) == 0) { /* some resolver error */
|
||||
/* warnings sent, bailing out */
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* we have everything we need in psal, flush peername and fill it properly */
|
||||
*(session->peername) = '\0';
|
||||
res = psal;
|
||||
while (n-- > 0) {
|
||||
pptr = session->peername;
|
||||
@@ -1196,7 +1197,7 @@ static int netsnmp_session_init(php_snmp_session **session_p, int version, char
|
||||
}
|
||||
|
||||
if (strlen(session->peername) == 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown failure while resolving '%s'", buf);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown failure while resolving '%s'", hostname);
|
||||
return (-1);
|
||||
}
|
||||
/* XXX FIXME
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
Bug #64124 IPv6 malformed
|
||||
--CREDITS--
|
||||
Boris Lytochkin
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once(dirname(__FILE__).'/skipif.inc');
|
||||
|
||||
$packed = str_repeat(chr(0), 15) . chr(1);
|
||||
if (@inet_ntop($packed) === false) {
|
||||
die("skip no IPv6 support");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__).'/snmp_include.inc');
|
||||
|
||||
# hostname variable was modified inline in netsnmp_session_init()
|
||||
# Should be checked with IPv6 since IPv4 processing code do not alter pointer position
|
||||
|
||||
//EXPECTF format is quickprint OFF
|
||||
snmp_set_quick_print(false);
|
||||
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
|
||||
|
||||
$checkvar = "$hostname6_port";
|
||||
|
||||
var_dump(snmpget($checkvar, $community, '.1.3.6.1.2.1.1.1.0'));
|
||||
var_dump(($checkvar === $hostname6_port));
|
||||
var_dump(snmpget($checkvar, $community, '.1.3.6.1.2.1.1.1.0'));
|
||||
var_dump(($checkvar === $hostname6_port));
|
||||
var_dump(snmpget($checkvar, $community, '.1.3.6.1.2.1.1.1.0'));
|
||||
var_dump(($checkvar === $hostname6_port));
|
||||
?>
|
||||
--EXPECTF--
|
||||
%unicode|string%(%d) "%s"
|
||||
bool(true)
|
||||
%unicode|string%(%d) "%s"
|
||||
bool(true)
|
||||
%unicode|string%(%d) "%s"
|
||||
bool(true)
|
||||
Reference in New Issue
Block a user