summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schlüter <johannes@php.net>2019-02-12 14:59:59 +0100
committerJohannes Schlüter <johannes@php.net>2019-02-12 14:59:59 +0100
commita4bce453bcb8811be5e8082723889712a9a7875e (patch)
tree1777e2cc7bb5e22f7f913554e2e0e5d052bebdd7
parent6f7a47db5dc5a11333e131a071f20c0be19183a9 (diff)
parent5297bed4540e25d1d6c8e091bf18d0fa91533fd2 (diff)
downloadphp-git-a4bce453bcb8811be5e8082723889712a9a7875e.tar.gz
Merge remote-tracking branch 'origin/PHP-7.3' into PHP-7.3
-rw-r--r--.appveyor.yml2
-rw-r--r--Zend/zend_constants.c4
-rw-r--r--ext/date/php_date.c9
-rw-r--r--ext/exif/exif.c4
-rw-r--r--ext/exif/tests/bug77564/bug77564.jpgbin0 -> 73 bytes
-rw-r--r--ext/exif/tests/bug77564/bug77564.phpt18
-rw-r--r--ext/mysqlnd/mysqlnd_ps.c9
-rw-r--r--ext/opcache/ZendAccelerator.c68
-rw-r--r--ext/opcache/ZendAccelerator.h13
-rw-r--r--ext/opcache/config.m457
-rw-r--r--ext/opcache/zend_shared_alloc.c21
-rw-r--r--ext/pcntl/pcntl.c6
-rw-r--r--ext/pcntl/tests/pcntl_realtime_signal.phpt20
-rw-r--r--ext/standard/http.c9
-rw-r--r--ext/standard/tests/general_functions/bug72920.phpt11
-rw-r--r--ext/standard/tests/strings/bug77608.phpt11
-rw-r--r--tests/classes/constants_visibility_002.phpt6
-rw-r--r--tests/classes/constants_visibility_003.phpt6
-rw-r--r--tests/classes/constants_visibility_008.phpt12
19 files changed, 147 insertions, 139 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
index 74c8962250..9ef6c2c107 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -16,7 +16,7 @@ environment:
PHP_BUILD_CACHE_BASE_DIR: c:\build-cache
PHP_BUILD_OBJ_DIR: c:\obj
PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk
- PHP_BUILD_SDK_BRANCH: php-sdk-2.2.0beta1
+ PHP_BUILD_SDK_BRANCH: php-sdk-2.2.0beta3
PHP_BUILD_CRT: vc15
# ext and env setup for tests
#MYSQL_TEST_PASSWD: Password12!
diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c
index 80ed43513a..e2a945c746 100644
--- a/Zend/zend_constants.c
+++ b/Zend/zend_constants.c
@@ -378,7 +378,9 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
ret_constant = NULL;
} else {
if (!zend_verify_const_access(c, scope)) {
- zend_throw_error(NULL, "Cannot access %s const %s::%s", zend_visibility_string(Z_ACCESS_FLAGS(c->value)), ZSTR_VAL(class_name), ZSTR_VAL(constant_name));
+ if ((flags & ZEND_FETCH_CLASS_SILENT) == 0) {
+ zend_throw_error(NULL, "Cannot access %s const %s::%s", zend_visibility_string(Z_ACCESS_FLAGS(c->value)), ZSTR_VAL(class_name), ZSTR_VAL(constant_name));
+ }
goto failure;
}
ret_constant = &c->value;
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 7b1836e938..32530ef734 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -5275,7 +5275,6 @@ PHP_METHOD(DatePeriod, __wakeup)
/* {{{ date_period_read_property */
static zval *date_period_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv)
{
- zval *zv;
if (type != BP_VAR_IS && type != BP_VAR_R) {
zend_throw_error(NULL, "Retrieval of DatePeriod properties for modification is unsupported");
return &EG(uninitialized_zval);
@@ -5283,13 +5282,7 @@ static zval *date_period_read_property(zval *object, zval *member, int type, voi
Z_OBJPROP_P(object); /* build properties hash table */
- zv = zend_std_read_property(object, member, type, cache_slot, rv);
- if (Z_TYPE_P(zv) == IS_OBJECT && Z_OBJ_HANDLER_P(zv, clone_obj)) {
- /* defensive copy */
- ZVAL_OBJ(zv, Z_OBJ_HANDLER_P(zv, clone_obj)(zv));
- }
-
- return zv;
+ return zend_std_read_property(object, member, type, cache_slot, rv);
}
/* }}} */
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
index 676721da2e..6d287ccc1e 100644
--- a/ext/exif/exif.c
+++ b/ext/exif/exif.c
@@ -3378,6 +3378,10 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
break;
case TAG_USERCOMMENT:
+ EFREE_IF(ImageInfo->UserComment);
+ ImageInfo->UserComment = NULL;
+ EFREE_IF(ImageInfo->UserCommentEncoding);
+ ImageInfo->UserCommentEncoding = NULL;
ImageInfo->UserCommentLength = exif_process_user_comment(ImageInfo, &(ImageInfo->UserComment), &(ImageInfo->UserCommentEncoding), value_ptr, byte_count);
break;
diff --git a/ext/exif/tests/bug77564/bug77564.jpg b/ext/exif/tests/bug77564/bug77564.jpg
new file mode 100644
index 0000000000..868fffd1db
--- /dev/null
+++ b/ext/exif/tests/bug77564/bug77564.jpg
Binary files differ
diff --git a/ext/exif/tests/bug77564/bug77564.phpt b/ext/exif/tests/bug77564/bug77564.phpt
new file mode 100644
index 0000000000..2f72b3c9ac
--- /dev/null
+++ b/ext/exif/tests/bug77564/bug77564.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug 77564 (Memory leak in exif_process_IFD_TAG)
+--SKIPIF--
+<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
+--FILE--
+<?php
+var_dump(exif_read_data(dirname(__FILE__) . '/bug77564.jpg'));
+?>
+DONE
+--EXPECTF--
+
+Warning: exif_read_data(bug77564.jpg): Illegal IFD offset in %sbug77564.php on line %d
+
+Warning: exif_read_data(bug77564.jpg): File structure corrupted in %sbug77564.php on line %d
+
+Warning: exif_read_data(bug77564.jpg): Invalid JPEG file in %sbug77564.php on line %d
+bool(false)
+DONE
diff --git a/ext/mysqlnd/mysqlnd_ps.c b/ext/mysqlnd/mysqlnd_ps.c
index f3fab43f0c..b2017b9127 100644
--- a/ext/mysqlnd/mysqlnd_ps.c
+++ b/ext/mysqlnd/mysqlnd_ps.c
@@ -851,6 +851,7 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES * result, void * param, const unsi
MYSQLND_PACKET_ROW * row_packet;
MYSQLND_CONN_DATA * conn = result->conn;
const MYSQLND_RES_METADATA * const meta = result->meta;
+ void *checkpoint;
DBG_ENTER("mysqlnd_stmt_fetch_row_unbuffered");
@@ -873,6 +874,9 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES * result, void * param, const unsi
/* Let the row packet fill our buffer and skip additional malloc + memcpy */
row_packet->skip_extraction = stmt && stmt->result_bind? FALSE:TRUE;
+ checkpoint = result->memory_pool->checkpoint;
+ mysqlnd_mempool_save_state(result->memory_pool);
+
/*
If we skip rows (stmt == NULL || stmt->result_bind == NULL) we have to
result->unbuf->m.free_last_data() before it. The function returns always true.
@@ -895,6 +899,8 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES * result, void * param, const unsi
conn->options->int_and_float_native,
conn->stats))
{
+ mysqlnd_mempool_restore_state(result->memory_pool);
+ result->memory_pool->checkpoint = checkpoint;
DBG_RETURN(FAIL);
}
@@ -965,6 +971,9 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES * result, void * param, const unsi
}
}
+ mysqlnd_mempool_restore_state(result->memory_pool);
+ result->memory_pool->checkpoint = checkpoint;
+
DBG_INF_FMT("ret=%s fetched_anything=%u", ret == PASS? "PASS":"FAIL", *fetched_anything);
DBG_RETURN(ret);
}
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index a066954bf4..bb250e5c21 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -236,11 +236,12 @@ static inline void accel_restart_enter(void)
#ifdef ZEND_WIN32
INCREMENT(restart_in);
#else
-# ifdef _AIX
- static FLOCK_STRUCTURE(restart_in_progress, F_WRLCK, SEEK_SET, 2, 1);
-# else
- static const FLOCK_STRUCTURE(restart_in_progress, F_WRLCK, SEEK_SET, 2, 1);
-#endif
+ struct flock restart_in_progress;
+
+ restart_in_progress.l_type = F_WRLCK;
+ restart_in_progress.l_whence = SEEK_SET;
+ restart_in_progress.l_start = 2;
+ restart_in_progress.l_len = 1;
if (fcntl(lock_file, F_SETLK, &restart_in_progress) == -1) {
zend_accel_error(ACCEL_LOG_DEBUG, "RestartC(+1): %s (%d)", strerror(errno), errno);
@@ -255,11 +256,12 @@ static inline void accel_restart_leave(void)
ZCSG(restart_in_progress) = 0;
DECREMENT(restart_in);
#else
-# ifdef _AIX
- static FLOCK_STRUCTURE(restart_finished, F_UNLCK, SEEK_SET, 2, 1);
-# else
- static const FLOCK_STRUCTURE(restart_finished, F_UNLCK, SEEK_SET, 2, 1);
-# endif
+ struct flock restart_finished;
+
+ restart_finished.l_type = F_UNLCK;
+ restart_finished.l_whence = SEEK_SET;
+ restart_finished.l_start = 2;
+ restart_finished.l_len = 1;
ZCSG(restart_in_progress) = 0;
if (fcntl(lock_file, F_SETLK, &restart_finished) == -1) {
@@ -272,7 +274,12 @@ static inline int accel_restart_is_active(void)
{
if (ZCSG(restart_in_progress)) {
#ifndef ZEND_WIN32
- FLOCK_STRUCTURE(restart_check, F_WRLCK, SEEK_SET, 2, 1);
+ struct flock restart_check;
+
+ restart_check.l_type = F_WRLCK;
+ restart_check.l_whence = SEEK_SET;
+ restart_check.l_start = 2;
+ restart_check.l_len = 1;
if (fcntl(lock_file, F_GETLK, &restart_check) == -1) {
zend_accel_error(ACCEL_LOG_DEBUG, "RestartC: %s (%d)", strerror(errno), errno);
@@ -297,11 +304,12 @@ static inline int accel_activate_add(void)
#ifdef ZEND_WIN32
INCREMENT(mem_usage);
#else
-# ifdef _AIX
- static FLOCK_STRUCTURE(mem_usage_lock, F_RDLCK, SEEK_SET, 1, 1);
-# else
- static const FLOCK_STRUCTURE(mem_usage_lock, F_RDLCK, SEEK_SET, 1, 1);
-# endif
+ struct flock mem_usage_lock;
+
+ mem_usage_lock.l_type = F_RDLCK;
+ mem_usage_lock.l_whence = SEEK_SET;
+ mem_usage_lock.l_start = 1;
+ mem_usage_lock.l_len = 1;
if (fcntl(lock_file, F_SETLK, &mem_usage_lock) == -1) {
zend_accel_error(ACCEL_LOG_DEBUG, "UpdateC(+1): %s (%d)", strerror(errno), errno);
@@ -320,11 +328,12 @@ static inline void accel_deactivate_sub(void)
ZCG(counted) = 0;
}
#else
-# ifdef _AIX
- static FLOCK_STRUCTURE(mem_usage_unlock, F_UNLCK, SEEK_SET, 1, 1);
-# else
- static const FLOCK_STRUCTURE(mem_usage_unlock, F_UNLCK, SEEK_SET, 1, 1);
-# endif
+ struct flock mem_usage_unlock;
+
+ mem_usage_unlock.l_type = F_UNLCK;
+ mem_usage_unlock.l_whence = SEEK_SET;
+ mem_usage_unlock.l_start = 1;
+ mem_usage_unlock.l_len = 1;
if (fcntl(lock_file, F_SETLK, &mem_usage_unlock) == -1) {
zend_accel_error(ACCEL_LOG_DEBUG, "UpdateC(-1): %s (%d)", strerror(errno), errno);
@@ -337,11 +346,12 @@ static inline void accel_unlock_all(void)
#ifdef ZEND_WIN32
accel_deactivate_sub();
#else
-# ifdef _AIX
- static FLOCK_STRUCTURE(mem_usage_unlock_all, F_UNLCK, SEEK_SET, 0, 0);
-# else
- static const FLOCK_STRUCTURE(mem_usage_unlock_all, F_UNLCK, SEEK_SET, 0, 0);
-# endif
+ struct flock mem_usage_unlock_all;
+
+ mem_usage_unlock_all.l_type = F_UNLCK;
+ mem_usage_unlock_all.l_whence = SEEK_SET;
+ mem_usage_unlock_all.l_start = 0;
+ mem_usage_unlock_all.l_len = 0;
if (fcntl(lock_file, F_SETLK, &mem_usage_unlock_all) == -1) {
zend_accel_error(ACCEL_LOG_DEBUG, "UnlockAll: %s (%d)", strerror(errno), errno);
@@ -830,8 +840,12 @@ static inline int accel_is_inactive(void)
return SUCCESS;
}
#else
- FLOCK_STRUCTURE(mem_usage_check, F_WRLCK, SEEK_SET, 1, 1);
+ struct flock mem_usage_check;
+ mem_usage_check.l_type = F_WRLCK;
+ mem_usage_check.l_whence = SEEK_SET;
+ mem_usage_check.l_start = 1;
+ mem_usage_check.l_len = 1;
mem_usage_check.l_pid = -1;
if (fcntl(lock_file, F_GETLK, &mem_usage_check) == -1) {
zend_accel_error(ACCEL_LOG_DEBUG, "UpdateC: %s (%d)", strerror(errno), errno);
diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h
index b87f93a435..82d666ccdd 100644
--- a/ext/opcache/ZendAccelerator.h
+++ b/ext/opcache/ZendAccelerator.h
@@ -89,19 +89,6 @@
/*** file locking ***/
#ifndef ZEND_WIN32
extern int lock_file;
-
-# if defined(HAVE_FLOCK_AIX64)
-# define FLOCK_STRUCTURE(name, type, whence, start, len) \
- struct flock name = {type, whence, 0, 0, 0, start, len }
-# elif defined(HAVE_FLOCK_BSD)
-# define FLOCK_STRUCTURE(name, type, whence, start, len) \
- struct flock name = {start, len, -1, type, whence}
-# elif defined(HAVE_FLOCK_LINUX)
-# define FLOCK_STRUCTURE(name, type, whence, start, len) \
- struct flock name = {type, whence, start, len}
-# else
-# error "Don't know how to define struct flock"
-# endif
#endif
#if defined(HAVE_OPCACHE_FILE_CACHE) && defined(ZEND_WIN32)
diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4
index 392f4c65a3..4810217c14 100644
--- a/ext/opcache/config.m4
+++ b/ext/opcache/config.m4
@@ -341,63 +341,6 @@ int main() {
msg=yes],[msg=no],[msg=no])
AC_MSG_RESULT([$msg])
-flock_type=unknown
-AC_MSG_CHECKING(for struct flock layout)
-
-if test "$flock_type" = "unknown"; then
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
- #include <fcntl.h>
- struct flock lock = { 1, 2, 3, 4, 5, 6, 7 };
- int main() {
- if(lock.l_type == 1 && lock.l_whence == 2 && lock.l_start == 6 && lock.l_len== 7) {
- return 0;
- }
- return 1;
- }
-]])], [
- flock_type=aix64
- AC_DEFINE([HAVE_FLOCK_AIX64], [], [Struct flock is 64-bit AIX-type])
-], [])
-fi
-
-if test "$flock_type" = "unknown"; then
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
- #include <fcntl.h>
- struct flock lock = { 1, 2, 3, 4, 5 };
- int main() {
- if(lock.l_type == 1 && lock.l_whence == 2 && lock.l_start == 3 && lock.l_len == 4) {
- return 0;
- }
- return 1;
- }
-]])], [
- flock_type=linux
- AC_DEFINE([HAVE_FLOCK_LINUX], [], [Struct flock is Linux-type])
-], [])
-fi
-
-if test "$flock_type" = "unknown"; then
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
- #include <fcntl.h>
- struct flock lock = { 1, 2, 3, 4, 5 };
- int main() {
- if(lock.l_start == 1 && lock.l_len == 2 && lock.l_type == 4 && lock.l_whence == 5) {
- return 0;
- }
- return 1;
- }
-]])], [
- flock_type=bsd
- AC_DEFINE([HAVE_FLOCK_BSD], [], [Struct flock is BSD-type])
-], [])
-fi
-
-AC_MSG_RESULT([$flock_type])
-
-if test "$flock_type" = "unknown"; then
- AC_MSG_ERROR([Don't know how to define struct flock on this system[,] set --enable-opcache=no])
-fi
-
PHP_NEW_EXTENSION(opcache,
ZendAccelerator.c \
zend_accelerator_blacklist.c \
diff --git a/ext/opcache/zend_shared_alloc.c b/ext/opcache/zend_shared_alloc.c
index 17ddadbdd8..3db3c0106a 100644
--- a/ext/opcache/zend_shared_alloc.c
+++ b/ext/opcache/zend_shared_alloc.c
@@ -375,15 +375,15 @@ void zend_shared_alloc_safe_unlock(void)
}
}
-#ifndef ZEND_WIN32
-/* name l_type l_whence l_start l_len */
-static FLOCK_STRUCTURE(mem_write_lock, F_WRLCK, SEEK_SET, 0, 1);
-static FLOCK_STRUCTURE(mem_write_unlock, F_UNLCK, SEEK_SET, 0, 1);
-#endif
-
void zend_shared_alloc_lock(void)
{
#ifndef ZEND_WIN32
+ struct flock mem_write_lock;
+
+ mem_write_lock.l_type = F_WRLCK;
+ mem_write_lock.l_whence = SEEK_SET;
+ mem_write_lock.l_start = 0;
+ mem_write_lock.l_len = 1;
#ifdef ZTS
tsrm_mutex_lock(zts_lock);
@@ -414,6 +414,15 @@ void zend_shared_alloc_lock(void)
void zend_shared_alloc_unlock(void)
{
+#ifndef ZEND_WIN32
+ struct flock mem_write_unlock;
+
+ mem_write_unlock.l_type = F_UNLCK;
+ mem_write_unlock.l_whence = SEEK_SET;
+ mem_write_unlock.l_start = 0;
+ mem_write_unlock.l_len = 1;
+#endif
+
ZCG(locked) = 0;
#ifndef ZEND_WIN32
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
index b243b22027..c6236f9663 100644
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@ -1273,6 +1273,12 @@ static void pcntl_siginfo_to_zval(int signo, siginfo_t *siginfo, zval *user_sigi
break;
#endif
}
+#if defined(SIGRTMIN) && defined(SIGRTMAX)
+ if (SIGRTMIN <= signo && signo <= SIGRTMAX) {
+ add_assoc_long_ex(user_siginfo, "pid", sizeof("pid")-1, siginfo->si_pid);
+ add_assoc_long_ex(user_siginfo, "uid", sizeof("uid")-1, siginfo->si_uid);
+ }
+#endif
}
}
/* }}} */
diff --git a/ext/pcntl/tests/pcntl_realtime_signal.phpt b/ext/pcntl/tests/pcntl_realtime_signal.phpt
new file mode 100644
index 0000000000..212f15e03b
--- /dev/null
+++ b/ext/pcntl/tests/pcntl_realtime_signal.phpt
@@ -0,0 +1,20 @@
+--TEST--
+pcntl_signal() context of realtime signal
+--SKIPIF--
+<?php if (!defined('SIGRTMIN')) die("skip realtime signal not supported"); ?>
+<?php if (!extension_loaded("pcntl")) print "skip"; ?>
+<?php if (!extension_loaded("posix")) die("skip posix extension not available"); ?>
+--FILE--
+<?php
+
+pcntl_signal(SIGRTMIN, function ($signo, $siginfo) {
+ printf("got realtime signal from %s, ruid:%s\n", $siginfo['pid'] ?? '', $siginfo['uid'] ?? '');
+});
+posix_kill(posix_getpid(), SIGRTMIN);
+pcntl_signal_dispatch();
+
+echo "ok\n";
+?>
+--EXPECTF--
+%rgot realtime signal from \d+, ruid:\d+%r
+ok
diff --git a/ext/standard/http.c b/ext/standard/http.c
index 27ceafe0ae..a2c457704f 100644
--- a/ext/standard/http.c
+++ b/ext/standard/http.c
@@ -190,15 +190,6 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
case IS_TRUE:
smart_str_appendl(formstr, "1", sizeof("1")-1);
break;
- case IS_DOUBLE:
- {
- char *ekey;
- size_t ekey_len;
- ekey_len = spprintf(&ekey, 0, "%.*G", (int) EG(precision), Z_DVAL_P(zdata));
- smart_str_appendl(formstr, ekey, ekey_len);
- efree(ekey);
- }
- break;
default:
{
zend_string *ekey;
diff --git a/ext/standard/tests/general_functions/bug72920.phpt b/ext/standard/tests/general_functions/bug72920.phpt
index b5ca4760c3..8ba4d26713 100644
--- a/ext/standard/tests/general_functions/bug72920.phpt
+++ b/ext/standard/tests/general_functions/bug72920.phpt
@@ -6,10 +6,7 @@ class Foo {
private const C1 = "a";
}
-try {
- var_dump(constant('Foo::C1'));
-} catch (Error $e) {
- var_dump($e->getMessage());
-}
---EXPECT--
-string(35) "Cannot access private const Foo::C1"
+var_dump(constant('Foo::C1'));
+--EXPECTF--
+Warning: constant(): Couldn't find constant Foo::C1 in %s on line %d
+NULL
diff --git a/ext/standard/tests/strings/bug77608.phpt b/ext/standard/tests/strings/bug77608.phpt
new file mode 100644
index 0000000000..77bfb74a87
--- /dev/null
+++ b/ext/standard/tests/strings/bug77608.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #77608: http_build_query doesn't encode "+" in a float number
+--FILE--
+<?php
+
+$a = ["x" => 1E+14, "y" => "1E+14"];
+echo http_build_query($a);
+
+?>
+--EXPECT--
+x=1.0E%2B14&y=1E%2B14
diff --git a/tests/classes/constants_visibility_002.phpt b/tests/classes/constants_visibility_002.phpt
index 6ec9901269..4e0ecb1aa2 100644
--- a/tests/classes/constants_visibility_002.phpt
+++ b/tests/classes/constants_visibility_002.phpt
@@ -21,8 +21,4 @@ constant('A::protectedConst');
string(14) "protectedConst"
string(14) "protectedConst"
-Fatal error: Uncaught Error: Cannot access protected const A::protectedConst in %s:14
-Stack trace:
-#0 %s(14): constant('A::protectedCon...')
-#1 {main}
- thrown in %s on line 14
+Warning: constant(): Couldn't find constant A::protectedConst in %s on line %d
diff --git a/tests/classes/constants_visibility_003.phpt b/tests/classes/constants_visibility_003.phpt
index 9c7bcfb21c..7c961695ed 100644
--- a/tests/classes/constants_visibility_003.phpt
+++ b/tests/classes/constants_visibility_003.phpt
@@ -21,8 +21,4 @@ constant('A::privateConst');
string(12) "privateConst"
string(12) "privateConst"
-Fatal error: Uncaught Error: Cannot access private const A::privateConst in %s:14
-Stack trace:
-#0 %s(14): constant('A::privateConst')
-#1 {main}
- thrown in %s on line 14
+Warning: constant(): Couldn't find constant A::privateConst in %s on line %d
diff --git a/tests/classes/constants_visibility_008.phpt b/tests/classes/constants_visibility_008.phpt
new file mode 100644
index 0000000000..f24b70cf59
--- /dev/null
+++ b/tests/classes/constants_visibility_008.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Defined on private constant should not raise exception
+--FILE--
+<?php
+
+class Foo
+{
+ private const BAR = 1;
+}
+echo (int)defined('Foo::BAR');
+--EXPECTF--
+0