Skip to content

Commit 54fe719

Browse files
committed
Merge branch 'PHP-5.5' of git.php.net:php-src into PHP-5.5
* 'PHP-5.5' of git.php.net:php-src: Add a couple more test cases to parse_url() tests fix missing change from 'tcp_socket' to the more common 'server' fix many parallel test issues Cleanup temp test file Revert "Fixed issue #115 (path issue when using phar)." Remove outdate codes, make it clearer, although just a bit.. Update NEWS Fixed Bug #66034 (Segmentation Fault when constructor of PDO statement throws an exception) Fixed coredump due to abnormal implemention of phar Typo fix: umknown -> unknown Fix bug #66008 5.4.23-dev remove "PHP 6" staff
2 parents bb42643 + 9110881 commit 54fe719

File tree

96 files changed

+279
-718
lines changed

Some content is hidden

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

96 files changed

+279
-718
lines changed

NEWS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ PHP NEWS
2121
. Fixed bug #65950 (Field name truncation if the field name is bigger than
2222
32 characters). (patch submitted by: michael dot y at zend dot com, Yasuo)
2323

24+
- PDO:
25+
. Fixed bug #66033 (Segmentation Fault when constructor of PDO statement
26+
throws an exception). (Laruence)
27+
2428
- Standard:
2529
. Fixed bug #64760 (var_export() does not use full precision for floating-point
2630
numbers) (Yasuo)
@@ -71,7 +75,6 @@ PHP NEWS
7175
imap). (ryotakatsuki at gmail dot com)
7276

7377
- OPcache:
74-
. Fixed issue #115 (path issue when using phar). (Laruence)
7578
. Added support for GNU Hurd. (Svante Signell)
7679
. Added function opcache_compile_file() to load PHP scripts into cache
7780
without execution. (Julien)

ext/ftp/tests/ftp_fget_basic1.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ ftp_login($ftp, 'user', 'pass');
1616
if (!$ftp) die("Couldn't connect to the server");
1717
ftp_set_option($ftp, FTP_AUTOSEEK, false);
1818

19-
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
19+
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic1.txt";
2020
$handle = fopen($local_file, 'w');
2121

2222
var_dump(ftp_fget($ftp, $handle, 'fget.txt', FTP_ASCII, FTP_AUTORESUME));
2323
var_dump(file_get_contents($local_file));
2424
?>
2525
--CLEAN--
2626
<?php
27-
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
27+
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic1.txt");
2828
?>
2929
--EXPECT--
3030
bool(true)

ext/ftp/tests/ftp_fget_basic2.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $ftp = ftp_connect('127.0.0.1', $port);
1515
ftp_login($ftp, 'user', 'pass');
1616
if (!$ftp) die("Couldn't connect to the server");
1717

18-
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
18+
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic2.txt";
1919
file_put_contents($local_file, 'ASCIIFoo');
2020
$handle = fopen($local_file, 'a');
2121

@@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file));
2424
?>
2525
--CLEAN--
2626
<?php
27-
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
27+
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic2.txt");
2828
?>
2929
--EXPECT--
3030
bool(true)

ext/ftp/tests/ftp_fget_basic3.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $ftp = ftp_connect('127.0.0.1', $port);
1515
ftp_login($ftp, 'user', 'pass');
1616
if (!$ftp) die("Couldn't connect to the server");
1717

18-
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
18+
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic3.txt";
1919
file_put_contents($local_file, 'ASCIIFoo');
2020
$handle = fopen($local_file, 'a');
2121

@@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file));
2424
?>
2525
--CLEAN--
2626
<?php
27-
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
27+
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic3.txt");
2828
?>
2929
--EXPECT--
3030
bool(true)

ext/ftp/tests/ftp_nb_fget_basic1.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ ftp_login($ftp, 'user', 'pass');
1616
if (!$ftp) die("Couldn't connect to the server");
1717
ftp_set_option($ftp, FTP_AUTOSEEK, false);
1818

19-
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
19+
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic1.txt";
2020
$handle = fopen($local_file, 'w');
2121

2222
var_dump(ftp_nb_fget($ftp, $handle, 'fget.txt', FTP_ASCII, FTP_AUTORESUME));
2323
var_dump(file_get_contents($local_file));
2424
?>
2525
--CLEAN--
2626
<?php
27-
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
27+
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic1.txt");
2828
?>
2929
--EXPECT--
3030
int(2)

ext/ftp/tests/ftp_nb_fget_basic2.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $ftp = ftp_connect('127.0.0.1', $port);
1515
ftp_login($ftp, 'user', 'pass');
1616
if (!$ftp) die("Couldn't connect to the server");
1717

18-
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
18+
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic2.txt";
1919
file_put_contents($local_file, 'ASCIIFoo');
2020
$handle = fopen($local_file, 'a');
2121

@@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file));
2424
?>
2525
--CLEAN--
2626
<?php
27-
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
27+
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic2.txt");
2828
?>
2929
--EXPECT--
3030
int(2)

ext/ftp/tests/ftp_nb_fget_basic3.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $ftp = ftp_connect('127.0.0.1', $port);
1515
ftp_login($ftp, 'user', 'pass');
1616
if (!$ftp) die("Couldn't connect to the server");
1717

18-
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
18+
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic3.txt";
1919
file_put_contents($local_file, 'ASCIIFoo');
2020
$handle = fopen($local_file, 'a');
2121

@@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file));
2424
?>
2525
--CLEAN--
2626
<?php
27-
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
27+
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic3.txt");
2828
?>
2929
--EXPECT--
3030
int(2)

ext/ftp/tests/ftp_nb_get_large.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $ftp = ftp_connect('127.0.0.1', $port);
1818
ftp_login($ftp, 'user', 'pass');
1919
if (!$ftp) die("Couldn't connect to the server");
2020

21-
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
21+
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_get_large.txt";
2222
touch($local_file);
2323
ftp_nb_get($ftp, $local_file, 'fget_large.txt', FTP_BINARY, 5368709119);
2424
$fp = fopen($local_file, 'r');
@@ -29,7 +29,7 @@ fclose($fp);
2929
?>
3030
--CLEAN--
3131
<?php
32-
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
32+
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_get_large.txt");
3333
?>
3434
--EXPECT--
3535
string(1) "X"

ext/mysqlnd/mysqlnd.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2247,7 +2247,6 @@ MYSQLND_METHOD(mysqlnd_conn_data, change_user)(MYSQLND_CONN_DATA * const conn,
22472247
}
22482248
if (!db) {
22492249
db = "";
2250-
22512250
}
22522251

22532252
/* XXX: passwords that have \0 inside work during auth, but in this case won't work with change user */

ext/opcache/ZendAccelerator.c

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
#include "zend_API.h"
3838
#include "zend_ini.h"
3939
#include "TSRM/tsrm_virtual_cwd.h"
40-
#include "ext/phar/php_phar.h"
4140
#include "zend_accelerator_util_funcs.h"
4241
#include "zend_accelerator_hash.h"
4342

@@ -145,21 +144,6 @@ static inline int is_cacheable_stream_path(const char *filename)
145144
memcmp(filename, "phar://", sizeof("phar://") - 1) == 0;
146145
}
147146

148-
static inline int is_phar_relative_alias_path(const char *filename, char **alias, int *alias_len)
149-
{
150-
if (memcmp(filename, "phar://", sizeof("phar://") - 1) == 0
151-
&& filename[sizeof("phar://") - 1] != '\0' && filename[sizeof("phar://") - 1] != '/') {
152-
char *slash;
153-
*alias = (char*)filename + sizeof("phar://") - 1;
154-
slash = strstr(*alias, "/");
155-
if (slash) {
156-
*alias_len = slash - *alias;
157-
return 1;
158-
}
159-
}
160-
return 0;
161-
}
162-
163147
/* O+ overrides PHP chdir() function and remembers the current working directory
164148
* in ZCG(cwd) and ZCG(cwd_len). Later accel_getcwd() can use stored value and
165149
* avoid getcwd() call.
@@ -1044,33 +1028,15 @@ char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_lengt
10441028
}
10451029
memcpy(ZCG(key) + cur_len, include_path, include_path_len);
10461030
ZCG(key)[key_length] = '\0';
1047-
} else {
1048-
/* not use_cwd */
1049-
key_length = path_length;
1031+
} else {
1032+
/* not use_cwd */
1033+
key_length = path_length;
10501034
if ((size_t)key_length >= sizeof(ZCG(key))) {
10511035
ZCG(key_len) = 0;
10521036
return NULL;
1053-
} else {
1054-
char *alias;
1055-
int alias_len;
1056-
if (is_phar_relative_alias_path(file_handle->filename, &alias, &alias_len)) {
1057-
char *phar_path;
1058-
int phar_path_len;
1059-
if (phar_resolve_alias(alias, alias_len, &phar_path, &phar_path_len TSRMLS_CC) == SUCCESS) {
1060-
int filename_len = strlen(file_handle->filename);
1061-
memcpy(ZCG(key), "phar://", sizeof("phar://") -1);
1062-
memcpy(ZCG(key) + sizeof("phar://") - 1, phar_path, phar_path_len);
1063-
memcpy(ZCG(key) + sizeof("phar://") - 1 + phar_path_len,
1064-
alias + alias_len, filename_len - alias_len - sizeof("phar://") + 2);
1065-
key_length = filename_len + (phar_path_len - alias_len);
1066-
} else {
1067-
memcpy(ZCG(key), file_handle->filename, key_length + 1);
1068-
}
1069-
} else {
1070-
memcpy(ZCG(key), file_handle->filename, key_length + 1);
1071-
}
10721037
}
1073-
}
1038+
memcpy(ZCG(key), file_handle->filename, key_length + 1);
1039+
}
10741040

10751041
*key_len = ZCG(key_len) = key_length;
10761042
return ZCG(key);

ext/pdo/pdo_dbh.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ static void pdo_stmt_construct(pdo_stmt_t *stmt, zval *object, zend_class_entry
460460
if (dbstmt_ce->constructor) {
461461
zend_fcall_info fci;
462462
zend_fcall_info_cache fcc;
463-
zval *retval;
463+
zval *retval = NULL;
464464

465465
fci.size = sizeof(zend_fcall_info);
466466
fci.function_table = &dbstmt_ce->function_table;
@@ -495,7 +495,7 @@ static void pdo_stmt_construct(pdo_stmt_t *stmt, zval *object, zend_class_entry
495495
zval_dtor(object);
496496
ZVAL_NULL(object);
497497
object = NULL; /* marks failure */
498-
} else {
498+
} else if (retval) {
499499
zval_ptr_dtor(&retval);
500500
}
501501

ext/pdo_sqlite/tests/bug66033.phpt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
--TEST--
2+
Bug #66033 (Segmentation Fault when constructor of PDO statement throws an exception)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('pdo_sqlite')) print 'skip not loaded';
6+
?>
7+
--FILE--
8+
<?php
9+
class DBStatement extends PDOStatement {
10+
public $dbh;
11+
protected function __construct($dbh) {
12+
$this->dbh = $dbh;
13+
throw new Exception("Blah");
14+
}
15+
}
16+
17+
$pdo = new PDO('sqlite::memory:', null, null);
18+
$pdo->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('DBStatement',
19+
array($pdo)));
20+
$pdo->exec("CREATE TABLE IF NOT EXISTS messages (
21+
id INTEGER PRIMARY KEY,
22+
title TEXT,
23+
message TEXT,
24+
time INTEGER)");
25+
26+
try {
27+
$pdoStatement = $pdo->query("select * from messages");
28+
} catch (Exception $e) {
29+
var_dump($e->getMessage());
30+
}
31+
?>
32+
--EXPECTF--
33+
string(4) "Blah"

ext/phar/dirstream.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,7 @@ static int phar_compare_dir_name(const void *a, const void *b TSRMLS_DC) /* {{{
168168

169169
f = *((Bucket **) a);
170170
s = *((Bucket **) b);
171-
#if (PHP_MAJOR_VERSION < 6)
172171
result = zend_binary_strcmp(f->arKey, f->nKeyLength, s->arKey, s->nKeyLength);
173-
#else
174-
result = zend_binary_strcmp(f->key.arKey.s, f->nKeyLength, s->key.arKey.s, s->nKeyLength);
175-
#endif
176172

177173
if (result < 0) {
178174
return -1;

0 commit comments

Comments
 (0)