Skip to content

Commit

Permalink
Merge branch 'master' of ssh://git.php.net/php-src
Browse files Browse the repository at this point in the history
  • Loading branch information
faizshukri committed Oct 31, 2012
2 parents d62bc53 + 8fb26e7 commit f2f3804
Show file tree
Hide file tree
Showing 28 changed files with 1,453 additions and 615 deletions.
43 changes: 43 additions & 0 deletions Zend/tests/bug63305.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
--TEST--
Bug #63305 (zend_mm_heap corrupted with traits)
--FILE--
<?php
new Attachment("");

function __autoload($class) {
switch ($class) {
case "Attachment":
eval(<<<'PHP'
class Attachment extends File {
}
PHP
);
break;
case "File":
eval(<<<'PHP'
class File {
use TDatabaseObject {
TDatabaseObject::__construct as private databaseObjectConstruct;
}
public function __construct() {
}
}
PHP
);
break;
case "TDatabaseObject":
eval(<<<'PHP'
trait TDatabaseObject {
public function __construct() {
}
}
PHP
);
break;
}
return TRUE;
}
echo "okey";
?>
--EXPECT--
okey
24 changes: 24 additions & 0 deletions Zend/tests/bug63336.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--TEST--
Bug #63336 (invalid E_NOTICE error occur)
--XFAIL--
Bug is not fixed yet
--FILE--
<?php
error_reporting(E_ALL | E_NOTICE );
define("TEST", "123");
class Base {
const DUMMY = "XXX";
public function foo($var=TEST, $more=null) { return true; }
public function bar($more=self::DUMMY) { return true; }
}

class Child extends Base {
const DUMMY = "DDD";
public function foo($var=TEST, array $more = array()) { return true; }
public function bar($var, $more=self::DUMMY) { return true; }
}
?>
--EXPECT--
Strict Standards: Declaration of Child::foo() should be compatible with Base::foo($var = '123', $more = NULL) in %sbug63336.php on line %d

Strict Standards: Declaration of Child::bar() should be compatible with Base::bar($var, $more = 'XXX') in %sbug63336.php on line %d
4 changes: 2 additions & 2 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -3966,7 +3966,7 @@ static int zend_traits_copy_functions(zend_function *fn TSRMLS_DC, int num_args,

/* if it is 0, no modifieres has been changed */
if (aliases[i]->modifiers) {
fn_copy.common.fn_flags = aliases[i]->modifiers;
fn_copy.common.fn_flags = aliases[i]->modifiers | ZEND_ACC_ALIAS;
if (!(aliases[i]->modifiers & ZEND_ACC_PPP_MASK)) {
fn_copy.common.fn_flags |= ZEND_ACC_PUBLIC;
}
Expand Down Expand Up @@ -4007,7 +4007,7 @@ static int zend_traits_copy_functions(zend_function *fn TSRMLS_DC, int num_args,
&& (!aliases[i]->trait_method->ce || fn->common.scope == aliases[i]->trait_method->ce)
&& (aliases[i]->trait_method->mname_len == fnname_len)
&& (zend_binary_strcasecmp(aliases[i]->trait_method->method_name, aliases[i]->trait_method->mname_len, fn->common.function_name, fnname_len) == 0)) {
fn_copy.common.fn_flags = aliases[i]->modifiers;
fn_copy.common.fn_flags = aliases[i]->modifiers | ZEND_ACC_ALIAS;

if (!(aliases[i]->modifiers & ZEND_ACC_PPP_MASK)) {
fn_copy.common.fn_flags |= ZEND_ACC_PUBLIC;
Expand Down
5 changes: 4 additions & 1 deletion ext/curl/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -2014,6 +2014,10 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu

switch (option) {
/* Long options */
case CURLOPT_SSL_VERIFYHOST:
if(Z_TYPE_PP(zvalue)==IS_BOOL && Z_BVAL_PP(zvalue)) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "CURLOPT_SSL_VERIFYHOST set to true which disables common name validation (setting CURLOPT_SSL_VERIFYHOST to 2 enables common name validation)");
}
case CURLOPT_AUTOREFERER:
case CURLOPT_BUFFERSIZE:
case CURLOPT_CLOSEPOLICY:
Expand Down Expand Up @@ -2048,7 +2052,6 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
case CURLOPT_PUT:
case CURLOPT_RESUME_FROM:
case CURLOPT_SSLVERSION:
case CURLOPT_SSL_VERIFYHOST:
case CURLOPT_SSL_VERIFYPEER:
case CURLOPT_TIMECONDITION:
case CURLOPT_TIMEOUT:
Expand Down
29 changes: 29 additions & 0 deletions ext/curl/tests/bug63363.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
--TEST--
Bug #63363 (CURL silently accepts boolean value for SSL_VERIFYHOST)
--SKIPIF--
<?php
if (!extension_loaded("curl")) {
exit("skip curl extension not loaded");
}

?>
--FILE--
<?php
$ch = curl_init();
var_dump(curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false));
/* Case that should throw an error */
var_dump(curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, true));
var_dump(curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0));
var_dump(curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1));
var_dump(curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2));

curl_close($ch);
?>
--EXPECTF--
bool(true)

Notice: curl_setopt(): CURLOPT_SSL_VERIFYHOST set to true which disables common name validation (setting CURLOPT_SSL_VERIFYHOST to 2 enables common name validation) in %s on line %d
bool(true)
bool(true)
bool(true)
bool(true)
Loading

0 comments on commit f2f3804

Please sign in to comment.