Skip to content

Commit 3ae86b9

Browse files
committed
Merge branch 'phpng' of git.php.net:php-src into phpng
# By Stanislav Malyshev (15) and others # Via Stanislav Malyshev (15) and others * 'phpng' of git.php.net:php-src: (53 commits) Use defined macro Refactored tidy (all tests passes) Reverted wrong commit Xinchen, stop commit changed configs :) You may use environment variables to ovverride default settings Fixed reference counting, IS_REFERENCE and IS_INDIRECT support Terminate string Useproper hash function C89 compat Fixed curl_close() behavior In most user extensions functions like mysql_close() should use zend_list_close() instead of zend_list_delete(). This closes the actual connection and frees extension specific data structures, but doesn't free zend_reference structure that might be referenced from zval(s). This also doesn't decrement the resource reference counter. Fixed access to uninitialized data and attempt to double free Fixed safe resource close. It must not de deleted (just closed), because it still may be referenced from zval(s). This fixes few ext/ftp test memory failures detected with valgrind. Nested PCRE calls may clobber extra->mark and it has to be reinitailized This fixes invalid memory writes (detected with valgrind) in Zend/tests/closure_047.phpt and Zend/tests/closure_048.phpt. Added comment fix test - output can be chunked fix test fix test Fixed test for commit 997be12 Add bug fix to NEWS Update UPGRADING according to bug fix fix test improve CURL tests to allow testing without separate server ...
2 parents 21d270d + b57b1ff commit 3ae86b9

File tree

82 files changed

+618
-472
lines changed

Some content is hidden

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

82 files changed

+618
-472
lines changed

README.RELEASE_PROCESS

+33-20
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,27 @@ because the sysadmins can not upgrade stuff then.
1111
2. Package two days before a release. So if the release is to be on Thursday,
1212
package on Tuesday. Think about timezones as well.
1313

14-
3. Ensure that Windows builds will work before packaging
15-
16-
4. Follow all steps to the letter. When unclear ask previous RM's (David/Julien/
14+
3. Ensure that the tests on Travis CI are green.
15+
See: https://travis-ci.org/php/php-src/builds
16+
It is recommended to do so a couple of days before the packaging day, to
17+
have enough time to investigate failures, communicate with the authors and
18+
commit the fixes.
19+
The RM for the branch is also responsible for keeping the CI green on
20+
ongoing bases between the releases. Check the CI status for your branch
21+
periodically and resolve the failures ASAP. See more in:
22+
https://wiki.php.net/rfc/travis_ci
23+
24+
4. Ensure that Windows builds will work before packaging
25+
26+
5. Follow all steps to the letter. When unclear ask previous RM's (David/Julien/
1727
Johannes/Stas/Derick/Ilia) before proceeding. Ideally make sure that for the
1828
first releases one of the previous RM's is around to answer questions. For the
1929
steps related to the php/QA/bug websites try to have someone from the webmaster
2030
team (Bjori) on hand.
2131

22-
5. Verify the tags to be extra sure everything was tagged properly.
32+
6. Verify the tags to be extra sure everything was tagged properly.
2333

24-
6. Moving extensions from/to PECL requires write acces to the destination.
34+
7. Moving extensions from/to PECL requires write acces to the destination.
2535
Most developers should have this.
2636

2737
Moving extensions from php-src to PECL
@@ -48,47 +58,49 @@ Rolling a non stable release (alpha/beta/RC)
4858

4959
1. Check windows snapshot builder logs (http://windows.php.net/downloads/snaps/ the last revision)
5060

51-
2. run the "scripts/dev/credits" script in php-src and commit the changes in the
61+
2. Check the tests at https://travis-ci.org/php/php-src/builds
62+
63+
3. run the "scripts/dev/credits" script in php-src and commit the changes in the
5264
credits files in ext/standard.
5365

54-
3. Checkout the release branch for this release (e.g., PHP-5.4.2) from the main branch.
66+
4. Checkout the release branch for this release (e.g., PHP-5.4.2) from the main branch.
5567

56-
4. Bump the version numbers in ``main/php_version.h``, ``configure.in`` and possibly ``NEWS``.
68+
5. Bump the version numbers in ``main/php_version.h``, ``configure.in`` and possibly ``NEWS``.
5769
Do not use abbreviations for alpha and beta. Do not use dashes, you should
5870
``#define PHP_VERSION "5.4.22RC1"`` and not ``#define PHP_VERSION "5.4.22-RC1"``
5971

60-
5. Compile and make test, with and without ZTS, using the right Bison version
72+
6. Compile and make test, with and without ZTS, using the right Bison version
6173
(for example, for 5.5, Bison 2.4.1 is used)
6274

63-
6. Check ./sapi/cli/php -v output for version matching.
75+
7. Check ./sapi/cli/php -v output for version matching.
6476

65-
7. If all is right, commit the changes to the release branch with ``git commit -a``.
77+
8. If all is right, commit the changes to the release branch with ``git commit -a``.
6678

67-
8. Tag the repository release branch with the version, e.g.:
79+
9. Tag the repository release branch with the version, e.g.:
6880
``git tag -u YOURKEYID php-5.4.2RC2``
6981

70-
9. Bump the version numbers in ``main/php_version.h``, ``configure.in`` and ``NEWS``
82+
10. Bump the version numbers in ``main/php_version.h``, ``configure.in`` and ``NEWS``
7183
in the *main* branch (PHP-5.4 for example) to prepare for the **next** version.
7284
F.e. if the RC is "5.4.1RC1" then the new one should be "5.4.2-dev" - regardless if we get
7385
a new RC or not. This is to make sure ``version_compare()`` can correctly work.
7486
Commit the changes to the main branch.
7587

76-
10. Push the changes to the main repo, the tag, the main branch and the release branch :
88+
11. Push the changes to the main repo, the tag, the main branch and the release branch :
7789
``git push --tags origin HEAD``
7890
``git push origin {main branch}``
7991
``git push origin {release branch}``
8092

81-
11. run: ``PHPROOT=. ./makedist 5.4.2RC2``, this will export the tree, create configure
93+
12. run: ``PHPROOT=. ./makedist 5.4.2RC2``, this will export the tree, create configure
8294
and build three tarballs (gz, bz2 and xz).
8395

84-
12. Copy those tarballs (scp, rsync) to downloads.php.net, in your homedir there should be a
96+
13. Copy those tarballs (scp, rsync) to downloads.php.net, in your homedir there should be a
8597
directory "downloads/". Copy them into there, so that the system can generate
8698
MD5 sums. If you do not have this directory, talk to Derick or Dan.
8799

88-
13. Now the RC can be found on http://downloads.php.net/yourname,
100+
14. Now the RC can be found on http://downloads.php.net/yourname,
89101
f.e. http://downloads.php.net/derick/
90102

91-
14. Once the release has been tagged, contact the PHP Windows development team
103+
15. Once the release has been tagged, contact the PHP Windows development team
92104
(internals-win@lists.php.net) so that Windows binaries can be created. Once
93105
those are made, they should be placed into the same directory as the source snapshots.
94106

@@ -144,7 +156,8 @@ the base branches and merged upwards as usual (f.e commit the CVE fix to 5.3,
144156
merge to 5.4, 5.5 etc...). Then you can cherry-pick it in your release branch.
145157
Don't forget to update NEWS manually in an extra commit then.
146158

147-
3. Commit those changes
159+
3. Commit those changes. Ensure the tests at https://travis-ci.org/php/php-src/builds are
160+
still passing.
148161

149162
4. run the "scripts/dev/credits" script in php-src and commit the changes in the
150163
credits files in ext/standard.
@@ -154,7 +167,7 @@ credits files in ext/standard.
154167

155168
6. Check ./sapi/cli/php -v output for version matching.
156169

157-
7. tag the repository with the version f.e. "``git tag -s php-5.4.1``"
170+
7. tag the repository with the version f.e. "``git tag -u YOURKEYID -s php-5.4.1``"
158171

159172
8. Push the tag f.e. "``git push origin php-5.4.1``"
160173

Zend/zend_execute.h

+2
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ static zend_always_inline int i_zend_is_true(zval *op TSRMLS_DC)
115115
break;
116116
}
117117

118+
// TODO: do we really need this warning ???
119+
// Nikita, add your comments here.
118120
zend_error(E_RECOVERABLE_ERROR, "Object of class %s could not be converted to boolean", Z_OBJ_P(op)->ce->name->val);
119121
} else if (Z_OBJ_HT_P(op)->get) {
120122
zval rv;

Zend/zend_gc.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,10 @@ static void gc_mark_grey(zend_refcounted *ref TSRMLS_DC)
307307
int i, n;
308308
zval *table;
309309
zval tmp;
310+
HashTable *props;
310311

311312
ZVAL_OBJ(&tmp, obj);
312-
HashTable *props = get_gc(&tmp, &table, &n TSRMLS_CC);
313+
props = get_gc(&tmp, &table, &n TSRMLS_CC);
313314

314315
while (n > 0 && !Z_REFCOUNTED(table[n-1])) n--;
315316
for (i = 0; i < n; i++) {

Zend/zend_interfaces.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,10 @@ ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *c
278278
{
279279
zval iterator;
280280
zend_object_iterator *new_iterator;
281+
zend_class_entry *ce_it;
281282

282283
zend_user_it_new_iterator(ce, object, &iterator TSRMLS_CC);
283-
zend_class_entry *ce_it = (Z_TYPE(iterator) == IS_OBJECT &&
284+
ce_it = (Z_TYPE(iterator) == IS_OBJECT &&
284285
Z_OBJ_HT(iterator)->get_class_entry) ? Z_OBJCE(iterator) : NULL;
285286

286287
if (!ce_it || !ce_it->get_iterator || (ce_it->get_iterator == zend_user_it_get_new_iterator && Z_OBJ(iterator) == Z_OBJ_P(object))) {

Zend/zend_operators.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2522,8 +2522,8 @@ ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC) /
25222522

25232523
ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC) /* {{{ */
25242524
{
2525-
TSRMLS_FETCH();
25262525
zend_string *str;
2526+
TSRMLS_FETCH();
25272527

25282528
str = zend_strpprintf(0, "%.*G", (int) EG(precision), (double)Z_DVAL_P(op));
25292529
ZVAL_NEW_STR(op, str);

Zend/zend_types.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -551,24 +551,26 @@ static inline zend_uchar zval_get_type(const zval* pz) {
551551

552552
#define ZVAL_NEW_RES(z, h, p, t) do { \
553553
zend_resource *_res = emalloc(sizeof(zend_resource)); \
554+
zval *__z; \
554555
GC_REFCOUNT(_res) = 1; \
555556
GC_TYPE_INFO(_res) = IS_RESOURCE; \
556557
_res->handle = (h); \
557558
_res->type = (t); \
558559
_res->ptr = (p); \
559-
zval *__z = (z); \
560+
__z = (z); \
560561
Z_RES_P(__z) = _res; \
561562
Z_TYPE_INFO_P(__z) = IS_RESOURCE_EX; \
562563
} while (0)
563564

564565
#define ZVAL_NEW_PERSISTENT_RES(z, h, p, t) do { \
565566
zend_resource *_res = malloc(sizeof(zend_resource)); \
567+
zval *__z; \
566568
GC_REFCOUNT(_res) = 1; \
567569
GC_TYPE_INFO(_res) = IS_RESOURCE; \
568570
_res->handle = (h); \
569571
_res->type = (t); \
570572
_res->ptr = (p); \
571-
zval *__z = (z); \
573+
__z = (z); \
572574
Z_RES_P(__z) = _res; \
573575
Z_TYPE_INFO_P(__z) = IS_RESOURCE_EX; \
574576
} while (0)

ext/bz2/bz2.c

+12-2
Original file line numberDiff line numberDiff line change
@@ -226,24 +226,34 @@ PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
226226
#ifdef VIRTUAL_DIR
227227
virtual_filepath_ex(path, &path_copy, NULL TSRMLS_CC);
228228
#else
229-
path_copy = estrdup(path);
229+
path_copy = path;
230230
#endif
231231

232232
if (php_check_open_basedir(path_copy TSRMLS_CC)) {
233+
#ifdef VIRTUAL_DIR
234+
efree(path_copy);
235+
#endif
233236
return NULL;
234237
}
235238

236239
/* try and open it directly first */
237240
bz_file = BZ2_bzopen(path_copy, mode);
238241

239242
if (opened_path && bz_file) {
240-
*opened_path = estrdup(path_copy);
243+
#ifdef VIRTUAL_DIR
244+
*opened_path = path_copy;
241245
path_copy = NULL;
246+
#else
247+
*opened_path = estrdup(path_copy);
248+
#endif
242249
}
243250

251+
#ifdef VIRTUAL_DIR
244252
if (path_copy) {
245253
efree(path_copy);
246254
}
255+
#endif
256+
path_copy = NULL;
247257

248258
if (bz_file == NULL) {
249259
/* that didn't work, so try and get something from the network/wrapper */

ext/curl/interface.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -3136,7 +3136,9 @@ PHP_FUNCTION(curl_close)
31363136
return;
31373137
}
31383138

3139-
zend_list_delete(Z_RES_P(zid));
3139+
if (Z_REFCOUNT_P(zid) <= 2) {
3140+
zend_list_close(Z_RES_P(zid));
3141+
}
31403142
}
31413143
/* }}} */
31423144

ext/curl/tests/bug27023.phpt

+4-7
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,15 @@ Bug #27023 (CURLOPT_POSTFIELDS does not parse content types for files)
44
error_reporting = E_ALL & ~E_DEPRECATED
55
--SKIPIF--
66
<?php
7-
if (!extension_loaded("curl")) {
8-
exit("skip curl extension not loaded");
9-
}
10-
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
11-
exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
12-
}
7+
include 'skipif.inc';
138
?>
149
--FILE--
1510
<?php
1611

17-
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
12+
include 'server.inc';
13+
$host = curl_cli_server_start();
1814
$ch = curl_init();
15+
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, 0);
1916
curl_setopt($ch, CURLOPT_URL, "{$host}/get.php?test=file");
2017
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
2118

ext/curl/tests/bug27023_2.phpt

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
--TEST--
2+
Bug #27023 (CURLOPT_POSTFIELDS does not parse content types for files)
3+
--INI--
4+
error_reporting = E_ALL & ~E_DEPRECATED
5+
--SKIPIF--
6+
<?php include 'skipif.inc'; ?>
7+
--FILE--
8+
<?php
9+
10+
include 'server.inc';
11+
$host = curl_cli_server_start();
12+
$ch = curl_init();
13+
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, 1);
14+
curl_setopt($ch, CURLOPT_URL, "{$host}/get.php?test=file");
15+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
16+
17+
$file = curl_file_create(__DIR__ . '/curl_testdata1.txt');
18+
$params = array('file' => $file);
19+
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
20+
var_dump(curl_exec($ch));
21+
22+
$file = curl_file_create(__DIR__ . '/curl_testdata1.txt', "text/plain");
23+
$params = array('file' => $file);
24+
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
25+
var_dump(curl_exec($ch));
26+
27+
$file = curl_file_create(__DIR__ . '/curl_testdata1.txt', null, "foo.txt");
28+
$params = array('file' => $file);
29+
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
30+
var_dump(curl_exec($ch));
31+
32+
$file = curl_file_create(__DIR__ . '/curl_testdata1.txt', "text/plain", "foo.txt");
33+
$params = array('file' => $file);
34+
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
35+
var_dump(curl_exec($ch));
36+
37+
38+
curl_close($ch);
39+
?>
40+
--EXPECTF--
41+
string(%d) "curl_testdata1.txt|application/octet-stream"
42+
string(%d) "curl_testdata1.txt|text/plain"
43+
string(%d) "foo.txt|application/octet-stream"
44+
string(%d) "foo.txt|text/plain"

ext/curl/tests/bug45161.phpt

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
88
if (!extension_loaded("curl")) {
99
exit("skip curl extension not loaded");
1010
}
11-
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
12-
exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
13-
}
1411
$curl_version = curl_version();
1512
if ($curl_version['version_number'] < 0x071100) {
1613
exit("skip: test works only with curl >= 7.17.0");

ext/curl/tests/bug46711.phpt

-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ Bug #46711 (lost memory when foreach is used for values passed to curl_setopt())
55
if (!extension_loaded("curl")) {
66
exit("skip curl extension not loaded");
77
}
8-
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
9-
exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
10-
}
118
?>
129
--FILE--
1310
<?php

ext/curl/tests/bug48203.phpt

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
11
--TEST--
22
Bug #48203 (Crash when CURLOPT_STDERR is set to regular file)
33
--SKIPIF--
4-
<?php
5-
if (!extension_loaded("curl")) {
6-
exit("skip curl extension not loaded");
7-
}
8-
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
9-
exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
10-
}
11-
?>
4+
<?php include 'skipif.inc'; ?>
125
--FILE--
136
<?php
14-
7+
include 'server.inc';
158
$fp = fopen(dirname(__FILE__) . '/bug48203.tmp', 'w');
169

1710
$ch = curl_init();
1811

1912
curl_setopt($ch, CURLOPT_VERBOSE, 1);
2013
curl_setopt($ch, CURLOPT_STDERR, $fp);
21-
curl_setopt($ch, CURLOPT_URL, getenv('PHP_CURL_HTTP_REMOTE_SERVER'));
14+
curl_setopt($ch, CURLOPT_URL, curl_cli_server_start());
2215

2316
fclose($fp); // <-- premature close of $fp caused a crash!
2417

ext/curl/tests/bug48203_multi.phpt

+3-8
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,11 @@
22
Variation of bug #48203 with curl_multi_exec (Crash when file pointers passed to curl are closed before calling curl_multi_exec)
33
--SKIPIF--
44
<?php
5-
if (!extension_loaded("curl")) {
6-
exit("skip curl extension not loaded");
7-
}
8-
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
9-
exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
10-
}
5+
include 'skipif.inc';
116
?>
127
--FILE--
138
<?php
14-
9+
include 'server.inc';
1510
function checkForClosedFilePointer($curl_option, $description) {
1611
$fp = fopen(dirname(__FILE__) . '/bug48203.tmp', 'w');
1712

@@ -21,7 +16,7 @@ function checkForClosedFilePointer($curl_option, $description) {
2116
$options = array(
2217
CURLOPT_RETURNTRANSFER => 1,
2318
$curl_option => $fp,
24-
CURLOPT_URL => getenv("PHP_CURL_HTTP_REMOTE_SERVER")
19+
CURLOPT_URL => curl_cli_server_start()
2520
);
2621

2722
// we also need to set CURLOPT_VERBOSE to test CURLOPT_STDERR properly

ext/curl/tests/bug48207.phpt

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Test curl_setopt() CURLOPT_FILE readonly file handle
44
Mark van der Velden
55
#testfest Utrecht 2009
66
--SKIPIF--
7-
<?php if (!extension_loaded("curl")) print "skip"; ?>
7+
<?php include 'skipif.inc'; ?>
88
--FILE--
99
<?php
1010
/*
@@ -14,7 +14,8 @@ Mark van der Velden
1414
*/
1515

1616
// Figure out what handler to use
17-
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
17+
include 'server.inc';
18+
$host = curl_cli_server_start();
1819
if(!empty($host)) {
1920

2021
// Use the set Environment variable

0 commit comments

Comments
 (0)