Skip to content

Commit a1bf38e

Browse files
committed
Merge branch 'PHP-5.4' of https://git.php.net/repository/php-src into PHP-5.4
# By Anatol Belski (8) and others # Via Anatol Belski (2) and others * 'PHP-5.4' of https://git.php.net/repository/php-src: (44 commits) fixed possible null deref - addressed bug #65159, Misleading configure help text for --with-mysql-sock Update news for FILTER_SANITIZE_FULL_SPECIAL_CHARS fix Wrong value for FILTER_SANITIZE_FULL_SPECIAL_CHARS in REGISTER_LONG_CONSTANT Fixed bug #65304 (Use of max int in array_sum) Reorder NEWS Fixed bug #65291 - get_defined_constants() crash with __CLASS__ in trait Fixed bug #65291 - get_defined_constants() crash with __CLASS__ in trait Properly fixed bug #63186 on NetBSD == 6.0 Improve php.ini-* documentation 5.4.19 is next Fixed bug #50308 - session id not appended properly for empty anchor tags Fix bug #62129 - rfc1867 crashes php even though turned off add news for xml fix fix TS build added sapi check for dl() test Make zval2myslqnd implementations aware of inheritance Fixed typo ensuring header str is \0 terminated fix buffer overrun fix invalid variable name at ext/spl/internal/multipleiterator.inc (key() method, too) ...
2 parents c7ee677 + 25f924a commit a1bf38e

File tree

133 files changed

+639
-393
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+639
-393
lines changed

NEWS

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,27 @@
11
PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3+
?? ??? 2013, PHP 5.4.19
4+
5+
- Core.
6+
. Fixed bug #65304 (Use of max int in array_sum). (Laruence)
7+
. Fixed bug #65291 (get_defined_constants() causes PHP to crash in a very
8+
limited case). (Arpad)
9+
. Improve fix for bug #63186 (compile failure on netbsd). (Matteo)
10+
11+
- Session:
12+
. Fixed bug #62129 (rfc1867 crashes php even though turned off). (gxd305 at
13+
gmail dot com)
14+
. Fixed bug #50308 (session id not appended properly for empty anchor tags).
15+
(Arpad)
16+
317
?? ??? 2013, PHP 5.4.18
418

519
- Core:
20+
. Fixed value of FILTER_SANITIZE_FULL_SPECIAL_CHARS constant (previously was
21+
erroneously set to FILTER_SANITIZE_SPECIAL_CHARS value). (Andrey
22+
avp200681 gmail com).
23+
. Fixed bug #65254 (Exception not catchable when exception thrown in autoload
24+
with a namespace). (Laruence)
625
. Fixed bug #65108 (is_callable() triggers Fatal Error).
726
(David Soria Parra, Laruence)
827
. Fixed bug #65088 (Generated configure script is malformed on OpenBSD).
@@ -13,6 +32,7 @@ PHP NEWS
1332
. Fixed bug #62475 (variant_* functions causes crash when null given as an
1433
argument). (Felipe)
1534
. Fixed bug #60732 (php_error_docref links to invalid pages). (Jakub Vrana)
35+
. Fixed bug #65226 (chroot() does not get enabled). (Anatol)
1636

1737
- CGI:
1838
. Fixed Bug #65143 (Missing php-cgi man page). (Remi)
@@ -21,10 +41,20 @@ PHP NEWS
2141
. Fixed bug #65066 (Cli server not responsive when responding with 422 http
2242
status code). (Adam)
2343

44+
- CURL:
45+
. Fixed bug #62665 (curl.cainfo doesn't appear in php.ini). (Lior Kaplan)
46+
2447
- FPM:
2548
. Fixed bug #63983 (enabling FPM borks compile on FreeBSD).
2649
(chibisuke at web dot de, Felipe)
2750

51+
- FTP:
52+
. Fixed bug #65228 (FTPs memory leak with SSL).
53+
(marco dot beierer at mbsecurity dot ch)
54+
55+
- GMP:
56+
. Fixed bug #65227 (Memory leak in gmp_cmp second parameter). (Felipe)
57+
2858
- Imap:
2959
. Fixed bug #64467 (Segmentation fault after imap_reopen failure).
3060
(askalski at gmail dot com)
@@ -45,6 +75,13 @@ PHP NEWS
4575
. Allowed PDO_OCI to compile with Oracle Database 12c client libraries.
4676
(Chris Jones)
4777

78+
- PDO_dblib:
79+
. Fixed bug #65219 (PDO/dblib not working anymore ("use dbName" not sent)).
80+
(Stanley Sufficool)
81+
82+
- PDO_pgsql:
83+
. Fixed meta data retrieve when OID is larger than 2^31. (Yasuo)
84+
4885
- Phar:
4986
. Fixed Bug #65142 (Missing phar man page). (Remi)
5087

@@ -67,7 +104,10 @@ PHP NEWS
67104
. Fixed bug #60560 (SplFixedArray un-/serialize, getSize(), count() return 0,
68105
keys are strings). (Adam)
69106

70-
?? ??? 2013, PHP 5.4.17
107+
- XML:
108+
. Fixed bug #65236 (heap corruption in xml parser, CVE-2013-4113). (Rob)
109+
110+
04 Jul 2013, PHP 5.4.17
71111

72112
- Core:
73113
. Fixed bug #64988 (Class loading order affects E_STRICT warning). (Laruence)

TSRM/tsrm_win32.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ TSRM_API int shmget(int key, int size, int flags)
625625
shm->info = info_handle;
626626
shm->descriptor = MapViewOfFileEx(shm->info, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL);
627627

628-
if (created) {
628+
if (NULL != shm->descriptor && created) {
629629
shm->descriptor->shm_perm.key = key;
630630
shm->descriptor->shm_segsz = size;
631631
shm->descriptor->shm_ctime = time(NULL);
@@ -639,8 +639,10 @@ TSRM_API int shmget(int key, int size, int flags)
639639
shm->descriptor->shm_perm.mode = shm->descriptor->shm_perm.seq = 0;
640640
}
641641

642-
if (shm->descriptor->shm_perm.key != key || size > shm->descriptor->shm_segsz ) {
643-
CloseHandle(shm->segment);
642+
if (NULL != shm->descriptor && (shm->descriptor->shm_perm.key != key || size > shm->descriptor->shm_segsz)) {
643+
if (NULL != shm->segment) {
644+
CloseHandle(shm->segment);
645+
}
644646
UnmapViewOfFile(shm->descriptor);
645647
CloseHandle(shm->info);
646648
return -1;

Zend/README.ZEND_VM

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ fields and using different execution methods (call threading, switch threading
66
and direct threading). As a result ZE2 got more than 20% speedup on raw PHP
77
code execution (with specialized executor and direct threading execution
88
method). As in most PHP applications raw execution speed isn't the limiting
9-
factor but system calls and database callls are, your mileage with this patch
9+
factor but system calls and database calls are, your mileage with this patch
1010
will vary.
1111

1212
Most parts of the old zend_execute.c go into zend_vm_def.h. Here you can

Zend/ZEND_CHANGES

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,7 +1136,7 @@ Changes in the Zend Engine 1.0
11361136
(supports breakpoints, expression evaluation, step-in/over,
11371137
function call backtrace, and more).
11381138

1139-
The Zend Engine claims 100% compatability with the engine of PHP
1139+
The Zend Engine claims 100% compatibility with the engine of PHP
11401140
3.0, and is shamelessly lying about it. Here's why:
11411141

11421142
* Static variable initializers only accept scalar values
@@ -1161,6 +1161,6 @@ Changes in the Zend Engine 1.0
11611161
printed the letter { and the contents of the variable $somevar in
11621162
PHP 3.0), it will result in a parse error with the Zend Engine.
11631163
In this case, you would have to change the code to print
1164-
"\{$somevar"; This incompatability is due to the full variable
1164+
"\{$somevar"; This incompatibility is due to the full variable
11651165
reference within quoted strings feature added in the Zend
11661166
Engine.

Zend/tests/bug65254.phpt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
Bug #65254 (Exception not catchable when exception thrown in autoload with a namespace)
3+
--FILE--
4+
<?php
5+
function __autoload($class)
6+
{
7+
eval("namespace ns_test; class test {}");
8+
9+
throw new \Exception('abcd');
10+
}
11+
12+
try
13+
{
14+
\ns_test\test::go();
15+
}
16+
catch (Exception $e)
17+
{
18+
echo 'caught';
19+
}
20+
--EXPECT--
21+
caught

Zend/tests/bug65291.phpt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
Bug #65291 - get_defined_constants() causes PHP to crash in a very limited case.
3+
--FILE--
4+
<?php
5+
6+
trait TestTrait
7+
{
8+
public static function testStaticFunction()
9+
{
10+
return __CLASS__;
11+
}
12+
}
13+
class Tester
14+
{
15+
use TestTrait;
16+
}
17+
18+
$foo = Tester::testStaticFunction();
19+
get_defined_constants();
20+
get_defined_constants(true);
21+
22+
echo $foo;
23+
?>
24+
--EXPECT--
25+
Tester

Zend/tests/closure_044.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Closure 044: Scope/bounding combination invariants; non static closures
33
--FILE--
44
<?php
55
/* A non-static closure has a bound instance if it has a scope
6-
* and does't have an instance if it has no scope */
6+
* and doesn't have an instance if it has no scope */
77

88
$nonstaticUnscoped = function () { var_dump(isset(A::$priv)); var_dump(isset($this)); };
99

Zend/zend_builtin_functions.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,6 +1926,11 @@ static int add_constant_info(zend_constant *constant, void *arg TSRMLS_DC)
19261926
zval *name_array = (zval *)arg;
19271927
zval *const_val;
19281928

1929+
if (!constant->name) {
1930+
/* skip special constants */
1931+
return 0;
1932+
}
1933+
19291934
MAKE_STD_ZVAL(const_val);
19301935
*const_val = constant->value;
19311936
zval_copy_ctor(const_val);
@@ -1993,11 +1998,16 @@ ZEND_FUNCTION(get_defined_constants)
19931998
while (zend_hash_get_current_data_ex(EG(zend_constants), (void **) &val, &pos) != FAILURE) {
19941999
zval *const_val;
19952000

2001+
if (!val->name) {
2002+
/* skip special constants */
2003+
goto next_constant;
2004+
}
2005+
19962006
if (val->module_number == PHP_USER_CONSTANT) {
19972007
module_number = i;
19982008
} else if (val->module_number > i || val->module_number < 0) {
19992009
/* should not happen */
2000-
goto bad_module_id;
2010+
goto next_constant;
20012011
} else {
20022012
module_number = val->module_number;
20032013
}
@@ -2014,7 +2024,7 @@ ZEND_FUNCTION(get_defined_constants)
20142024
INIT_PZVAL(const_val);
20152025

20162026
add_assoc_zval_ex(modules[module_number], val->name, val->name_len, const_val);
2017-
bad_module_id:
2027+
next_constant:
20182028
zend_hash_move_forward_ex(EG(zend_constants), &pos);
20192029
}
20202030
efree(module_names);

Zend/zend_compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3911,7 +3911,7 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /*
39113911
/** With the other traits, we are more permissive.
39123912
We do not give errors for those. This allows to be more
39133913
defensive in such definitions.
3914-
However, we want to make sure that the insteadof declartion
3914+
However, we want to make sure that the insteadof declaration
39153915
is consistent in itself.
39163916
*/
39173917
j = 0;

Zend/zend_vm_def.h

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2229,9 +2229,11 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS
22292229
ce = CACHED_PTR(opline->op1.literal->cache_slot);
22302230
} else {
22312231
ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
2232+
if (UNEXPECTED(EG(exception) != NULL)) {
2233+
HANDLE_EXCEPTION();
2234+
}
22322235
if (UNEXPECTED(ce == NULL)) {
2233-
CHECK_EXCEPTION();
2234-
ZEND_VM_NEXT_OPCODE();
2236+
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv));
22352237
}
22362238
CACHE_PTR(opline->op1.literal->cache_slot, ce);
22372239
}
@@ -2414,9 +2416,11 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
24142416

24152417
if (Z_TYPE_PP(obj) == IS_STRING) {
24162418
ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), NULL, 0 TSRMLS_CC);
2419+
if (UNEXPECTED(EG(exception) != NULL)) {
2420+
HANDLE_EXCEPTION();
2421+
}
24172422
if (UNEXPECTED(ce == NULL)) {
2418-
CHECK_EXCEPTION();
2419-
ZEND_VM_NEXT_OPCODE();
2423+
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_PP(obj));
24202424
}
24212425
EX(called_scope) = ce;
24222426
EX(object) = NULL;
@@ -3498,9 +3502,11 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
34983502
ce = CACHED_PTR(opline->op1.literal->cache_slot);
34993503
} else {
35003504
ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
3505+
if (UNEXPECTED(EG(exception) != NULL)) {
3506+
HANDLE_EXCEPTION();
3507+
}
35013508
if (UNEXPECTED(ce == NULL)) {
3502-
CHECK_EXCEPTION();
3503-
ZEND_VM_NEXT_OPCODE();
3509+
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv));
35043510
}
35053511
CACHE_PTR(opline->op1.literal->cache_slot, ce);
35063512
}
@@ -3887,15 +3893,17 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
38873893
ce = CACHED_PTR(opline->op2.literal->cache_slot);
38883894
} else {
38893895
ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
3890-
if (UNEXPECTED(ce == NULL)) {
3896+
if (UNEXPECTED(EG(exception) != NULL)) {
38913897
if (OP1_TYPE != IS_CONST && varname == &tmp) {
38923898
zval_dtor(&tmp);
38933899
} else if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) {
38943900
zval_ptr_dtor(&varname);
38953901
}
38963902
FREE_OP1();
3897-
CHECK_EXCEPTION();
3898-
ZEND_VM_NEXT_OPCODE();
3903+
HANDLE_EXCEPTION();
3904+
}
3905+
if (UNEXPECTED(ce == NULL)) {
3906+
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv));
38993907
}
39003908
CACHE_PTR(opline->op2.literal->cache_slot, ce);
39013909
}

0 commit comments

Comments
 (0)