summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/date/php_date.c32
-rw-r--r--ext/date/tests/bug65502.phpt12
-rw-r--r--ext/date/tests/bug65548.phpt34
-rw-r--r--ext/gd/libgd/gd_interpolation.c5
-rw-r--r--ext/opcache/ZendAccelerator.c4
-rw-r--r--ext/spl/spl_directory.c2
-rw-r--r--ext/spl/tests/bug64782.phpt21
-rw-r--r--ext/standard/config.m421
8 files changed, 100 insertions, 31 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 95c68f1a78..7d3d1d739e 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -480,7 +480,7 @@ const zend_function_entry date_funcs_immutable[] = {
PHP_ME(DateTimeImmutable, __construct, arginfo_date_create, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
PHP_ME(DateTime, __wakeup, NULL, ZEND_ACC_PUBLIC)
PHP_ME(DateTimeImmutable, __set_state, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME_MAPPING(createFromFormat, date_create_from_format, arginfo_date_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(createFromFormat, date_create_immutable_from_format, arginfo_date_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME_MAPPING(getLastErrors, date_get_last_errors, arginfo_date_get_last_errors, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME_MAPPING(format, date_format, arginfo_date_method_format, 0)
PHP_ME_MAPPING(getTimezone, date_timezone_get, arginfo_date_method_timezone_get, 0)
@@ -2142,27 +2142,21 @@ static zval* date_clone_immutable(zval *object TSRMLS_DC)
static int date_object_compare_date(zval *d1, zval *d2 TSRMLS_DC)
{
- if (Z_TYPE_P(d1) == IS_OBJECT && Z_TYPE_P(d2) == IS_OBJECT &&
- instanceof_function(Z_OBJCE_P(d1), date_ce_date TSRMLS_CC) &&
- instanceof_function(Z_OBJCE_P(d2), date_ce_date TSRMLS_CC)) {
- php_date_obj *o1 = zend_object_store_get_object(d1 TSRMLS_CC);
- php_date_obj *o2 = zend_object_store_get_object(d2 TSRMLS_CC);
+ php_date_obj *o1 = zend_object_store_get_object(d1 TSRMLS_CC);
+ php_date_obj *o2 = zend_object_store_get_object(d2 TSRMLS_CC);
- if (!o1->time || !o2->time) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Trying to compare an incomplete DateTime object");
- return 1;
- }
- if (!o1->time->sse_uptodate) {
- timelib_update_ts(o1->time, o1->time->tz_info);
- }
- if (!o2->time->sse_uptodate) {
- timelib_update_ts(o2->time, o2->time->tz_info);
- }
-
- return (o1->time->sse == o2->time->sse) ? 0 : ((o1->time->sse < o2->time->sse) ? -1 : 1);
+ if (!o1->time || !o2->time) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Trying to compare an incomplete DateTime or DateTimeImmutable object");
+ return 1;
+ }
+ if (!o1->time->sse_uptodate) {
+ timelib_update_ts(o1->time, o1->time->tz_info);
+ }
+ if (!o2->time->sse_uptodate) {
+ timelib_update_ts(o2->time, o2->time->tz_info);
}
- return 1;
+ return (o1->time->sse == o2->time->sse) ? 0 : ((o1->time->sse < o2->time->sse) ? -1 : 1);
}
static HashTable *date_object_get_gc(zval *object, zval ***table, int *n TSRMLS_DC)
diff --git a/ext/date/tests/bug65502.phpt b/ext/date/tests/bug65502.phpt
new file mode 100644
index 0000000000..8819c1ff74
--- /dev/null
+++ b/ext/date/tests/bug65502.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Test for bug #65502: DateTimeImmutable::createFromFormat returns DateTime
+--CREDITS--
+Boro Sitnikovski <buritomath@yahoo.com>
+--INI--
+date.timezone = UTC
+--FILE--
+<?php
+echo get_class(DateTimeImmutable::createFromFormat('j-M-Y', '12-Sep-2013'));
+?>
+--EXPECT--
+DateTimeImmutable
diff --git a/ext/date/tests/bug65548.phpt b/ext/date/tests/bug65548.phpt
new file mode 100644
index 0000000000..53f2519f6d
--- /dev/null
+++ b/ext/date/tests/bug65548.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test for bug #65548: Comparison for DateTimeImmutable doesn't work
+--CREDITS--
+Boro Sitnikovski <buritomath@yahoo.com>
+--INI--
+date.timezone = UTC
+--FILE--
+<?php
+$iToday = new DateTimeImmutable('today');
+$iTomorrow = new DateTimeImmutable('tomorrow');
+
+$mToday = new DateTime('today');
+$mTomorrow = new DateTime('tomorrow');
+
+var_dump($iToday < $iTomorrow);
+var_dump($iToday == $iTomorrow);
+var_dump($iToday > $iTomorrow);
+
+var_dump($iToday == $mToday);
+var_dump($iToday === $mToday);
+
+var_dump($iToday < $mTomorrow);
+var_dump($iToday == $mTomorrow);
+var_dump($iToday > $mTomorrow);
+?>
+--EXPECT--
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
diff --git a/ext/gd/libgd/gd_interpolation.c b/ext/gd/libgd/gd_interpolation.c
index e3247a78c1..3643535f2e 100644
--- a/ext/gd/libgd/gd_interpolation.c
+++ b/ext/gd/libgd/gd_interpolation.c
@@ -1065,6 +1065,7 @@ gdImagePtr gdImageScaleTwoPass(const gdImagePtr src, const unsigned int src_widt
if (tmp_im == NULL) {
return NULL;
}
+ gdImageSetInterpolationMethod(tmp_im, src->interpolation_id);
_gdScaleHoriz(src, src_width, src_height, tmp_im, new_width, src_height);
dst = gdImageCreateTrueColor(new_width, new_height);
@@ -1072,6 +1073,7 @@ gdImagePtr gdImageScaleTwoPass(const gdImagePtr src, const unsigned int src_widt
gdFree(tmp_im);
return NULL;
}
+ gdImageSetInterpolationMethod(dst, src->interpolation_id);
_gdScaleVert(tmp_im, new_width, src_height, dst, new_width, new_height);
gdFree(tmp_im);
@@ -1086,8 +1088,9 @@ gdImagePtr Scale(const gdImagePtr src, const unsigned int src_width, const unsig
if (tmp_im == NULL) {
return NULL;
}
- _gdScaleHoriz(src, src_width, src_height, tmp_im, new_width, src_height);
+ gdImageSetInterpolationMethod(tmp_im, src->interpolation_id);
+ _gdScaleHoriz(src, src_width, src_height, tmp_im, new_width, src_height);
_gdScaleVert(tmp_im, new_width, src_height, dst, new_width, new_height);
gdFree(tmp_im);
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index b5474c0507..827f047cd4 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -1062,6 +1062,10 @@ int zend_accel_invalidate(const char *filename, int filename_len, zend_bool forc
realpath = accelerator_orig_zend_resolve_path(filename, filename_len TSRMLS_CC);
#endif
+ if (!realpath) {
+ return FAILURE;
+ }
+
persistent_script = zend_accel_hash_find(&ZCSG(hash), realpath, strlen(realpath) + 1);
if (persistent_script && !persistent_script->corrupted) {
zend_file_handle file_handle;
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 1a417d0f58..3dc7b7925c 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -2290,7 +2290,7 @@ SPL_METHOD(SplFileObject, __construct)
intern->u.file.open_mode = NULL;
intern->u.file.open_mode_len = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|sbr",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|sbr!",
&intern->file_name, &intern->file_name_len,
&intern->u.file.open_mode, &intern->u.file.open_mode_len,
&use_include_path, &intern->u.file.zcontext) == FAILURE) {
diff --git a/ext/spl/tests/bug64782.phpt b/ext/spl/tests/bug64782.phpt
new file mode 100644
index 0000000000..ac5d08d7d1
--- /dev/null
+++ b/ext/spl/tests/bug64782.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #64782: SplFileObject constructor make $context optional / give it a default value
+--FILE--
+<?php
+
+var_dump(new SplFileObject(__FILE__, "r", false, null));
+
+?>
+--EXPECTF--
+object(SplFileObject)#1 (%d) {
+ ["pathName":"SplFileInfo":private]=>
+ string(%d) "%s/bug64782.php"
+ ["fileName":"SplFileInfo":private]=>
+ string(12) "bug64782.php"
+ ["openMode":"SplFileObject":private]=>
+ string(1) "r"
+ ["delimiter":"SplFileObject":private]=>
+ string(1) ","
+ ["enclosure":"SplFileObject":private]=>
+ string(1) """
+}
diff --git a/ext/standard/config.m4 b/ext/standard/config.m4
index 2af2209f2b..3d00d88dda 100644
--- a/ext/standard/config.m4
+++ b/ext/standard/config.m4
@@ -182,12 +182,12 @@ AC_TRY_RUN([
main() {
#if HAVE_CRYPT
- char salt[30], answer[80];
-
- salt[0]='$'; salt[1]='6'; salt[2]='$'; salt[3]='$'; salt[4]='b'; salt[5]='a'; salt[6]='r'; salt[7]='\0';
+ char salt[21], answer[21+86];
+
+ strcpy(salt,"\$6\$rasmuslerdorf\$");
strcpy(answer, salt);
- strcpy(&answer[29],"$6$$QMXjqd7rHQZPQ1yHsXkQqC1FBzDiVfTHXL.LaeDAeVV.IzMaV9VU4MQ8kPuZa2SOP1A0RPm772EaFYjpEJtdu.");
- exit (strcmp((char *)crypt("foo",salt),answer));
+ strcat(answer, "EeHCRjm0bljalWuALHSTs1NB9ipEiLEXLhYeXdOpx22gmlmVejnVXFhd84cEKbYxCo.XuUTrW.RLraeEnsvWs/");
+ exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer));
#else
exit(0);
#endif
@@ -211,12 +211,13 @@ AC_TRY_RUN([
main() {
#if HAVE_CRYPT
- char salt[30], answer[80];
- salt[0]='$'; salt[1]='5'; salt[2]='$'; salt[3]='$'; salt[4]='s'; salt[5]='a'; salt[6]='l'; salt[7]='t'; salt[8]='s'; salt[9]='t'; salt[10]='r'; salt[11]='i'; salt[12]='n'; salt[13]='g'; salt[14]='\0';
- strcat(salt,"");
+ char salt[21], answer[21+43];
+
+ strcpy(salt,"\$5\$rasmuslerdorf\$");
strcpy(answer, salt);
- strcpy(&answer[29], "$5$saltstring$5B8vYYiY.CVt1RlTTf8KbXBH3hsxY/GNooZaBBGWEc5");
- exit (strcmp((char *)crypt("foo",salt),answer));
+ strcat(answer, "cFAm2puLCujQ9t.0CxiFIIvFi4JyQx5UncCt/xRIX23");
+ exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer));
+
#else
exit(0);
#endif