summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-12-05 03:50:02 +0100
committerAnatol Belski <ab@php.net>2014-12-05 03:50:02 +0100
commit88bb9fedc4b5fc750524a7b00be1d46fde2f5929 (patch)
treee799ee0cdf4a5d8a8236f599ab8c85a9a05d8673 /ext
parent864cd82acef03b75b994f3fd98d9b4a51a99204a (diff)
parentf0a17c293b5b240a4da27e6b5f89dbd9c9183488 (diff)
downloadphp-git-88bb9fedc4b5fc750524a7b00be1d46fde2f5929.tar.gz
Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (111 commits) Fix zend_fcall_info_arg*() to use ZVAL_COPY Fixed #65213 - cannot cast SplFileInfo to boolean add initial install switch to C travis project instead of PHP use the generic TRAVIS environment var to check for travis (see http://docs.travis-ci.com/user/ci-environment/) fix TS build add config option to target codegen architectures updated NEWS updated NEWS Fixed bug #55541 errors spawn MessageBox, which blocks test automation Get rid of duplicate handlers (ZEND_ADD_SPEC_TMP_TMP and ZEND_ADD_SPEC_VAR_VAR are absolutely the same). Use zend_string* for op_array->arg_info[]->name and op_array->arg_info[]->class_name. For internal functions we still use char*. Fixed __debugInfo() support Update UPGRADING for the new variadic functions, and re-sort. Improved POST INC/DEC make sure that we don't truncate the stack trace and cause false test failures when the test is executed in a directory with long path Missed closed folder mark Revert "Unecessary assignment" Fixed improper memory release Unecessary assignment ...
Diffstat (limited to 'ext')
-rw-r--r--ext/curl/multi.c7
-rw-r--r--ext/curl/tests/bug67643.phpt30
-rw-r--r--ext/date/php_date.c79
-rw-r--r--ext/date/php_date.h3
-rw-r--r--ext/date/tests/DatePeriod_getter.phpt25
-rw-r--r--ext/gmp/gmp.c32
-rw-r--r--ext/gmp/php_gmp.h1
-rw-r--r--ext/gmp/tests/gmp_random_seed.phpt229
-rw-r--r--ext/intl/collator/collator_attr.h2
-rw-r--r--ext/intl/tests/bug67052.phpt5
-rw-r--r--ext/opcache/Optimizer/zend_optimizer.c4
-rw-r--r--ext/opcache/Optimizer/zend_optimizer_internal.h2
-rw-r--r--ext/opcache/zend_persist.c6
-rw-r--r--ext/opcache/zend_persist_calc.c6
-rwxr-xr-xext/openssl/openssl.c63
-rw-r--r--ext/openssl/tests/027.phpt52
-rw-r--r--ext/openssl/tests/028.phpt28
-rw-r--r--ext/openssl/tests/private_ec.key5
-rw-r--r--ext/openssl/tests/public_ec.key4
-rw-r--r--ext/openssl/tests/stream_server_reneg_limit.phpt4
-rw-r--r--ext/pcntl/pcntl.c1
-rw-r--r--ext/pdo/pdo_dbh.c2
-rw-r--r--ext/reflection/php_reflection.c79
-rw-r--r--ext/spl/spl_directory.c40
-rw-r--r--ext/spl/spl_directory.h8
-rw-r--r--ext/spl/tests/bug65213.phpt13
-rw-r--r--ext/spl/tests/bug66405.phpt59
-rw-r--r--ext/standard/crypt.c7
-rw-r--r--ext/standard/crypt_blowfish.c43
-rw-r--r--ext/standard/dns.c19
-rw-r--r--ext/standard/dns_win32.c2
-rw-r--r--ext/standard/head.c8
-rw-r--r--ext/standard/pack.c28
-rw-r--r--ext/standard/tests/file/bug68335.phpt13
-rw-r--r--ext/standard/tests/strings/crypt_blowfish.phpt36
-rw-r--r--ext/standard/tests/strings/unpack_bug68225.phpt39
36 files changed, 880 insertions, 104 deletions
diff --git a/ext/curl/multi.c b/ext/curl/multi.c
index d9e6df2c98..d9ace4119c 100644
--- a/ext/curl/multi.c
+++ b/ext/curl/multi.c
@@ -240,12 +240,15 @@ PHP_FUNCTION(curl_multi_getcontent)
ZEND_FETCH_RESOURCE(ch, php_curl *, z_ch, -1, le_curl_name, le_curl);
- if (ch->handlers->write->method == PHP_CURL_RETURN && ch->handlers->write->buf.s) {
+ if (ch->handlers->write->method == PHP_CURL_RETURN) {
+ if (!ch->handlers->write->buf.s) {
+ RETURN_EMPTY_STRING();
+ }
smart_str_0(&ch->handlers->write->buf);
RETURN_STR(zend_string_copy(ch->handlers->write->buf.s));
}
- RETURN_EMPTY_STRING();
+ RETURN_NULL();
}
/* }}} */
diff --git a/ext/curl/tests/bug67643.phpt b/ext/curl/tests/bug67643.phpt
new file mode 100644
index 0000000000..ad59f2c12c
--- /dev/null
+++ b/ext/curl/tests/bug67643.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #67643 (curl_multi_getcontent returns '' when RETURNTRANSFER isn't set)
+--SKIPIF--
+<?php
+if (!extension_loaded('curl')) print 'skip';
+?>
+--FILE--
+<?php
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, 'file://'. dirname(__FILE__) . DIRECTORY_SEPARATOR .'curl_testdata1.txt');
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
+
+ $mh = curl_multi_init();
+ curl_multi_add_handle($mh, $ch);
+
+ $running = 0;
+ do {
+ curl_multi_exec($mh, $running);
+ } while($running > 0);
+
+ $results = curl_multi_getcontent($ch);
+
+ curl_multi_remove_handle($mh, $ch);
+ curl_multi_close($mh);
+
+ var_dump($results);
+?>
+--EXPECT--
+CURL1
+NULL
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 6146dec927..8f2e8c8fc5 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -533,6 +533,9 @@ const zend_function_entry date_funcs_period[] = {
PHP_ME(DatePeriod, __construct, arginfo_date_period_construct, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
PHP_ME(DatePeriod, __wakeup, NULL, ZEND_ACC_PUBLIC)
PHP_ME(DatePeriod, __set_state, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(DatePeriod, getStartDate, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(DatePeriod, getEndDate, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(DatePeriod, getDateInterval, NULL, ZEND_ACC_PUBLIC)
PHP_FE_END
};
@@ -3641,6 +3644,7 @@ static int timezone_initialize(php_timezone_obj *tzobj, /*const*/ char *tz TSRML
return FAILURE;
} else {
set_timezone_from_timelib_time(tzobj, dummy_t);
+ free(dummy_t->tz_abbr);
efree(dummy_t);
return SUCCESS;
}
@@ -4414,6 +4418,81 @@ PHP_METHOD(DatePeriod, __construct)
}
/* }}} */
+/* {{{ proto DatePeriod::getStartDate()
+ Get start date.
+*/
+PHP_METHOD(DatePeriod, getStartDate)
+{
+ php_period_obj *dpobj;
+ php_date_obj *dateobj;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ dpobj = Z_PHPPERIOD_P(getThis());
+
+ php_date_instantiate(dpobj->start_ce, return_value TSRMLS_CC);
+ dateobj = Z_PHPDATE_P(return_value);
+ dateobj->time = timelib_time_ctor();
+ *dateobj->time = *dpobj->start;
+ if (dpobj->start->tz_abbr) {
+ dateobj->time->tz_abbr = strdup(dpobj->start->tz_abbr);
+ }
+ if (dpobj->start->tz_info) {
+ dateobj->time->tz_info = dpobj->start->tz_info;
+ }
+}
+/* }}} */
+
+/* {{{ proto DatePeriod::getEndDate()
+ Get end date.
+*/
+PHP_METHOD(DatePeriod, getEndDate)
+{
+ php_period_obj *dpobj;
+ php_date_obj *dateobj;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ dpobj = Z_PHPPERIOD_P(getThis());
+
+ php_date_instantiate(dpobj->start_ce, return_value TSRMLS_CC);
+ dateobj = Z_PHPDATE_P(return_value);
+ dateobj->time = timelib_time_ctor();
+ *dateobj->time = *dpobj->end;
+ if (dpobj->end->tz_abbr) {
+ dateobj->time->tz_abbr = strdup(dpobj->end->tz_abbr);
+ }
+ if (dpobj->end->tz_info) {
+ dateobj->time->tz_info = dpobj->end->tz_info;
+ }
+}
+/* }}} */
+
+/* {{{ proto DatePeriod::getDateInterval()
+ Get date interval.
+*/
+PHP_METHOD(DatePeriod, getDateInterval)
+{
+ php_period_obj *dpobj;
+ php_interval_obj *diobj;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ dpobj = Z_PHPPERIOD_P(getThis());
+
+ php_date_instantiate(date_ce_interval, return_value TSRMLS_CC);
+ diobj = Z_PHPINTERVAL_P(return_value);
+ diobj->diff = timelib_rel_time_clone(dpobj->interval);
+ diobj->initialized = 1;
+}
+/* }}} */
+
static int check_id_allowed(char *id, zend_long what) /* {{{ */
{
if (what & PHP_DATE_TIMEZONE_GROUP_AFRICA && strncasecmp(id, "Africa/", 7) == 0) return 1;
diff --git a/ext/date/php_date.h b/ext/date/php_date.h
index 3a938fe74f..667a552218 100644
--- a/ext/date/php_date.h
+++ b/ext/date/php_date.h
@@ -106,6 +106,9 @@ PHP_FUNCTION(date_interval_create_from_date_string);
PHP_METHOD(DatePeriod, __construct);
PHP_METHOD(DatePeriod, __wakeup);
PHP_METHOD(DatePeriod, __set_state);
+PHP_METHOD(DatePeriod, getStartDate);
+PHP_METHOD(DatePeriod, getEndDate);
+PHP_METHOD(DatePeriod, getDateInterval);
/* Options and Configuration */
PHP_FUNCTION(date_default_timezone_set);
diff --git a/ext/date/tests/DatePeriod_getter.phpt b/ext/date/tests/DatePeriod_getter.phpt
new file mode 100644
index 0000000000..22006d1ae8
--- /dev/null
+++ b/ext/date/tests/DatePeriod_getter.phpt
@@ -0,0 +1,25 @@
+--TEST--
+DatePeriod: Test getter
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+$start = new DateTime('2000-01-01 00:00:00', new DateTimeZone('Europe/Berlin'));
+$end = new DateTime('2000-01-31 00:00:00', new DateTimeZone('UTC'));
+$interval = new DateInterval('P1D');
+$period = new DatePeriod($start, $interval, $end);
+
+var_dump($period->getStartDate()->format('Y-m-d H:i:s'));
+var_dump($period->getStartDate()->getTimeZone()->getName());
+
+var_dump($period->getEndDate()->format('Y-m-d H:i:s'));
+var_dump($period->getEndDate()->getTimeZone()->getName());
+
+var_dump($period->getDateInterval()->format('%R%y-%m-%d-%h-%i-%s'));
+?>
+--EXPECTF--
+string(19) "2000-01-01 00:00:00"
+string(13) "Europe/Berlin"
+string(19) "2000-01-31 00:00:00"
+string(3) "UTC"
+string(12) "+0-0-1-0-0-0"
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c
index 78d471c9d6..5d1d1e689e 100644
--- a/ext/gmp/gmp.c
+++ b/ext/gmp/gmp.c
@@ -104,6 +104,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_random, 0, 0, 0)
ZEND_ARG_INFO(0, limiter)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_random_seed, 0, 0, 1)
+ ZEND_ARG_INFO(0, seed)
+ZEND_END_ARG_INFO()
+
ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_random_bits, 0, 0, 1)
ZEND_ARG_INFO(0, bits)
ZEND_END_ARG_INFO()
@@ -170,6 +174,7 @@ const zend_function_entry gmp_functions[] = {
ZEND_FE(gmp_cmp, arginfo_gmp_binary)
ZEND_FE(gmp_sign, arginfo_gmp_unary)
ZEND_FE(gmp_random, arginfo_gmp_random)
+ ZEND_FE(gmp_random_seed, arginfo_gmp_random_seed)
ZEND_FE(gmp_random_bits, arginfo_gmp_random_bits)
ZEND_FE(gmp_random_range, arginfo_gmp_random_range)
ZEND_FE(gmp_and, arginfo_gmp_binary)
@@ -1768,6 +1773,33 @@ ZEND_FUNCTION(gmp_random)
}
/* }}} */
+/* {{{ proto GMP gmp_random_seed(mixed seed)
+ Seed the RNG */
+ZEND_FUNCTION(gmp_random_seed)
+{
+ zval *seed;
+ mpz_ptr gmpnum_seed;
+ gmp_temp_t temp_a;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &seed) == FAILURE) {
+ return;
+ }
+
+ gmp_init_random(TSRMLS_C);
+
+ if (Z_TYPE_P(seed) == IS_LONG && Z_LVAL_P(seed) >= 0) {
+ gmp_randseed_ui(GMPG(rand_state), Z_LVAL_P(seed));
+ }
+ else {
+ FETCH_GMP_ZVAL(gmpnum_seed, seed, temp_a);
+
+ gmp_randseed(GMPG(rand_state), gmpnum_seed);
+
+ FREE_GMP_TEMP(temp_a);
+ }
+}
+/* }}} */
+
/* {{{ proto GMP gmp_random_bits(int bits)
Gets a random number in the range 0 to (2 ** n) - 1 */
ZEND_FUNCTION(gmp_random_bits)
diff --git a/ext/gmp/php_gmp.h b/ext/gmp/php_gmp.h
index 7e8e51b291..27d621bb39 100644
--- a/ext/gmp/php_gmp.h
+++ b/ext/gmp/php_gmp.h
@@ -66,6 +66,7 @@ ZEND_FUNCTION(gmp_or);
ZEND_FUNCTION(gmp_com);
ZEND_FUNCTION(gmp_xor);
ZEND_FUNCTION(gmp_random);
+ZEND_FUNCTION(gmp_random_seed);
ZEND_FUNCTION(gmp_random_bits);
ZEND_FUNCTION(gmp_random_range);
ZEND_FUNCTION(gmp_setbit);
diff --git a/ext/gmp/tests/gmp_random_seed.phpt b/ext/gmp/tests/gmp_random_seed.phpt
new file mode 100644
index 0000000000..3a832467bb
--- /dev/null
+++ b/ext/gmp/tests/gmp_random_seed.phpt
@@ -0,0 +1,229 @@
+--TEST--
+gmp_random_seed() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
+--FILE--
+<?php
+
+// zero int
+var_dump(gmp_random_seed(0));
+
+var_dump(gmp_strval(gmp_random()));
+var_dump(gmp_strval(gmp_random(1)));
+var_dump(gmp_strval(gmp_random(10)));
+
+var_dump(gmp_strval(gmp_random_bits(10)));
+var_dump(gmp_strval(gmp_random_bits(100)));
+var_dump(gmp_strval(gmp_random_bits(1000)));
+
+var_dump(gmp_strval(gmp_random_range(0, 10000)));
+var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
+var_dump(gmp_strval(gmp_random_range(-10000, 0)));
+
+
+// zero gmp
+var_dump(gmp_random_seed(gmp_init(0)));
+
+var_dump(gmp_strval(gmp_random()));
+var_dump(gmp_strval(gmp_random(1)));
+var_dump(gmp_strval(gmp_random(10)));
+
+var_dump(gmp_strval(gmp_random_bits(10)));
+var_dump(gmp_strval(gmp_random_bits(100)));
+var_dump(gmp_strval(gmp_random_bits(1000)));
+
+var_dump(gmp_strval(gmp_random_range(0, 10000)));
+var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
+var_dump(gmp_strval(gmp_random_range(-10000, 0)));
+
+
+// negative int
+var_dump(gmp_random_seed(-100));
+
+var_dump(gmp_strval(gmp_random()));
+var_dump(gmp_strval(gmp_random(1)));
+var_dump(gmp_strval(gmp_random(10)));
+
+var_dump(gmp_strval(gmp_random_bits(10)));
+var_dump(gmp_strval(gmp_random_bits(100)));
+var_dump(gmp_strval(gmp_random_bits(1000)));
+
+var_dump(gmp_strval(gmp_random_range(0, 10000)));
+var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
+var_dump(gmp_strval(gmp_random_range(-10000, 0)));
+
+
+// negative gmp
+var_dump(gmp_random_seed(gmp_init(-100)));
+
+var_dump(gmp_strval(gmp_random()));
+var_dump(gmp_strval(gmp_random(1)));
+var_dump(gmp_strval(gmp_random(10)));
+
+var_dump(gmp_strval(gmp_random_bits(10)));
+var_dump(gmp_strval(gmp_random_bits(100)));
+var_dump(gmp_strval(gmp_random_bits(1000)));
+
+var_dump(gmp_strval(gmp_random_range(0, 10000)));
+var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
+var_dump(gmp_strval(gmp_random_range(-10000, 0)));
+
+
+// positive int
+var_dump(gmp_random_seed(100));
+
+var_dump(gmp_strval(gmp_random()));
+var_dump(gmp_strval(gmp_random(1)));
+var_dump(gmp_strval(gmp_random(10)));
+
+var_dump(gmp_strval(gmp_random_bits(10)));
+var_dump(gmp_strval(gmp_random_bits(100)));
+var_dump(gmp_strval(gmp_random_bits(1000)));
+
+var_dump(gmp_strval(gmp_random_range(0, 10000)));
+var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
+var_dump(gmp_strval(gmp_random_range(-10000, 0)));
+
+
+// positive gmp
+var_dump(gmp_random_seed(100));
+
+var_dump(gmp_strval(gmp_random()));
+var_dump(gmp_strval(gmp_random(1)));
+var_dump(gmp_strval(gmp_random(10)));
+
+var_dump(gmp_strval(gmp_random_bits(10)));
+var_dump(gmp_strval(gmp_random_bits(100)));
+var_dump(gmp_strval(gmp_random_bits(1000)));
+
+var_dump(gmp_strval(gmp_random_range(0, 10000)));
+var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
+var_dump(gmp_strval(gmp_random_range(-10000, 0)));
+
+
+$seed = gmp_init(1);
+$seed <<= 512;
+
+// large negative gmp
+var_dump(gmp_random_seed($seed * -1));
+
+var_dump(gmp_strval(gmp_random()));
+var_dump(gmp_strval(gmp_random(1)));
+var_dump(gmp_strval(gmp_random(10)));
+
+var_dump(gmp_strval(gmp_random_bits(10)));
+var_dump(gmp_strval(gmp_random_bits(100)));
+var_dump(gmp_strval(gmp_random_bits(1000)));
+
+var_dump(gmp_strval(gmp_random_range(0, 10000)));
+var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
+var_dump(gmp_strval(gmp_random_range(-10000, 0)));
+
+
+// large positive gmp
+var_dump(gmp_random_seed($seed));
+
+var_dump(gmp_strval(gmp_random()));
+var_dump(gmp_strval(gmp_random(1)));
+var_dump(gmp_strval(gmp_random(10)));
+
+var_dump(gmp_strval(gmp_random_bits(10)));
+var_dump(gmp_strval(gmp_random_bits(100)));
+var_dump(gmp_strval(gmp_random_bits(1000)));
+
+var_dump(gmp_strval(gmp_random_range(0, 10000)));
+var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
+var_dump(gmp_strval(gmp_random_range(-10000, 0)));
+
+
+// standard non conversion error
+var_dump(gmp_random_seed('not a number'));
+
+
+echo "Done\n";
+?>
+--EXPECTF--
+NULL
+string(386) "16100871751340485642888774479422205950971474538471317276388238970713821926852258806210387669237144400278914671533438653274777493140545293541785377162348524402063489947660558889561219968642920852870483050552936324125257259316643328803697665037881088889859735075814746314563786538493931260996669892959501637800179548654075887300734264333417283208357503038004080669367070111848040502362219"
+string(18) "255344473360201232"
+string(192) "566276705882089203328999735915155615747289398229935944715725865523491463654289449864817867794422824157675456435165973986660058784111212531276312901205233176071526587181942240113004108328736022"
+string(3) "766"
+string(31) "1251852006013618829761115383588"
+string(301) "2904442664575028522451529381233481137998826790384445089758175726247096826023839957531211794198483328480161675791738894500687706952157332727908305084432443942315866545175274665372161864357698401817740956147940095302549920711069038378541222669595494627580205085300332122174778540693048337420608925104417"
+string(4) "5969"
+string(5) "-4126"
+string(4) "-926"
+NULL
+string(386) "16100871751340485642888774479422205950971474538471317276388238970713821926852258806210387669237144400278914671533438653274777493140545293541785377162348524402063489947660558889561219968642920852870483050552936324125257259316643328803697665037881088889859735075814746314563786538493931260996669892959501637800179548654075887300734264333417283208357503038004080669367070111848040502362219"
+string(18) "255344473360201232"
+string(192) "566276705882089203328999735915155615747289398229935944715725865523491463654289449864817867794422824157675456435165973986660058784111212531276312901205233176071526587181942240113004108328736022"
+string(3) "766"
+string(31) "1251852006013618829761115383588"
+string(301) "2904442664575028522451529381233481137998826790384445089758175726247096826023839957531211794198483328480161675791738894500687706952157332727908305084432443942315866545175274665372161864357698401817740956147940095302549920711069038378541222669595494627580205085300332122174778540693048337420608925104417"
+string(4) "5969"
+string(5) "-4126"
+string(4) "-926"
+NULL
+string(386) "13477111096113160882601567427091178332669645276785709413953468738199940626922635042144840457533224221336117027441609364710893482124071124759231943384805378201041406842697962243732316555316214869988749798708139879922380266366387589101775891621221881149417841139463207495993669582399783202126977651864760442797681787747348653884279195479310922110107643437514016795836672871442926389274400"
+string(20) "15370156633245019617"
+string(192) "294354325919119835375781661354719128667828860233586416953977190644006896604022494655398295674227944872858213051595447565156112646032890737200590095517623075051828676500990477704073251304424133"
+string(3) "683"
+string(31) "1105092118036828878542238774672"
+string(301) "2700084798786584694260166508009114488318099110808331607090845844712329387915039325877090587052399841255219556028410036280510827424748532204766771994624650610348058361519239518625728955462297681525123214377383395734875500143425080808436274385326255154393544373636015993206705180032889399161843788895374"
+string(4) "7268"
+string(5) "-3518"
+string(5) "-8432"
+NULL
+string(386) "13477111096113160882601567427091178332669645276785709413953468738199940626922635042144840457533224221336117027441609364710893482124071124759231943384805378201041406842697962243732316555316214869988749798708139879922380266366387589101775891621221881149417841139463207495993669582399783202126977651864760442797681787747348653884279195479310922110107643437514016795836672871442926389274400"
+string(20) "15370156633245019617"
+string(192) "294354325919119835375781661354719128667828860233586416953977190644006896604022494655398295674227944872858213051595447565156112646032890737200590095517623075051828676500990477704073251304424133"
+string(3) "683"
+string(31) "1105092118036828878542238774672"
+string(301) "2700084798786584694260166508009114488318099110808331607090845844712329387915039325877090587052399841255219556028410036280510827424748532204766771994624650610348058361519239518625728955462297681525123214377383395734875500143425080808436274385326255154393544373636015993206705180032889399161843788895374"
+string(4) "7268"
+string(5) "-3518"
+string(5) "-8432"
+NULL
+string(386) "13477111096113160882601567427091178332669645276785709413953468738199940626922635042144840457533224221336117027441609364710893482124071124759231943384805378201041406842697962243732316555316214869988749798708139879922380266366387589101775891621221881149417841139463207495993669582399783202126977651864760442797681787747348653884279195479310922110107643437514016795836672871442926389274400"
+string(20) "15370156633245019617"
+string(192) "294354325919119835375781661354719128667828860233586416953977190644006896604022494655398295674227944872858213051595447565156112646032890737200590095517623075051828676500990477704073251304424133"
+string(3) "683"
+string(31) "1105092118036828878542238774672"
+string(301) "2700084798786584694260166508009114488318099110808331607090845844712329387915039325877090587052399841255219556028410036280510827424748532204766771994624650610348058361519239518625728955462297681525123214377383395734875500143425080808436274385326255154393544373636015993206705180032889399161843788895374"
+string(4) "7268"
+string(5) "-3518"
+string(5) "-8432"
+NULL
+string(386) "13477111096113160882601567427091178332669645276785709413953468738199940626922635042144840457533224221336117027441609364710893482124071124759231943384805378201041406842697962243732316555316214869988749798708139879922380266366387589101775891621221881149417841139463207495993669582399783202126977651864760442797681787747348653884279195479310922110107643437514016795836672871442926389274400"
+string(20) "15370156633245019617"
+string(192) "294354325919119835375781661354719128667828860233586416953977190644006896604022494655398295674227944872858213051595447565156112646032890737200590095517623075051828676500990477704073251304424133"
+string(3) "683"
+string(31) "1105092118036828878542238774672"
+string(301) "2700084798786584694260166508009114488318099110808331607090845844712329387915039325877090587052399841255219556028410036280510827424748532204766771994624650610348058361519239518625728955462297681525123214377383395734875500143425080808436274385326255154393544373636015993206705180032889399161843788895374"
+string(4) "7268"
+string(5) "-3518"
+string(5) "-8432"
+NULL
+string(386) "17517289823903393220742578279919954815229524740463730368402128237511862318453381595675765692750750649609755422480004471234960388086555321894591036872550129477305413674775698107868844953599169316550102271816620108199930104365341610775602960735862041722613145476720452800951958891882288668416542937408952006310656170195090436314902430700708511047189929836145291647101130135292078875631354"
+string(19) "1662391866670215057"
+string(193) "1951928859951518261564127834731454911658112769477733872890285741065126442731035642243573666695893929882207432512593006044657806021743917753379619843420559355572830613932424235592411658293328273"
+string(3) "888"
+string(30) "136524289584478309125073026188"
+string(301) "4487372666528061674404740793683112894444118579769413902123304803304884162086348577960502430419080687314731489440882833272125181594897832730214825704339272207090970657364333461383490282984012738008555512699878911293400686609929745464733074891420787002129849587668122219953473716759349853748437799165176"
+string(4) "8559"
+string(4) "9426"
+string(5) "-2932"
+NULL
+string(386) "17517289823903393220742578279919954815229524740463730368402128237511862318453381595675765692750750649609755422480004471234960388086555321894591036872550129477305413674775698107868844953599169316550102271816620108199930104365341610775602960735862041722613145476720452800951958891882288668416542937408952006310656170195090436314902430700708511047189929836145291647101130135292078875631354"
+string(19) "1662391866670215057"
+string(193) "1951928859951518261564127834731454911658112769477733872890285741065126442731035642243573666695893929882207432512593006044657806021743917753379619843420559355572830613932424235592411658293328273"
+string(3) "888"
+string(30) "136524289584478309125073026188"
+string(301) "4487372666528061674404740793683112894444118579769413902123304803304884162086348577960502430419080687314731489440882833272125181594897832730214825704339272207090970657364333461383490282984012738008555512699878911293400686609929745464733074891420787002129849587668122219953473716759349853748437799165176"
+string(4) "8559"
+string(4) "9426"
+string(5) "-2932"
+
+Warning: gmp_random_seed(): Unable to convert variable to GMP - string is not an integer in %s on line %d
+bool(false)
+Done
diff --git a/ext/intl/collator/collator_attr.h b/ext/intl/collator/collator_attr.h
index b86365ff5e..aefdd15f9f 100644
--- a/ext/intl/collator/collator_attr.h
+++ b/ext/intl/collator/collator_attr.h
@@ -16,7 +16,7 @@
*/
#ifndef COLLATOR_ATTR_H
-#define CCOLLATOR_ATTR_H
+#define COLLATOR_ATTR_H
#include <php.h>
diff --git a/ext/intl/tests/bug67052.phpt b/ext/intl/tests/bug67052.phpt
index 8edd65de71..80c7e88017 100644
--- a/ext/intl/tests/bug67052.phpt
+++ b/ext/intl/tests/bug67052.phpt
@@ -6,6 +6,11 @@ Bug #67052 - NumberFormatter::parse() resets LC_NUMERIC setting
if (substr(PHP_OS, 0, 3) == 'WIN') {
die("skip Valid only on non Windows");
}
+$l = setlocale(LC_ALL, 'de_DE');
+if($l === false) {
+ die("skip de_DE locale not installed");
+}
+setlocale(LC_ALL, $l);
?>
--FILE--
<?php
diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c
index 589028368f..32009791ed 100644
--- a/ext/opcache/Optimizer/zend_optimizer.c
+++ b/ext/opcache/Optimizer/zend_optimizer.c
@@ -65,7 +65,7 @@ int zend_optimizer_lookup_cv(zend_op_array *op_array, zend_string* name)
(op_array->vars[i]->h == hash_value &&
op_array->vars[i]->len == name->len &&
memcmp(op_array->vars[i]->val, name->val, name->len) == 0)) {
- return (int)(zend_intptr_t)EX_VAR_NUM_2(NULL, i);
+ return (int)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, i);
}
i++;
}
@@ -96,7 +96,7 @@ int zend_optimizer_lookup_cv(zend_op_array *op_array, zend_string* name)
}
}
- return (int)(zend_intptr_t)EX_VAR_NUM_2(NULL, i);
+ return (int)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, i);
}
int zend_optimizer_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC)
diff --git a/ext/opcache/Optimizer/zend_optimizer_internal.h b/ext/opcache/Optimizer/zend_optimizer_internal.h
index ba91b147c9..ee44bf671c 100644
--- a/ext/opcache/Optimizer/zend_optimizer_internal.h
+++ b/ext/opcache/Optimizer/zend_optimizer_internal.h
@@ -25,7 +25,7 @@
#include "ZendAccelerator.h"
#define VAR_NUM(v) EX_VAR_TO_NUM(v)
-#define NUM_VAR(v) ((uint32_t)(zend_uintptr_t)EX_VAR_NUM_2(0, v))
+#define NUM_VAR(v) ((uint32_t)(zend_uintptr_t)ZEND_CALL_VAR_NUM(0, v))
#define INV_COND(op) ((op) == ZEND_JMPZ ? ZEND_JMPNZ : ZEND_JMPZ)
#define INV_EX_COND(op) ((op) == ZEND_JMPZ_EX ? ZEND_JMPNZ : ZEND_JMPZ)
diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c
index 3e91740a71..f6ade86acf 100644
--- a/ext/opcache/zend_persist.c
+++ b/ext/opcache/zend_persist.c
@@ -419,12 +419,10 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
zend_accel_store(op_array->arg_info, sizeof(zend_arg_info) * op_array->num_args);
for (i = 0; i < op_array->num_args; i++) {
if (op_array->arg_info[i].name) {
-//??? zend_accel_store_interned_string(op_array->arg_info[i].name, op_array->arg_info[i].name_len + 1);
- zend_accel_store(op_array->arg_info[i].name, op_array->arg_info[i].name_len + 1);
+ zend_accel_store_interned_string(op_array->arg_info[i].name);
}
if (op_array->arg_info[i].class_name) {
-//??? zend_accel_store_interned_string(op_array->arg_info[i].class_name, op_array->arg_info[i].class_name_len + 1);
- zend_accel_store(op_array->arg_info[i].class_name, op_array->arg_info[i].class_name_len + 1);
+ zend_accel_store_interned_string(op_array->arg_info[i].class_name);
}
}
}
diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c
index 0a7b835648..6a35c5ca9b 100644
--- a/ext/opcache/zend_persist_calc.c
+++ b/ext/opcache/zend_persist_calc.c
@@ -199,12 +199,10 @@ static void zend_persist_op_array_calc_ex(zend_op_array *op_array TSRMLS_DC)
ADD_DUP_SIZE(op_array->arg_info, sizeof(zend_arg_info) * op_array->num_args);
for (i = 0; i < op_array->num_args; i++) {
if (op_array->arg_info[i].name) {
-//??? ADD_INTERNED_STRING(op_array->arg_info[i].name, op_array->arg_info[i].name_len + 1);
- ADD_SIZE(op_array->arg_info[i].name_len + 1);
+ ADD_INTERNED_STRING(op_array->arg_info[i].name, 1);
}
if (op_array->arg_info[i].class_name) {
-//??? ADD_INTERNED_STRING(op_array->arg_info[i].class_name, op_array->arg_info[i].class_name_len + 1);
- ADD_SIZE(op_array->arg_info[i].class_name_len + 1);
+ ADD_INTERNED_STRING(op_array->arg_info[i].class_name, 1);
}
}
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index c4b155b478..60d36ff743 100755
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -3595,6 +3595,7 @@ PHP_FUNCTION(openssl_pkey_export_to_file)
char * filename = NULL;
size_t filename_len = 0;
zend_resource *key_resource = NULL;
+ int pem_write = 0;
EVP_PKEY * key;
BIO * bio_out = NULL;
const EVP_CIPHER * cipher;
@@ -3629,7 +3630,19 @@ PHP_FUNCTION(openssl_pkey_export_to_file)
} else {
cipher = NULL;
}
- if (PEM_write_bio_PrivateKey(bio_out, key, cipher, (unsigned char *)passphrase, passphrase_len, NULL, NULL)) {
+
+ switch (EVP_PKEY_type(key->type)) {
+#ifdef HAVE_EVP_PKEY_EC
+ case EVP_PKEY_EC:
+ pem_write = PEM_write_bio_ECPrivateKey(bio_out, EVP_PKEY_get1_EC_KEY(key), cipher, (unsigned char *)passphrase, passphrase_len, NULL, NULL);
+ break;
+#endif
+ default:
+ pem_write = PEM_write_bio_PrivateKey(bio_out, key, cipher, (unsigned char *)passphrase, passphrase_len, NULL, NULL);
+ break;
+ }
+
+ if (pem_write) {
/* Success!
* If returning the output as a string, do so now */
RETVAL_TRUE;
@@ -3653,6 +3666,7 @@ PHP_FUNCTION(openssl_pkey_export)
struct php_x509_request req;
zval * zpkey, * args = NULL, *out;
char * passphrase = NULL; size_t passphrase_len = 0;
+ int pem_write = 0;
zend_resource *key_resource = NULL;
EVP_PKEY * key;
BIO * bio_out = NULL;
@@ -3684,7 +3698,19 @@ PHP_FUNCTION(openssl_pkey_export)
} else {
cipher = NULL;
}
- if (PEM_write_bio_PrivateKey(bio_out, key, cipher, (unsigned char *)passphrase, passphrase_len, NULL, NULL)) {
+
+ switch (EVP_PKEY_type(key->type)) {
+#ifdef HAVE_EVP_PKEY_EC
+ case EVP_PKEY_EC:
+ pem_write = PEM_write_bio_ECPrivateKey(bio_out, EVP_PKEY_get1_EC_KEY(key), cipher, (unsigned char *)passphrase, passphrase_len, NULL, NULL);
+ break;
+#endif
+ default:
+ pem_write = PEM_write_bio_PrivateKey(bio_out, key, cipher, (unsigned char *)passphrase, passphrase_len, NULL, NULL);
+ break;
+ }
+
+ if (pem_write) {
/* Success!
* If returning the output as a string, do so now */
@@ -3853,6 +3879,39 @@ PHP_FUNCTION(openssl_pkey_get_details)
#ifdef HAVE_EVP_PKEY_EC
case EVP_PKEY_EC:
ktype = OPENSSL_KEYTYPE_EC;
+ if (pkey->pkey.ec != NULL) {
+ zval ec;
+ const EC_GROUP *ec_group;
+ int nid;
+ char *crv_sn;
+ ASN1_OBJECT *obj;
+ // openssl recommends a buffer length of 80
+ char oir_buf[80];
+
+ ec_group = EC_KEY_get0_group(EVP_PKEY_get1_EC_KEY(pkey));
+
+ // Curve nid (numerical identifier) used for ASN1 mapping
+ nid = EC_GROUP_get_curve_name(ec_group);
+ if (nid == NID_undef) {
+ break;
+ }
+ array_init(&ec);
+
+ // Short object name
+ crv_sn = (char*) OBJ_nid2sn(nid);
+ if (crv_sn != NULL) {
+ add_assoc_string(&ec, "curve_name", crv_sn);
+ }
+
+ obj = OBJ_nid2obj(nid);
+ if (obj != NULL) {
+ int oir_len = OBJ_obj2txt(oir_buf, sizeof(oir_buf), obj, 1);
+ add_assoc_stringl(&ec, "curve_oid", (char*)oir_buf, oir_len);
+ ASN1_OBJECT_free(obj);
+ }
+
+ add_assoc_zval(return_value, "ec", &ec);
+ }
break;
#endif
default:
diff --git a/ext/openssl/tests/027.phpt b/ext/openssl/tests/027.phpt
new file mode 100644
index 0000000000..8311ab1bd9
--- /dev/null
+++ b/ext/openssl/tests/027.phpt
@@ -0,0 +1,52 @@
+--TEST--
+openssl_pkey_export() with EC key
+--SKIPIF--
+<?php
+if (!extension_loaded("openssl")) die("skip");
+if (!defined('OPENSSL_KEYTYPE_EC')) die("skip no EC available");
+?>
+--FILE--
+<?php
+$key = openssl_pkey_get_private('file://' . dirname(__FILE__) . '/private_ec.key');
+var_dump($key);
+
+var_dump(openssl_pkey_export($key, $output));
+echo $output;
+
+// Load the private key from the exported pem string
+$details = openssl_pkey_get_details(openssl_pkey_get_private($output));
+var_dump(OPENSSL_KEYTYPE_EC === $details['type']);
+
+// Export key with passphrase
+openssl_pkey_export($key, $output, 'passphrase');
+
+$details = openssl_pkey_get_details(openssl_pkey_get_private($output, 'passphrase'));
+var_dump(OPENSSL_KEYTYPE_EC === $details['type']);
+
+// Read public key
+$pKey = openssl_pkey_get_public('file://' . dirname(__FILE__) . '/public_ec.key');
+var_dump($pKey);
+// The details are the same for a public or private key
+var_dump($details === openssl_pkey_get_details($pKey));
+
+
+// Export to file
+$tempname = tempnam(sys_get_temp_dir(), 'openssl_ec');
+var_dump(openssl_pkey_export_to_file($key, $tempname));
+$details = openssl_pkey_get_details(openssl_pkey_get_private('file://' . $tempname));
+var_dump(OPENSSL_KEYTYPE_EC === $details['type']);
+
+// Clean the temporary file
+@unlink($tempname);
+
+?>
+--EXPECTF--
+resource(%d) of type (OpenSSL key)
+bool(true)
+-----BEGIN EC PRIVATE KEY-----%a-----END EC PRIVATE KEY-----
+bool(true)
+bool(true)
+resource(%d) of type (OpenSSL key)
+bool(true)
+bool(true)
+bool(true)
diff --git a/ext/openssl/tests/028.phpt b/ext/openssl/tests/028.phpt
new file mode 100644
index 0000000000..8e0cef46c0
--- /dev/null
+++ b/ext/openssl/tests/028.phpt
@@ -0,0 +1,28 @@
+--TEST--
+openssl_pkey_get_details() with EC key
+--SKIPIF--
+<?php
+if (!extension_loaded("openssl")) die("skip");
+if (!defined('OPENSSL_KEYTYPE_EC')) die("skip no EC available");
+?>
+--FILE--
+<?php
+$key = openssl_pkey_get_private('file://' . dirname(__FILE__) . '/private_ec.key');
+
+print_r(openssl_pkey_get_details($key));
+?>
+--EXPECTF--
+Array
+(
+ [bits] => 256
+ [key] => -----BEGIN PUBLIC KEY-----%a
+-----END PUBLIC KEY-----
+
+ [ec] => Array
+ (
+ [curve_name] => prime256v1
+ [curve_oid] => 1.2.840.10045.3.1.7
+ )
+
+ [type] => 3
+)
diff --git a/ext/openssl/tests/private_ec.key b/ext/openssl/tests/private_ec.key
new file mode 100644
index 0000000000..51cdcb728b
--- /dev/null
+++ b/ext/openssl/tests/private_ec.key
@@ -0,0 +1,5 @@
+-----BEGIN EC PRIVATE KEY-----
+MHcCAQEEILPkqoeyM7XgwYkuSj3077lrsrfWJK5LqMolv+m2oOjZoAoGCCqGSM49
+AwEHoUQDQgAEPq4hbIWHvB51rdWr8ejrjWo4qVNWVugYFtPg/xLQw0mHkIPZ4DvK
+sqOTOnMoezkbSmVVMuwz9flvnqHGmQvmug==
+-----END EC PRIVATE KEY-----
diff --git a/ext/openssl/tests/public_ec.key b/ext/openssl/tests/public_ec.key
new file mode 100644
index 0000000000..a93b2c8ab4
--- /dev/null
+++ b/ext/openssl/tests/public_ec.key
@@ -0,0 +1,4 @@
+-----BEGIN PUBLIC KEY-----
+MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEPq4hbIWHvB51rdWr8ejrjWo4qVNW
+VugYFtPg/xLQw0mHkIPZ4DvKsqOTOnMoezkbSmVVMuwz9flvnqHGmQvmug==
+-----END PUBLIC KEY-----
diff --git a/ext/openssl/tests/stream_server_reneg_limit.phpt b/ext/openssl/tests/stream_server_reneg_limit.phpt
index 3abaa48e41..d355505e54 100644
--- a/ext/openssl/tests/stream_server_reneg_limit.phpt
+++ b/ext/openssl/tests/stream_server_reneg_limit.phpt
@@ -6,6 +6,10 @@ if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
exec('openssl help', $out, $code);
if ($code > 0) die("skip couldn't locate openssl binary");
+if(substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip not suitable for Windows');
+}
+?>
--FILE--
<?php
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
index 11ad1018ec..301002132c 100644
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@ -873,6 +873,7 @@ PHP_FUNCTION(pcntl_signal)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error assigning signal");
RETURN_FALSE;
}
+ zend_hash_index_del(&PCNTL_G(php_signal_table), signo);
RETURN_TRUE;
}
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c
index 8e35c1ee9a..571e08b4c0 100644
--- a/ext/pdo/pdo_dbh.c
+++ b/ext/pdo/pdo_dbh.c
@@ -1300,7 +1300,7 @@ int pdo_hash_methods(pdo_dbh_object_t *dbh_obj, int kind TSRMLS_DC)
if (funcs->arg_info) {
zend_internal_function_info *info = (zend_internal_function_info*)funcs->arg_info;
- ifunc->arg_info = (zend_arg_info*)funcs->arg_info + 1;
+ ifunc->arg_info = (zend_internal_arg_info*)funcs->arg_info + 1;
ifunc->num_args = funcs->num_args;
if (info->required_num_args == -1) {
ifunc->required_num_args = funcs->num_args;
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 140e681dfb..87901c7933 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -688,7 +688,10 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg
string_printf(str, "<required> ");
}
if (arg_info->class_name) {
- string_printf(str, "%s ", arg_info->class_name);
+ string_printf(str, "%s ",
+ (fptr->type == ZEND_INTERNAL_FUNCTION) ?
+ ((zend_internal_arg_info*)arg_info)->class_name :
+ arg_info->class_name->val);
if (arg_info->allow_null) {
string_printf(str, "or NULL ");
}
@@ -705,7 +708,10 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg
string_write(str, "...", sizeof("...")-1);
}
if (arg_info->name) {
- string_printf(str, "$%s", arg_info->name);
+ string_printf(str, "$%s",
+ (fptr->type == ZEND_INTERNAL_FUNCTION) ?
+ ((zend_internal_arg_info*)arg_info)->name :
+ arg_info->name->val);
} else {
string_printf(str, "$param%d", offset);
}
@@ -1226,7 +1232,11 @@ static void reflection_parameter_factory(zend_function *fptr, zval *closure_obje
zval name;
if (arg_info->name) {
- ZVAL_STRINGL(&name, arg_info->name, arg_info->name_len);
+ if (fptr->type == ZEND_INTERNAL_FUNCTION) {
+ ZVAL_STRING(&name, ((zend_internal_arg_info*)arg_info)->name);
+ } else {
+ ZVAL_STR(&name, zend_string_copy(arg_info->name));
+ }
} else {
ZVAL_NULL(&name);
}
@@ -2127,6 +2137,7 @@ ZEND_METHOD(reflection_parameter, __construct)
int position;
zend_class_entry *ce = NULL;
zend_bool is_closure = 0;
+ zend_bool is_invoke = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &reference, &parameter) == FAILURE) {
return;
@@ -2188,9 +2199,10 @@ ZEND_METHOD(reflection_parameter, __construct)
&& (lcname_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
&& memcmp(lcname, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
&& (fptr = zend_get_closure_invoke_method(Z_OBJ_P(classref) TSRMLS_CC)) != NULL)
- {
+ {
/* nothing to do. don't set is_closure since is the invoke handler,
-- not the closure itself */
+ not the closure itself */
+ is_invoke = 1;
} else if ((fptr = zend_hash_str_find_ptr(&ce->function_table, lcname, lcname_len)) == NULL) {
efree(lcname);
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
@@ -2243,10 +2255,24 @@ ZEND_METHOD(reflection_parameter, __construct)
position= -1;
convert_to_string_ex(parameter);
- for (i = 0; i < fptr->common.num_args; i++) {
- if (arg_info[i].name && strcmp(arg_info[i].name, Z_STRVAL_P(parameter)) == 0) {
- position= i;
- break;
+ if (!is_invoke && fptr->type == ZEND_INTERNAL_FUNCTION) {
+ for (i = 0; i < fptr->common.num_args; i++) {
+ if (arg_info[i].name) {
+ if (strcmp(((zend_internal_arg_info*)arg_info)[i].name, Z_STRVAL_P(parameter)) == 0) {
+ position= i;
+ break;
+ }
+
+ }
+ }
+ } else {
+ for (i = 0; i < fptr->common.num_args; i++) {
+ if (arg_info[i].name) {
+ if (strcmp(arg_info[i].name->val, Z_STRVAL_P(parameter)) == 0) {
+ position= i;
+ break;
+ }
+ }
}
}
if (position == -1) {
@@ -2265,7 +2291,11 @@ ZEND_METHOD(reflection_parameter, __construct)
}
if (arg_info[position].name) {
- ZVAL_STRINGL(&name, arg_info[position].name, arg_info[position].name_len);
+ if (fptr->type == ZEND_INTERNAL_FUNCTION) {
+ ZVAL_STRING(&name, ((zend_internal_arg_info*)arg_info)[position].name);
+ } else {
+ ZVAL_STR(&name, zend_string_copy(arg_info[position].name));
+ }
} else {
ZVAL_NULL(&name);
}
@@ -2379,14 +2409,24 @@ ZEND_METHOD(reflection_parameter, getClass)
* TODO: Think about moving these checks to the compiler or some sort of
* lint-mode.
*/
- if (0 == zend_binary_strcasecmp(param->arg_info->class_name, param->arg_info->class_name_len, "self", sizeof("self")- 1)) {
+ const char *class_name;
+ size_t class_name_len;
+
+ if (param->fptr->type == ZEND_INTERNAL_FUNCTION) {
+ class_name = ((zend_internal_arg_info*)param->arg_info)->class_name;
+ class_name_len = strlen(class_name);
+ } else {
+ class_name = param->arg_info->class_name->val;
+ class_name_len = param->arg_info->class_name->len;
+ }
+ if (0 == zend_binary_strcasecmp(class_name, class_name_len, "self", sizeof("self")- 1)) {
ce = param->fptr->common.scope;
if (!ce) {
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Parameter uses 'self' as type hint but function is not a class member!");
return;
}
- } else if (0 == zend_binary_strcasecmp(param->arg_info->class_name, param->arg_info->class_name_len, "parent", sizeof("parent")- 1)) {
+ } else if (0 == zend_binary_strcasecmp(class_name, class_name_len, "parent", sizeof("parent")- 1)) {
ce = param->fptr->common.scope;
if (!ce) {
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
@@ -2400,12 +2440,16 @@ ZEND_METHOD(reflection_parameter, getClass)
}
ce = ce->parent;
} else {
- zend_string *name = zend_string_init(param->arg_info->class_name, param->arg_info->class_name_len, 0);
- ce = zend_lookup_class(name TSRMLS_CC);
- zend_string_release(name);
+ if (param->fptr->type == ZEND_INTERNAL_FUNCTION) {
+ zend_string *name = zend_string_init(class_name, class_name_len, 0);
+ ce = zend_lookup_class(name TSRMLS_CC);
+ zend_string_release(name);
+ } else {
+ ce = zend_lookup_class(param->arg_info->class_name TSRMLS_CC);
+ }
if (!ce) {
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
- "Class %s does not exist", param->arg_info->class_name);
+ "Class %s does not exist", class_name);
return;
}
}
@@ -3347,9 +3391,8 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
zend_property_info *prop_info;
zval *prop, prop_copy;
zend_string *key;
- zend_ulong num_index;
- ZEND_HASH_FOREACH_KEY_PTR(&ce->properties_info, num_index, key, prop_info) {
+ ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->properties_info, key, prop_info) {
if (((prop_info->flags & ZEND_ACC_SHADOW) &&
prop_info->ce != ce) ||
((prop_info->flags & ZEND_ACC_PROTECTED) &&
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 108eafddc4..375d52bad9 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -490,7 +490,7 @@ static spl_filesystem_object *spl_filesystem_object_create_type(int ht, spl_file
} else {
intern->file_name = estrndup(source->file_name, source->file_name_len);
intern->file_name_len = source->file_name_len;
- intern->_path = spl_filesystem_object_get_path(source, (size_t *)&intern->_path_len TSRMLS_CC);
+ intern->_path = spl_filesystem_object_get_path(source, &intern->_path_len TSRMLS_CC);
intern->_path = estrndup(intern->_path, intern->_path_len);
}
break;
@@ -514,7 +514,7 @@ static spl_filesystem_object *spl_filesystem_object_create_type(int ht, spl_file
} else {
intern->file_name = source->file_name;
intern->file_name_len = source->file_name_len;
- intern->_path = spl_filesystem_object_get_path(source, (size_t *)&intern->_path_len TSRMLS_CC);
+ intern->_path = spl_filesystem_object_get_path(source, &intern->_path_len TSRMLS_CC);
intern->_path = estrndup(intern->_path, intern->_path_len);
intern->u.file.open_mode = "r";
@@ -1506,27 +1506,23 @@ SPL_METHOD(RecursiveDirectoryIterator, getChildren)
spl_filesystem_object_get_file_name(intern TSRMLS_CC);
- if (SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_CURRENT_AS_PATHNAME)) {
- RETURN_STRINGL(intern->file_name, intern->file_name_len);
- } else {
- ZVAL_LONG(&zflags, intern->flags);
- ZVAL_STRINGL(&zpath, intern->file_name, intern->file_name_len);
- spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), return_value, &zpath, &zflags TSRMLS_CC);
- zval_ptr_dtor(&zpath);
- zval_ptr_dtor(&zflags);
-
- subdir = Z_SPLFILESYSTEM_P(return_value);
- if (subdir) {
- if (intern->u.dir.sub_path && intern->u.dir.sub_path[0]) {
- subdir->u.dir.sub_path_len = (int)spprintf(&subdir->u.dir.sub_path, 0, "%s%c%s", intern->u.dir.sub_path, slash, intern->u.dir.entry.d_name);
- } else {
- subdir->u.dir.sub_path_len = (int)strlen(intern->u.dir.entry.d_name);
- subdir->u.dir.sub_path = estrndup(intern->u.dir.entry.d_name, subdir->u.dir.sub_path_len);
- }
- subdir->info_class = intern->info_class;
- subdir->file_class = intern->file_class;
- subdir->oth = intern->oth;
+ ZVAL_LONG(&zflags, intern->flags);
+ ZVAL_STRINGL(&zpath, intern->file_name, intern->file_name_len);
+ spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), return_value, &zpath, &zflags TSRMLS_CC);
+ zval_ptr_dtor(&zpath);
+ zval_ptr_dtor(&zflags);
+
+ subdir = Z_SPLFILESYSTEM_P(return_value);
+ if (subdir) {
+ if (intern->u.dir.sub_path && intern->u.dir.sub_path[0]) {
+ subdir->u.dir.sub_path_len = (int)spprintf(&subdir->u.dir.sub_path, 0, "%s%c%s", intern->u.dir.sub_path, slash, intern->u.dir.entry.d_name);
+ } else {
+ subdir->u.dir.sub_path_len = (int)strlen(intern->u.dir.entry.d_name);
+ subdir->u.dir.sub_path = estrndup(intern->u.dir.entry.d_name, subdir->u.dir.sub_path_len);
}
+ subdir->info_class = intern->info_class;
+ subdir->file_class = intern->file_class;
+ subdir->oth = intern->oth;
}
}
/* }}} */
diff --git a/ext/spl/spl_directory.h b/ext/spl/spl_directory.h
index f1db1f69b9..b6c8b72933 100644
--- a/ext/spl/spl_directory.h
+++ b/ext/spl/spl_directory.h
@@ -63,10 +63,10 @@ struct _spl_filesystem_object {
void *oth;
spl_other_handler *oth_handler;
char *_path;
- int _path_len;
+ size_t _path_len;
char *orig_path;
char *file_name;
- int file_name_len;
+ size_t file_name_len;
SPL_FS_OBJ_TYPE type;
zend_long flags;
zend_class_entry *file_class;
@@ -76,7 +76,7 @@ struct _spl_filesystem_object {
php_stream *dirp;
php_stream_dirent entry;
char *sub_path;
- int sub_path_len;
+ size_t sub_path_len;
int index;
int is_recursive;
zend_function *func_rewind;
@@ -88,7 +88,7 @@ struct _spl_filesystem_object {
php_stream_context *context;
zval *zcontext;
char *open_mode;
- int open_mode_len;
+ size_t open_mode_len;
zval current_zval;
char *current_line;
size_t current_line_len;
diff --git a/ext/spl/tests/bug65213.phpt b/ext/spl/tests/bug65213.phpt
new file mode 100644
index 0000000000..5e34d9549c
--- /dev/null
+++ b/ext/spl/tests/bug65213.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #65213 (cannot cast SplFileInfo to boolean)
+--FILE--
+<?php
+
+$o = new SplFileInfo('.');
+var_dump((bool) $o);
+
+?>
+===DONE===
+--EXPECT--
+bool(true)
+===DONE===
diff --git a/ext/spl/tests/bug66405.phpt b/ext/spl/tests/bug66405.phpt
new file mode 100644
index 0000000000..b34e7b5074
--- /dev/null
+++ b/ext/spl/tests/bug66405.phpt
@@ -0,0 +1,59 @@
+--TEST--
+SPL: RecursiveDirectoryIterator with CURRENT_AS_PATHNAME flag
+--CREDITS--
+Paul Garvin pgarvin76@gmail.com
+--FILE--
+<?php
+$td = __DIR__ . '/bug66405';
+mkdir($td);
+touch($td . '/file1.txt');
+touch($td . '/file2.md');
+mkdir($td . '/testsubdir');
+touch($td . '/testsubdir/file3.csv');
+
+class Bug66405 extends RecursiveDirectoryIterator
+{
+ public function current()
+ {
+ $current = parent::current();
+ echo gettype($current) . " $current\n";
+ return $current;
+ }
+
+ public function getChildren()
+ {
+ $children = parent::getChildren();
+ if (is_object($children)) {
+ echo get_class($children) . " $children\n";
+ } else {
+ echo gettype($children) . " $children\n";
+ }
+ return $children;
+ }
+}
+
+$rdi = new Bug66405($td, FilesystemIterator::CURRENT_AS_PATHNAME | FilesystemIterator::SKIP_DOTS);
+$rii = new RecursiveIteratorIterator($rdi);
+
+ob_start();
+foreach ($rii as $file) {
+ //noop
+}
+$results = explode("\n", ob_get_clean());
+sort($results);
+echo implode("\n", $results);
+?>
+--CLEAN--
+<?php
+$td = __DIR__ . '/bug66405';
+unlink($td . '/testsubdir/file3.csv');
+unlink($td . '/file2.md');
+unlink($td . '/file1.txt');
+rmdir($td . '/testsubdir');
+rmdir($td);
+?>
+--EXPECTF--
+Bug66405 file3.csv
+string %sbug66405%efile1.txt
+string %sbug66405%efile2.md
+string %sbug66405%etestsubdir%efile3.csv
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c
index 7fae04fcbf..efc4248732 100644
--- a/ext/standard/crypt.c
+++ b/ext/standard/crypt.c
@@ -196,7 +196,6 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch
} else if (
salt[0] == '$' &&
salt[1] == '2' &&
- salt[2] >= 'a' && salt[2] <= 'z' &&
salt[3] == '$' &&
salt[4] >= '0' && salt[4] <= '3' &&
salt[5] >= '0' && salt[5] <= '9' &&
@@ -219,7 +218,7 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch
_crypt_extended_init_r();
crypt_res = _crypt_extended_r(password, salt, &buffer);
- if (!crypt_res) {
+ if (!crypt_res || (salt[0] == '*' && salt[1] == '0')) {
return NULL;
} else {
result = zend_string_init(crypt_res, strlen(crypt_res), 0);
@@ -240,8 +239,8 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch
# error Data struct used by crypt_r() is unknown. Please report.
# endif
crypt_res = crypt_r(password, salt, &buffer);
- if (!crypt_res) {
- return FAILURE;
+ if (!crypt_res || (salt[0] == '*' && salt[1] == '0')) {
+ return NULL;
} else {
result = zend_string_init(crypt_res, strlen(crypt_res), 0);
return result;
diff --git a/ext/standard/crypt_blowfish.c b/ext/standard/crypt_blowfish.c
index e010352b55..43f35f661e 100644
--- a/ext/standard/crypt_blowfish.c
+++ b/ext/standard/crypt_blowfish.c
@@ -8,11 +8,11 @@
* and crypt(3) interfaces added, but optimizations specific to password
* cracking removed.
*
- * Written by Solar Designer <solar at openwall.com> in 1998-2011.
+ * Written by Solar Designer <solar at openwall.com> in 1998-2014.
* No copyright is claimed, and the software is hereby placed in the public
* domain. In case this attempt to disclaim copyright and place the software
* in the public domain is deemed null and void, then the software is
- * Copyright (c) 1998-2011 Solar Designer and it is hereby released to the
+ * Copyright (c) 1998-2014 Solar Designer and it is hereby released to the
* general public under the following terms:
*
* Redistribution and use in source and binary forms, with or without
@@ -28,12 +28,12 @@
* you place this code and any modifications you make under a license
* of your choice.
*
- * This implementation is mostly compatible with OpenBSD's bcrypt.c (prefix
- * "$2a$") by Niels Provos <provos at citi.umich.edu>, and uses some of his
- * ideas. The password hashing algorithm was designed by David Mazieres
- * <dm at lcs.mit.edu>. For more information on the level of compatibility,
- * please refer to the comments in BF_set_key() below and to the crypt(3)
- * man page included in the crypt_blowfish tarball.
+ * This implementation is fully compatible with OpenBSD's bcrypt.c for prefix
+ * "$2b$", originally by Niels Provos <provos at citi.umich.edu>, and it uses
+ * some of his ideas. The password hashing algorithm was designed by David
+ * Mazieres <dm at lcs.mit.edu>. For information on the level of
+ * compatibility for bcrypt hash prefixes other than "$2b$", please refer to
+ * the comments in BF_set_key() below and to the included crypt(3) man page.
*
* There's a paper on the algorithm that explains its design decisions:
*
@@ -583,6 +583,7 @@ static void BF_set_key(const char *key, BF_key expanded, BF_key initial,
* Valid combinations of settings are:
*
* Prefix "$2a$": bug = 0, safety = 0x10000
+ * Prefix "$2b$": bug = 0, safety = 0
* Prefix "$2x$": bug = 1, safety = 0
* Prefix "$2y$": bug = 0, safety = 0
*/
@@ -646,6 +647,10 @@ static void BF_set_key(const char *key, BF_key expanded, BF_key initial,
initial[0] ^= sign;
}
+static const unsigned char flags_by_subtype[26] =
+ {2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 0};
+
static char *BF_crypt(const char *key, const char *setting,
char *output, int size,
BF_word min)
@@ -653,9 +658,6 @@ static char *BF_crypt(const char *key, const char *setting,
#if BF_ASM
extern void _BF_body_r(BF_ctx *ctx);
#endif
- static const unsigned char flags_by_subtype[26] =
- {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 0};
struct {
BF_ctx ctx;
BF_key expanded_key;
@@ -821,9 +823,10 @@ char *php_crypt_blowfish_rn(const char *key, const char *setting,
{
const char *test_key = "8b \xd0\xc1\xd2\xcf\xcc\xd8";
const char *test_setting = "$2a$00$abcdefghijklmnopqrstuu";
- static const char * const test_hash[2] =
- {"VUrPmXD6q/nVSSp7pNDhCR9071IfIRe\0\x55", /* $2x$ */
- "i1D709vfamulimlGcq0qq3UvuUasvEa\0\x55"}; /* $2a$, $2y$ */
+ static const char * const test_hashes[2] =
+ {"i1D709vfamulimlGcq0qq3UvuUasvEa\0\x55", /* 'a', 'b', 'y' */
+ "VUrPmXD6q/nVSSp7pNDhCR9071IfIRe\0\x55"}; /* 'x' */
+ const char *test_hash = test_hashes[0];
char *retval;
const char *p;
int save_errno, ok;
@@ -845,17 +848,19 @@ char *php_crypt_blowfish_rn(const char *key, const char *setting,
* detected by the self-test.
*/
memcpy(buf.s, test_setting, sizeof(buf.s));
- if (retval)
+ if (retval) {
+ unsigned int flags = flags_by_subtype[
+ (unsigned int)(unsigned char)setting[2] - 'a'];
+ test_hash = test_hashes[flags & 1];
buf.s[2] = setting[2];
+ }
memset(buf.o, 0x55, sizeof(buf.o));
buf.o[sizeof(buf.o) - 1] = 0;
p = BF_crypt(test_key, buf.s, buf.o, sizeof(buf.o) - (1 + 1), 1);
ok = (p == buf.o &&
!memcmp(p, buf.s, 7 + 22) &&
- !memcmp(p + (7 + 22),
- test_hash[(unsigned int)(unsigned char)buf.s[2] & 1],
- 31 + 1 + 1 + 1));
+ !memcmp(p + (7 + 22), test_hash, 31 + 1 + 1 + 1));
{
const char *k = "\xff\xa3" "34" "\xff\xff\xff\xa3" "345";
@@ -885,7 +890,7 @@ char *_crypt_gensalt_blowfish_rn(const char *prefix, unsigned long count,
if (size < 16 || output_size < 7 + 22 + 1 ||
(count && (count < 4 || count > 31)) ||
prefix[0] != '$' || prefix[1] != '2' ||
- (prefix[2] != 'a' && prefix[2] != 'y')) {
+ (prefix[2] != 'a' && prefix[2] != 'b' && prefix[2] != 'y')) {
if (output_size > 0) output[0] = '\0';
__set_errno((output_size < 7 + 22 + 1) ? ERANGE : EINVAL);
return NULL;
diff --git a/ext/standard/dns.c b/ext/standard/dns.c
index 13a1ab75df..37cad8bfc9 100644
--- a/ext/standard/dns.c
+++ b/ext/standard/dns.c
@@ -896,7 +896,24 @@ PHP_FUNCTION(dns_get_record)
if (n < 0) {
php_dns_free_handle(handle);
- continue;
+ switch (h_errno) {
+ case NO_DATA:
+ case HOST_NOT_FOUND:
+ continue;
+
+ case NO_RECOVERY:
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "An unexpected server failure occurred.");
+ break;
+
+ case TRY_AGAIN:
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "A temporary server error occurred.");
+ break;
+
+ default:
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "DNS Query failed");
+ }
+ zval_dtor(return_value);
+ RETURN_FALSE;
}
cp = answer.qb2 + HFIXEDSZ;
diff --git a/ext/standard/dns_win32.c b/ext/standard/dns_win32.c
index 963d1f7a54..a0b917c5ca 100644
--- a/ext/standard/dns_win32.c
+++ b/ext/standard/dns_win32.c
@@ -456,7 +456,7 @@ PHP_FUNCTION(dns_get_record)
if (status == DNS_INFO_NO_RECORDS || status == DNS_ERROR_RCODE_NAME_ERROR) {
continue;
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Dns Query failed");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "DNS Query failed");
zval_dtor(return_value);
RETURN_FALSE;
}
diff --git a/ext/standard/head.c b/ext/standard/head.c
index 1417b52bc0..56f02a3989 100644
--- a/ext/standard/head.c
+++ b/ext/standard/head.c
@@ -40,11 +40,13 @@ PHP_FUNCTION(header)
{
zend_bool rep = 1;
sapi_header_line ctr = {0};
+ size_t len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bl", &ctr.line,
- &ctr.line_len, &rep, &ctr.response_code) == FAILURE)
+ &len, &rep, &ctr.response_code) == FAILURE)
return;
+ ctr.line_len = (uint)len;
sapi_header_op(rep ? SAPI_HEADER_REPLACE:SAPI_HEADER_ADD, &ctr TSRMLS_CC);
}
/* }}} */
@@ -54,11 +56,13 @@ PHP_FUNCTION(header)
PHP_FUNCTION(header_remove)
{
sapi_header_line ctr = {0};
+ size_t len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &ctr.line,
- &ctr.line_len) == FAILURE)
+ &len) == FAILURE)
return;
+ ctr.line_len = (uint)len;
sapi_header_op(ZEND_NUM_ARGS() == 0 ? SAPI_HEADER_DELETE_ALL : SAPI_HEADER_DELETE, &ctr TSRMLS_CC);
}
/* }}} */
diff --git a/ext/standard/pack.c b/ext/standard/pack.c
index 4af72c34b8..f773eb26c5 100644
--- a/ext/standard/pack.c
+++ b/ext/standard/pack.c
@@ -560,7 +560,7 @@ PHP_FUNCTION(unpack)
{
char *format, *input;
zend_string *formatarg, *inputarg;
- size_t formatlen, inputpos, inputlen;
+ zend_long formatlen, inputpos, inputlen;
int i;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &formatarg,
@@ -717,7 +717,7 @@ PHP_FUNCTION(unpack)
inputpos = 0;
}
- if ((size >=0 && (inputpos + size) <= inputlen) || (size < 0 && -size <= (inputlen - inputpos))) {
+ if ((inputpos + size) <= inputlen) {
switch ((int) type) {
case 'a': {
/* a will not strip any trailing whitespace or null padding */
@@ -1105,26 +1105,26 @@ PHP_MINIT_FUNCTION(pack)
machine_endian_longlong_map[1] = size - 7;
machine_endian_longlong_map[2] = size - 6;
machine_endian_longlong_map[3] = size - 5;
- machine_endian_longlong_map[0] = size - 4;
- machine_endian_longlong_map[1] = size - 3;
- machine_endian_longlong_map[2] = size - 2;
- machine_endian_longlong_map[3] = size - 1;
+ machine_endian_longlong_map[4] = size - 4;
+ machine_endian_longlong_map[5] = size - 3;
+ machine_endian_longlong_map[6] = size - 2;
+ machine_endian_longlong_map[7] = size - 1;
big_endian_longlong_map[0] = size - 8;
big_endian_longlong_map[1] = size - 7;
big_endian_longlong_map[2] = size - 6;
big_endian_longlong_map[3] = size - 5;
- big_endian_longlong_map[0] = size - 4;
- big_endian_longlong_map[1] = size - 3;
- big_endian_longlong_map[2] = size - 2;
- big_endian_longlong_map[3] = size - 1;
+ big_endian_longlong_map[4] = size - 4;
+ big_endian_longlong_map[5] = size - 3;
+ big_endian_longlong_map[6] = size - 2;
+ big_endian_longlong_map[7] = size - 1;
little_endian_longlong_map[0] = size - 1;
little_endian_longlong_map[1] = size - 2;
little_endian_longlong_map[2] = size - 3;
little_endian_longlong_map[3] = size - 4;
- little_endian_longlong_map[0] = size - 5;
- little_endian_longlong_map[1] = size - 6;
- little_endian_longlong_map[2] = size - 7;
- little_endian_longlong_map[3] = size - 8;
+ little_endian_longlong_map[4] = size - 5;
+ little_endian_longlong_map[5] = size - 6;
+ little_endian_longlong_map[6] = size - 7;
+ little_endian_longlong_map[7] = size - 8;
#endif
}
diff --git a/ext/standard/tests/file/bug68335.phpt b/ext/standard/tests/file/bug68335.phpt
new file mode 100644
index 0000000000..63eda4d923
--- /dev/null
+++ b/ext/standard/tests/file/bug68335.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #68335: rmdir doesnt work with file:// stream wrapper
+--FILE--
+<?php
+$dir = 'file://' . dirname(__FILE__) . '/testDir';
+mkdir($dir);
+var_dump(is_dir($dir));
+rmdir($dir);
+var_dump(is_dir($dir));
+?>
+--EXPECT--
+bool(true)
+bool(false)
diff --git a/ext/standard/tests/strings/crypt_blowfish.phpt b/ext/standard/tests/strings/crypt_blowfish.phpt
index 20a6a2750a..0bf0d1949e 100644
--- a/ext/standard/tests/strings/crypt_blowfish.phpt
+++ b/ext/standard/tests/strings/crypt_blowfish.phpt
@@ -18,8 +18,10 @@ $tests =array(
array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3"),
array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3"),
array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.nqd1wy.pTMdcvrRWxyiGL2eMz.2a85.', "\xff\xff\xa3"),
+ array('$2b$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3"),
array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3"),
array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3"),
+ array('$2b$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3"),
array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "1\xa3345"),
array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "\xff\xa3345"),
array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "\xff\xa334\xff\xff\xff\xa3345"),
@@ -36,14 +38,35 @@ $tests =array(
array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.R9xrDjiycxMbQE2bp.vgqlYpW5wx2yy', "\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55"),
array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.9tQZzcJfm3uj2NvJ/n5xkhpqLrMpWCe', "\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff"),
array('$2a$05$CCCCCCCCCCCCCCCCCCCCC.7uG0VCzI2bS7j6ymqJi9CdcdxiRTWNy', ''),
+);
+$tests2 = array(
+ array('$2a$03$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
+ array('$2a$32$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
+ array('$2c$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
+ array('$2z$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
+ array('$2`$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
+ array('$2{$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
+ array('*0', '*1'),
);
+
$i=0;
foreach($tests as $test) {
- if(crypt($test[1], $test[0]) == $test[0]) {
+ $result = crypt($test[1], $test[0]);
+ if($result === $test[0]) {
+ echo "$i. OK\n";
+ } else {
+ echo "$i. Not OK: $test[0] $result\n";
+ }
+ $i++;
+}
+
+foreach($tests2 as $test) {
+ $result = crypt('', $test[0]);
+ if($result === $test[1]) {
echo "$i. OK\n";
} else {
- echo "$i. Not OK: $test[0] ".crypt($test[1], $test[0])."\n";
+ echo "$i. Not OK: $test[0] $result\n";
}
$i++;
}
@@ -76,3 +99,12 @@ foreach($tests as $test) {
23. OK
24. OK
25. OK
+26. OK
+27. OK
+28. OK
+29. OK
+30. OK
+31. OK
+32. OK
+33. OK
+34. OK
diff --git a/ext/standard/tests/strings/unpack_bug68225.phpt b/ext/standard/tests/strings/unpack_bug68225.phpt
new file mode 100644
index 0000000000..7f8cdd4701
--- /dev/null
+++ b/ext/standard/tests/strings/unpack_bug68225.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Bug #68225 unpack and X format code
+--FILE--
+<?php
+
+$data = pack('VV', 1, 2);
+
+$result = unpack('Va/X' ,$data);
+var_dump($result);
+
+$result = unpack('Va/X4' ,$data);
+var_dump($result);
+
+$result = unpack('V1a/X4/V1b/V1c/X4/V1d', $data);
+var_dump($result);
+
+?>
+===DONE===
+--EXPECTF--
+array(1) {
+ ["a"]=>
+ int(1)
+}
+array(1) {
+ ["a"]=>
+ int(1)
+}
+array(4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(2)
+ ["d"]=>
+ int(2)
+}
+===DONE===
+