Skip to content

Commit 2cf5614

Browse files
author
Yasuo Ohgaki
committed
Merge branch 'PHP-5.4' of git.php.net:php-src into PHP-5.4
* 'PHP-5.4' of git.php.net:php-src: (101 commits) exif NEWS add tests for bug #62523 Merged PR #293 (Exif crash on unknown encoding was fixed) By: Draal Conflicts: configure.in main/php_version.h Just SKIP that test on travis fix memory leak on error (from Coverity scan) Fix coverity issue with -1 returned by findOffset not being handled by getPreferredTag 5.4.21 release date When src->src is null this doesn't get initialized but it is still used, so the passed in *ze will point to unitialized memory. Hopefully src->src is never null, but just in case this initialization doesn't hurt. Fix typo Clean up this weird safe_emalloc() call Minor Coverity tweaks - Moved NULL check before dereferencing - Fixed possible NULL ptr dereference - Fixed possible uninitialized scalar variable usage (spotted by Coverity) Remove senseless check here - Fix extern declaration according to definition - Fix possible memory leak - Moved allocation to if block to make Coverity happy - Fixed possible memory leak Fix unitialized opened_path here - found by Coverity ...
2 parents 9789df7 + 5cc797d commit 2cf5614

File tree

108 files changed

+2619
-1277
lines changed

Some content is hidden

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

108 files changed

+2619
-1277
lines changed

CODING_STANDARDS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ Naming Conventions
151151

152152
7. Classes should be given descriptive names. Avoid using abbreviations where
153153
possible. Each word in the class name should start with a capital letter,
154-
without underscore delimiters (CampelCaps starting with a capital letter).
154+
without underscore delimiters (CamelCaps starting with a capital letter).
155155
The class name should be prefixed with the name of the 'parent set' (e.g.
156156
the name of the extension)::
157157

NEWS

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,76 @@
11
PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3-
?? ??? 2013, PHP 5.4.20
3+
?? ??? 2013, PHP 5.4.22
44

55
- Core:
6+
. Fixed bug #65911 (scope resolution operator - strange behavior with $this).
7+
(Bob Weinand)
8+
9+
- CLI server:
10+
. Fixed bug #65818 (Segfault with built-in webserver and chunked transfer
11+
encoding). (Felipe)
12+
13+
- Exif:
14+
. Fixed crash on unknown encoding. (Draal)
15+
16+
- FTP:
17+
. Fixed bug #65667 (ftp_nb_continue produces segfault). (Philip Hofstetter)
18+
19+
- Sockets:
20+
. Fixed bug #65808 (the socket_connect() won't work with IPv6 address).
21+
(Mike)
22+
23+
- XMLReader:
24+
. Fixed bug #51936 (Crash with clone XMLReader). (Mike)
25+
. Fixed bug #64230 (XMLReader does not suppress errors). (Mike)
26+
27+
28+
17 Oct 2013, PHP 5.4.21
29+
30+
- Core:
31+
. Fixed bug #65322 (compile time errors won't trigger auto loading). (Nikita)
32+
33+
- CLI server:
34+
. Fixed bug #65633 (built-in server treat some http headers as
35+
case-sensitive). (Adam)
36+
37+
- Datetime:
38+
. Fixed bug #64157 (DateTime::createFromFormat() reports confusing error
39+
message). (Boro Sitnikovski)
40+
41+
- DBA extension:
42+
. Fixed bug #65708 (dba functions cast $key param to string in-place,
43+
bypassing copy on write). (Adam)
44+
45+
- Filter:
46+
. Add RFC 6598 IPs to reserved addresses. (Sebastian Nohn)
47+
. Fixed bug #64441 (FILTER_VALIDATE_URL rejects fully qualified domain names).
48+
(Syra)
49+
50+
- IMAP:
51+
. Fixed bug #65721 (configure script broken in 5.5.4 and 5.4.20 when enabling
52+
imap). (ryotakatsuki at gmail dot com)
53+
54+
- Standard:
55+
. Fixed bug #61548 (content-type must appear at the end of headers for 201
56+
Location to work in http). (Mike)
57+
58+
- Build system:
59+
. Fixed bug #62396 ('make test' crashes starting with 5.3.14 (missing
60+
gzencode())). (Mike)
61+
62+
63+
19 Sep 2013, PHP 5.4.20
64+
65+
- Core:
66+
. Fixed bug #60598 (cli/apache sapi segfault on objects manipulation).
67+
(Laruence)
68+
. Fixed bug #65579 (Using traits with get_class_methods causes segfault).
69+
(Adam)
70+
. Fixed bug #65490 (Duplicate calls to get lineno & filename for
71+
DTRACE_FUNCTION_*). (Chris Jones)
72+
. Fixed bug #65483 (quoted-printable encode stream filter incorrectly encoding
73+
spaces). (Michael M Slusarz)
674
. Fixed bug #65481 (shutdown segfault due to serialize) (Mike)
775
. Fixed bug #65470 (Segmentation fault in zend_error() with
876
--enable-dtrace). (Chris Jones, Kris Van Hees)
@@ -14,6 +82,8 @@ PHP NEWS
1482
. Fixed bug #65225 (PHP_BINARY incorrectly set). (Patrick Allaert)
1583
. Improved fix for bug #63186 (compile failure on netbsd). (Matteo)
1684
. Fixed bug #62692 (PHP fails to build with DTrace). (Chris Jones, Kris Van Hees)
85+
. Fixed bug #61759 (class_alias() should accept classes with leading
86+
backslashes). (Julien)
1787
. Fixed bug #61345 (CGI mode - make install don't work). (Michael Heimpold)
1888
. Cherry-picked some DTrace build commits (allowing builds on Linux,
1989
bug #62691, and bug #63706) from PHP 5.5 branch
@@ -23,6 +93,12 @@ PHP NEWS
2393
- cURL:
2494
. Fixed bug #65458 (curl memory leak). (Adam)
2595

96+
- Datetime:
97+
. Fixed bug #65554 (createFromFormat broken when weekday name is followed
98+
by some delimiters). (Valentin Logvinskiy, Stas).
99+
. Fixed bug #65564 (stack-buffer-overflow in DateTimeZone stuff caught
100+
by AddressSanitizer). (Remi).
101+
26102
- Openssl:
27103
. Fixed bug #64802 (openssl_x509_parse fails to parse subject properly in
28104
some cases). (Mark Jones)
@@ -42,6 +118,10 @@ PHP NEWS
42118
- SPL:
43119
. Fixed bug #65328 (Segfault when getting SplStack object Value). (Laruence)
44120

121+
- PDO:
122+
. Fixed bug #64953 (Postgres prepared statement positional parameter
123+
casting). (Mike)
124+
45125
- Phar:
46126
. Fixed bug #65028 (Phar::buildFromDirectory creates corrupt archives for
47127
some specific contents). (Stas)

README.EXTENSIONS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ zend_module_entry foo_module_entry = {
3030
PHP_RSHUTDOWN(foo), /* per-request shutdown function */
3131
PHP_MINFO(foo), /* information function */
3232
#if ZEND_MODULE_API_NO >= 20010901
33-
FOO_VERSION, /* extension version number (string) */
33+
PHP_FOO_VERSION, /* extension version number (string) */
3434
#endif
3535
STANDARD_MODULE_PROPERTIES
3636
};

README.EXT_SKEL

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ HOW TO USE IT
3131

3232
./buildconf; ./configure --enable-module_name; make
3333

34+
The definition of PHP_MODULE_NAME_VERSION will be present in the
35+
php_module_name.h and injected into the zend_module_entry definition. This
36+
is required by the PECL website for the version string conformity checks
37+
against package.xml
38+
3439
But if you already have planned the overall scheme of your module, what
3540
functions it will contain, their return types and the arguments they take
3641
(a very good idea) and don't want to bother yourself with creating function

README.SELF-CONTAINED-EXTENSIONS

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,18 @@ ADDING SHARED MODULE SUPPORT TO A MODULE
153153
#ifdef COMPILE_DL_FOO
154154
ZEND_GET_MODULE(foo)
155155
#endif
156+
157+
PECL SITE CONFORMITY
158+
159+
If you plan to release an extension to the PECL website, there are several
160+
points to be regarded.
161+
162+
1. Add LICENSE or COPYING to the package.xml
163+
164+
2. The following should be defined in one of the extension header files
165+
166+
#define PHP_FOO_VERSION "1.2.3"
167+
168+
This macros has to be used within your foo_module_entry to indicate the
169+
extension version.
170+

Zend/acinclude.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ AC_DEFUN([LIBZEND_BISON_CHECK],[
1212
bison_version=none
1313
if test "$YACC"; then
1414
AC_CACHE_CHECK([for bison version], php_cv_bison_version, [
15-
bison_version_vars=`bison --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /' | tr -d a-z`
15+
bison_version_vars=`$YACC --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /g' | tr -d a-z`
1616
php_cv_bison_version=invalid
1717
if test -n "$bison_version_vars"; then
1818
set $bison_version_vars

Zend/tests/bug60598.phpt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--TEST--
2+
Bug #60598 (cli/apache sapi segfault on objects manipulation)
3+
--FILE--
4+
<?php
5+
define('OBJECT_COUNT', 10000);
6+
7+
$containers = array();
8+
9+
class Object {
10+
protected $_guid = 0;
11+
public function __construct() {
12+
global $containers;
13+
$this->guid = 1;
14+
$containers[spl_object_hash($this)] = $this;
15+
}
16+
public function __destruct() {
17+
global $containers;
18+
$containers[spl_object_hash($this)] = NULL;
19+
}
20+
}
21+
22+
for ($i = 0; $i < OBJECT_COUNT; ++$i) {
23+
new Object();
24+
}
25+
26+
// You probably won't see this because of the "zend_mm_heap corrupted"
27+
?>
28+
If you see this, try to increase OBJECT_COUNT to 100,000
29+
--EXPECT--
30+
If you see this, try to increase OBJECT_COUNT to 100,000

Zend/tests/bug64896.phpt

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
--TEST--
2+
Bug #64896 (Segfault with gc_collect_cycles using unserialize on certain objects)
3+
--XFAIL--
4+
We can not fix this bug without a significant (performace slow down) change to gc
5+
--FILE--
6+
<?php
7+
$bar = NULL;
8+
class bad
9+
{
10+
private $_private = array();
11+
12+
public function __construct()
13+
{
14+
$this->_private[] = 'php';
15+
}
16+
17+
public function __destruct()
18+
{
19+
global $bar;
20+
$bar = $this;
21+
}
22+
}
23+
24+
$foo = new stdclass;
25+
$foo->foo = $foo;
26+
$foo->bad = new bad;
27+
28+
gc_disable();
29+
30+
unserialize(serialize($foo));
31+
gc_collect_cycles();
32+
var_dump($bar);
33+
/* will output:
34+
object(bad)#4 (1) {
35+
["_private":"bad":private]=>
36+
&UNKNOWN:0
37+
}
38+
*/
39+
?>
40+
--EXPECTF--
41+
bject(bad)#%d (1) {
42+
["_private":"bad":private]=>
43+
array(1) {
44+
[0]=>
45+
string(3) "php"
46+
}
47+
}

Zend/tests/bug65322.phpt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
Bug #65322: compile time errors won't trigger auto loading
3+
--FILE--
4+
<?php
5+
6+
spl_autoload_register(function($class) {
7+
var_dump($class);
8+
class B {}
9+
});
10+
11+
set_error_handler(function($_, $msg, $file) {
12+
var_dump($msg, $file);
13+
new B;
14+
});
15+
16+
eval('class A { function a() {} function __construct() {} }');
17+
18+
?>
19+
--EXPECTF--
20+
string(50) "Redefining already defined constructor for class A"
21+
string(%d) "%s(%d) : eval()'d code"
22+
string(1) "B"

Zend/tests/bug65579.phpt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
--TEST--
2+
Bug #65579 (Using traits with get_class_methods causes segfault)
3+
--FILE--
4+
<?php
5+
trait ParentTrait {
6+
public function testMethod() { }
7+
}
8+
9+
trait ChildTrait {
10+
use ParentTrait {
11+
testMethod as testMethodFromParentTrait;
12+
}
13+
public function testMethod() { }
14+
}
15+
16+
class TestClass {
17+
use ChildTrait;
18+
}
19+
20+
$obj = new TestClass();
21+
var_dump(get_class_methods($obj));
22+
?>
23+
--EXPECT--
24+
array(2) {
25+
[0]=>
26+
string(10) "testMethod"
27+
[1]=>
28+
string(25) "testmethodfromparenttrait"
29+
}

Zend/tests/bug65911.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Bug #65911 (scope resolution operator - strange behavior with $this)
3+
--FILE--
4+
<?php
5+
class A {}
6+
7+
class B
8+
{
9+
public function go()
10+
{
11+
$this->foo = 'bar';
12+
echo A::$this->foo; // should not output 'bar'
13+
}
14+
}
15+
16+
$obj = new B();
17+
$obj->go();
18+
?>
19+
--EXPECTF--
20+
Fatal error: Access to undeclared static property: A::$this in %s on line %d

Zend/tests/errmsg_045.phpt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
Error message in error handler during compilation
3+
--FILE--
4+
<?php
5+
6+
set_error_handler(function($_, $msg, $file) {
7+
var_dump($msg, $file);
8+
echo $undefined;
9+
});
10+
11+
eval('class A { function a() {} function __construct() {} }');
12+
13+
?>
14+
--EXPECTF--
15+
string(50) "Redefining already defined constructor for class A"
16+
string(%d) "%s(%d) : eval()'d code"
17+
18+
Notice: Undefined variable: undefined in %s on line %d

Zend/zend.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1183,7 +1183,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
11831183
* such scripts recursivly, but some CG() variables may be
11841184
* inconsistent. */
11851185

1186-
in_compilation = zend_is_compiling(TSRMLS_C);
1186+
in_compilation = CG(in_compilation);
11871187
if (in_compilation) {
11881188
saved_class_entry = CG(active_class_entry);
11891189
CG(active_class_entry) = NULL;
@@ -1195,6 +1195,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
11951195
SAVE_STACK(declare_stack);
11961196
SAVE_STACK(list_stack);
11971197
SAVE_STACK(context_stack);
1198+
CG(in_compilation) = 0;
11981199
}
11991200

12001201
if (call_user_function_ex(CG(function_table), NULL, orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC) == SUCCESS) {
@@ -1219,6 +1220,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
12191220
RESTORE_STACK(declare_stack);
12201221
RESTORE_STACK(list_stack);
12211222
RESTORE_STACK(context_stack);
1223+
CG(in_compilation) = 1;
12221224
}
12231225

12241226
if (!EG(user_error_handler)) {

0 commit comments

Comments
 (0)