Commit 5292df24 authored by Ondrej Sury's avatar Ondrej Sury

Imported Upstream version 5.4.0~rc7

parent 96fb2ff5
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? Jan 2012, PHP 5.4.0
?? Feb 2012, PHP 5.4.0 RC 8
02 Feb 2012, PHP 5.4.0 RC 7
- Core:
. Fix bug #60895 (Possible invalid handler usage in windows random
functions). (Pierre)
. Fixed bug #51860 (Include fails with toplevel symlink to /). (Dmitry)
. Fixed (disabled) inline-caching for ZEND_OVERLOADED_FUNCTION methods.
(Dmitry)
- OpenSSL:
. Fix possible attack in SSL sockets with SSL 3.0 / TLS 1.0.
CVE-2011-3389. (Scott)
- Session:
. Fixed bug #60860 (session.save_handler=user without defined function core
dumps). (Felipe)
- SOAP:
. Fixed basic HTTP authentication for WSDL sub requests. (Dmitry)
19 Jan 2012, PHP 5.4.0 RC6
- Core:
. Restoring $_SERVER['REQUEST_TIME'] as a long and introducing
$_SERVER['REQUEST_TIME_FLOAT'] to include microsecond precision. (Patrick)
. Fixed bug #60809 (TRAITS - PHPDoc Comment Style Bug). (Dmitry)
. Fixed bug #60768 (Output buffer not discarded) (Mike)
. Fixed bug #60825 (Segfault when running symfony 2 tests).
(Dmitry, Laruence)
- Hash
. Fixed bug #60221 (Tiger hash output byte order) (Mike)
......
......@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: tsrm_virtual_cwd.c 321634 2012-01-01 13:15:04Z felipe $ */
/* $Id: tsrm_virtual_cwd.c 322927 2012-01-30 10:08:11Z dmitry $ */
#include <sys/types.h>
#include <sys/stat.h>
......@@ -760,6 +760,9 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
while (1) {
if (len <= start) {
if (link_is_dir) {
*link_is_dir = 1;
}
return start;
}
......@@ -776,6 +779,10 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
continue;
} else if (i == len - 2 && path[i] == '.' && path[i+1] == '.') {
/* remove '..' and previous directory */
is_dir = 1;
if (link_is_dir) {
*link_is_dir = 1;
}
if (i - 1 <= start) {
return start ? start : len;
}
......@@ -1200,9 +1207,14 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
return 1;
}
memcpy(resolved_path, state->cwd, state_cwd_length);
resolved_path[state_cwd_length] = DEFAULT_SLASH;
memcpy(resolved_path + state_cwd_length + 1, path, path_length + 1);
path_length += state_cwd_length + 1;
if (resolved_path[state_cwd_length-1] == DEFAULT_SLASH) {
memcpy(resolved_path + state_cwd_length, path, path_length + 1);
path_length += state_cwd_length;
} else {
resolved_path[state_cwd_length] = DEFAULT_SLASH;
memcpy(resolved_path + state_cwd_length + 1, path, path_length + 1);
path_length += state_cwd_length + 1;
}
}
} else {
#ifdef TSRM_WIN32
......
--TEST--
Bug #60825 (Segfault when running symfony 2 tests)
--DESCRIPTION--
run this with valgrind
--FILE--
<?php
class test {
public static $x;
public function __toString() {
self::$x = $this;
return __FILE__;
}
}
$a = new test;
require_once $a;
debug_zval_dump(test::$x);
?>
--EXPECTF--
string(%d) "%sbug60825.php" refcount(2)
--TEST--
Bug #60809 (TRAITS - PHPDoc Comment Style Bug)
--FILE--
<?php
class ExampleParent {
private $hello_world = "hello foo\n";
public function foo() {
echo $this->hello_world;
}
}
class Example extends ExampleParent {
use ExampleTrait;
}
trait ExampleTrait {
/**
*
*/
private $hello_world = "hello bar\n";
/**
*
*/
public $prop = "ops";
public function bar() {
echo $this->hello_world;
}
}
$x = new Example();
$x->foo();
$x->bar();
?>
--EXPECT--
hello foo
hello bar
This diff is collapsed.
......@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: zend_execute_API.c 322378 2012-01-17 08:09:13Z dmitry $ */
/* $Id: zend_execute_API.c 322922 2012-01-29 15:25:40Z derick $ */
#include <stdio.h>
#include <signal.h>
......@@ -1195,8 +1195,11 @@ ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *s
}
CG(interactive) = 0;
retval = SUCCESS;
zend_try {
zend_execute(new_op_array TSRMLS_CC);
zend_execute(new_op_array TSRMLS_CC);
} zend_catch {
retval = FAILURE;
} zend_end_try();
CG(interactive) = orig_interactive;
......@@ -1218,7 +1221,6 @@ ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *s
destroy_op_array(new_op_array TSRMLS_CC);
efree(new_op_array);
EG(return_value_ptr_ptr) = original_return_value_ptr_ptr;
retval = SUCCESS;
} else {
retval = FAILURE;
}
......
......@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: zend_vm_def.h 321634 2012-01-01 13:15:04Z felipe $ */
/* $Id: zend_vm_def.h 322928 2012-01-30 10:51:02Z dmitry $ */
/* If you change this file, please regenerate the zend_vm_execute.h and
* zend_vm_opcodes.h files by running:
......@@ -2187,6 +2187,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), function_name_strval);
}
if (OP2_TYPE == IS_CONST &&
EXPECTED(EX(fbc)->type <= ZEND_USER_FUNCTION) &&
EXPECTED((EX(fbc)->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
EXPECTED(EX(object) == object)) {
CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, EX(called_scope), EX(fbc));
......@@ -2284,7 +2285,9 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS
if (UNEXPECTED(EX(fbc) == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval);
}
if (OP2_TYPE == IS_CONST && EXPECTED((EX(fbc)->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
if (OP2_TYPE == IS_CONST &&
EXPECTED(EX(fbc)->type <= ZEND_USER_FUNCTION) &&
EXPECTED((EX(fbc)->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
if (OP1_TYPE == IS_CONST) {
CACHE_PTR(opline->op2.literal->cache_slot, EX(fbc));
} else {
......@@ -2391,8 +2394,8 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else if (OP2_TYPE != IS_CONST &&
EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
zend_hash_num_elements(Z_ARRVAL_P(function_name)) == 2) {
EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
zend_hash_num_elements(Z_ARRVAL_P(function_name)) == 2) {
zend_class_entry *ce;
zval **method = NULL;
zval **obj = NULL;
......@@ -2429,7 +2432,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
if (UNEXPECTED(EX(fbc) == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), Z_STRVAL_PP(method));
}
if ((EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0) {
EX(object) = NULL;
} else {
......@@ -3693,17 +3696,18 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
zend_op_array *new_op_array=NULL;
zend_free_op free_op1;
zval *inc_filename;
zval tmp_inc_filename;
zval *tmp_inc_filename = NULL;
zend_bool failure_retval=0;
SAVE_OPLINE();
inc_filename = GET_OP1_ZVAL_PTR(BP_VAR_R);
if (inc_filename->type!=IS_STRING) {
ZVAL_COPY_VALUE(&tmp_inc_filename, inc_filename);
zval_copy_ctor(&tmp_inc_filename);
convert_to_string(&tmp_inc_filename);
inc_filename = &tmp_inc_filename;
MAKE_STD_ZVAL(tmp_inc_filename);
ZVAL_COPY_VALUE(tmp_inc_filename, inc_filename);
zval_copy_ctor(tmp_inc_filename);
convert_to_string(tmp_inc_filename);
inc_filename = tmp_inc_filename;
}
if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) {
......@@ -3767,8 +3771,8 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
EMPTY_SWITCH_DEFAULT_CASE()
}
}
if (inc_filename==&tmp_inc_filename) {
zval_dtor(&tmp_inc_filename);
if (tmp_inc_filename) {
zval_ptr_dtor(&tmp_inc_filename);
}
FREE_OP1();
if (UNEXPECTED(EG(exception) != NULL)) {
......@@ -4508,7 +4512,7 @@ ZEND_VM_C_LABEL(num_index_prop):
if (Z_TYPE_P(offset) != IS_LONG) {
if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
&& IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
ZVAL_COPY_VALUE(&tmp, offset);
zval_copy_ctor(&tmp);
......
This diff is collapsed.
......@@ -3635,7 +3635,7 @@ ac_config_headers="$ac_config_headers main/php_config.h"
PHP_MAJOR_VERSION=5
PHP_MINOR_VERSION=4
PHP_RELEASE_VERSION=0
PHP_EXTRA_VERSION="RC6"
PHP_EXTRA_VERSION="RC7"
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
PHP_VERSION_ID=`expr $PHP_MAJOR_VERSION \* 10000 + $PHP_MINOR_VERSION \* 100 + $PHP_RELEASE_VERSION`
## $Id: configure.in 322461 2012-01-19 06:27:56Z stas $ -*- autoconf -*-
## $Id: configure.in 323025 2012-02-02 17:28:03Z stas $ -*- autoconf -*-
dnl ## Process this file with autoconf to produce a configure script.
dnl include Zend specific macro definitions first
......@@ -120,7 +120,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=5
PHP_MINOR_VERSION=4
PHP_RELEASE_VERSION=0
PHP_EXTRA_VERSION="RC6"
PHP_EXTRA_VERSION="RC7"
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
......
......@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: ftp.c 321634 2012-01-01 13:15:04Z felipe $ */
/* $Id: ftp.c 322785 2012-01-26 05:15:57Z scottmac $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
......@@ -243,6 +243,7 @@ ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC)
{
#if HAVE_OPENSSL_EXT
SSL_CTX *ctx = NULL;
long ssl_ctx_options = SSL_OP_ALL;
#endif
if (ftp == NULL) {
return 0;
......@@ -279,7 +280,10 @@ ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC)
return 0;
}
SSL_CTX_set_options(ctx, SSL_OP_ALL);
#if OPENSSL_VERSION_NUMBER >= 0x0090605fL
ssl_ctx_options &= ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS;
#endif
SSL_CTX_set_options(ctx, ssl_ctx_options);
ftp->ssl_handle = SSL_new(ctx);
if (ftp->ssl_handle == NULL) {
......@@ -1495,6 +1499,7 @@ data_accept(databuf_t *data, ftpbuf_t *ftp TSRMLS_DC)
#if HAVE_OPENSSL_EXT
SSL_CTX *ctx;
long ssl_ctx_options = SSL_OP_ALL;
#endif
if (data->fd != -1) {
......@@ -1521,7 +1526,10 @@ data_accepted:
return 0;
}
SSL_CTX_set_options(ctx, SSL_OP_ALL);
#if OPENSSL_VERSION_NUMBER >= 0x0090605fL
ssl_ctx_options &= ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS;
#endif
SSL_CTX_set_options(ctx, ssl_ctx_options);
data->ssl_handle = SSL_new(ctx);
if (data->ssl_handle == NULL) {
......
--TEST--
Optional long parameter might be null
--FILE--
<?php
echo mb_strpos('abb', 'b', null, 'UTF-8') . "\n";
echo mb_strrpos('abb', 'b', null, 'UTF-8') . "\n";
echo mb_stripos('abb', 'B', null, 'UTF-8') . "\n";
echo mb_strripos('abb', 'B', null, 'UTF-8') . "\n";
echo mb_strstr('foobarbaz', 'ba', null, 'UTF-8') . "\n";
echo mb_strrchr('foobarbaz', 'ba', null, 'UTF-8') . "\n";
echo mb_stristr('foobarbaz', 'BA', null, 'UTF-8') . "\n";
echo mb_strrichr('foobarbaz', 'BA', null, 'UTF-8') . "\n";
echo mb_substr('foobarbaz', 6, null, 'UTF-8') . "\n";
echo mb_strcut('foobarbaz', 6, null, 'UTF-8') . "\n";
echo mb_strimwidth('foobar', 0, 3, null, 'UTF-8') . "\n";
?>
==DONE==
--EXPECT--
1
2
1
2
barbaz
baz
barbaz
baz
baz
baz
foo
==DONE==
--XFAIL--
mb functions fail to allow null instead of actual value
......@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: mysqlnd_wireprotocol.c 321634 2012-01-01 13:15:04Z felipe $ */
/* $Id: mysqlnd_wireprotocol.c 323020 2012-02-02 15:00:42Z andrey $ */
#include "php.h"
#include "php_globals.h"
#include "mysqlnd.h"
......@@ -1177,7 +1177,11 @@ php_mysqlnd_rset_field_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC)
BAIL_IF_NO_MORE_DATA;
}
/* 1 byte filler */
/* 1 byte length */
if (12 != *p) {
DBG_ERR_FMT("Protocol error. Server sent false length. Expected 12 got %d", (int) *p);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Protocol error. Server sent false length. Expected 12");
}
p++;
BAIL_IF_NO_MORE_DATA;
......
......@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: xp_ssl.c 321634 2012-01-01 13:15:04Z felipe $ */
/* $Id: xp_ssl.c 322785 2012-01-26 05:15:57Z scottmac $ */
#include "php.h"
#include "ext/standard/file.h"
......@@ -310,6 +310,7 @@ static inline int php_openssl_setup_crypto(php_stream *stream,
TSRMLS_DC)
{
SSL_METHOD *method;
long ssl_ctx_options = SSL_OP_ALL;
if (sslsock->ssl_handle) {
if (sslsock->s.is_blocked) {
......@@ -377,7 +378,10 @@ static inline int php_openssl_setup_crypto(php_stream *stream,
return -1;
}
SSL_CTX_set_options(sslsock->ctx, SSL_OP_ALL);
#if OPENSSL_VERSION_NUMBER >= 0x0090605fL
ssl_ctx_options &= ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS;
#endif
SSL_CTX_set_options(sslsock->ctx, ssl_ctx_options);
#if OPENSSL_VERSION_NUMBER >= 0x0090806fL
{
......
......@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: php_pdo_sqlite_int.h 321634 2012-01-01 13:15:04Z felipe $ */
/* $Id: php_pdo_sqlite_int.h 322916 2012-01-29 04:22:23Z rasmus $ */
#ifndef PHP_PDO_SQLITE_INT_H
#define PHP_PDO_SQLITE_INT_H
......@@ -46,10 +46,19 @@ struct pdo_sqlite_func {
struct pdo_sqlite_fci afunc, astep, afini;
};
struct pdo_sqlite_collation {
struct pdo_sqlite_collation *next;
const char *name;
zval *callback;
struct pdo_sqlite_fci fc;
};
typedef struct {
sqlite3 *db;
pdo_sqlite_error_info einfo;
struct pdo_sqlite_func *funcs;
struct pdo_sqlite_collation *collations;
} pdo_sqlite_db_handle;
typedef struct {
......
......@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: sqlite_driver.c 321634 2012-01-01 13:15:04Z felipe $ */
/* $Id: sqlite_driver.c 322962 2012-01-31 07:17:05Z pajoye $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
......@@ -129,6 +129,27 @@ static void pdo_sqlite_cleanup_callbacks(pdo_sqlite_db_handle *H TSRMLS_DC)
}
efree(func);
}
while (H->collations) {
struct pdo_sqlite_collation *collation;
collation = H->collations;
H->collations = collation->next;
if (H->db) {
/* delete the collation from the handle */
sqlite3_create_collation(H->db,
collation->name,
SQLITE_UTF8,
collation,
NULL);
}
efree((char*)collation->name);
if (collation->callback) {
zval_ptr_dtor(&collation->callback);
}
efree(collation);
}
}
static int sqlite_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */
......@@ -457,6 +478,57 @@ static void php_sqlite3_func_final_callback(sqlite3_context *context)
do_callback(&func->afini, func->fini, 0, NULL, context, 1 TSRMLS_CC);
}
static int php_sqlite3_collation_callback(void *context,
int string1_len, const void *string1,
int string2_len, const void *string2)
{
int ret;
zval *zstring1, *zstring2;
zval **zargs[2];
zval *retval = NULL;
struct pdo_sqlite_collation *collation = (struct pdo_sqlite_collation*) context;
TSRMLS_FETCH();
collation->fc.fci.size = sizeof(collation->fc.fci);
collation->fc.fci.function_table = EG(function_table);
collation->fc.fci.function_name = collation->callback;
collation->fc.fci.symbol_table = NULL;
collation->fc.fci.object_ptr = NULL;
collation->fc.fci.retval_ptr_ptr = &retval;
// Prepare the arguments.
MAKE_STD_ZVAL(zstring1);
ZVAL_STRINGL(zstring1, (char *) string1, string1_len, 1);
zargs[0] = &zstring1;
MAKE_STD_ZVAL(zstring2);
ZVAL_STRINGL(zstring2, (char *) string2, string2_len, 1);
zargs[1] = &zstring2;
collation->fc.fci.param_count = 2;
collation->fc.fci.params = zargs;
if ((ret = zend_call_function(&collation->fc.fci, &collation->fc.fcc TSRMLS_CC)) == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "An error occurred while invoking the callback");
}
else if (retval) {
if (Z_TYPE_P(retval) != IS_LONG) {
convert_to_long_ex(&retval);
}
ret = 0;
if (Z_LVAL_P(retval) > 0) {
ret = 1;
}
else if (Z_LVAL_P(retval) < 0) {
ret = -1;
}
zval_ptr_dtor(&retval);
}
zval_ptr_dtor(zargs[0]);
zval_ptr_dtor(zargs[1]);
return ret;
}
/* {{{ bool SQLite::sqliteCreateFunction(string name, mixed callback [, int argcount])
Registers a UDF with the sqlite db handle */
static PHP_METHOD(SQLite, sqliteCreateFunction)
......@@ -590,9 +662,61 @@ static PHP_METHOD(SQLite, sqliteCreateAggregate)
RETURN_FALSE;
}
/* }}} */
/* {{{ bool SQLite::sqliteCreateCollation(string name, mixed callback)
Registers a collation with the sqlite db handle */
static PHP_METHOD(SQLite, sqliteCreateCollation)
{
struct pdo_sqlite_collation *collation;
zval *callback;
char *collation_name;
int collation_name_len;
char *cbname = NULL;
pdo_dbh_t *dbh;
pdo_sqlite_db_handle *H;
int ret;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz",
&collation_name, &collation_name_len, &callback)) {
RETURN_FALSE;
}
dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
PDO_CONSTRUCT_CHECK;
if (!zend_is_callable(callback, 0, &cbname TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%s' is not callable", cbname);
efree(cbname);
RETURN_FALSE;
}
efree(cbname);
H = (pdo_sqlite_db_handle *)dbh->driver_data;
collation = (struct pdo_sqlite_collation*)ecalloc(1, sizeof(*collation));
ret = sqlite3_create_collation(H->db, collation_name, SQLITE_UTF8, collation, php_sqlite3_collation_callback);
if (ret == SQLITE_OK) {
collation->name = estrdup(collation_name);
MAKE_STD_ZVAL(collation->callback);
MAKE_COPY_ZVAL(&callback, collation->callback);
collation->next = H->collations;
H->collations = collation;
RETURN_TRUE;
}
efree(collation);
RETURN_FALSE;
}
/* }}} */
static const zend_function_entry dbh_methods[] = {
PHP_ME(SQLite, sqliteCreateFunction, NULL, ZEND_ACC_PUBLIC)
PHP_ME(SQLite, sqliteCreateAggregate, NULL, ZEND_ACC_PUBLIC)
PHP_ME(SQLite, sqliteCreateCollation, NULL, ZEND_ACC_PUBLIC)
PHP_FE_END
};
......
--TEST--
PDO_sqlite: Testing sqliteCreateCollation()
--SKIPIF--
<?php if (!extension_loaded('pdo_sqlite')) print 'skip not loaded'; ?>
--FILE--
<?php
$db = new pdo('sqlite::memory:');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->query('CREATE TABLE IF NOT EXISTS foobar (id INT AUTO INCREMENT, name TEXT)');
$db->query('INSERT INTO foobar VALUES (NULL, "1")');
$db->query('INSERT INTO foobar VALUES (NULL, "2")');
$db->query('INSERT INTO foobar VALUES (NULL, "10")');
$db->sqliteCreateCollation('MYCOLLATE', function($a, $b) { return strnatcmp($a, $b); });
$result = $db->query('SELECT name FROM foobar ORDER BY name COLLATE MYCOLLATE');
foreach ($result as $row) {
echo $row['name'] . "\n";
}
$result = $db->query('SELECT name FROM foobar ORDER BY name');
foreach ($result as $row) {
echo $row['name'] . "\n";
}
$db->query('DROP TABLE foobar');
?>
--EXPECTF--
1
2
10
1
10
2
......@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: mod_user.c 321634 2012-01-01 13:15:04Z felipe $ */
/* $Id: mod_user.c 322909 2012-01-28 21:02:09Z felipe $ */
#include "php.h"
#include "php_session.h"
......@@ -80,6 +80,13 @@ PS_OPEN_FUNC(user)
{
zval *args[2];
STDVARS;
if (PSF(open) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,
"user session functions not defined");
return FAILURE;
}
SESS_ZVAL_STRING((char*)save_path, args[0]);
SESS_ZVAL_STRING((char*)session_name, args[1]);
......
--TEST--
Bug #60860 (session.save_handler=user without defined function core dumps)
--SKIPIF--
<?php include('skipif.inc'); ?>
--INI--
session.save_handler=user
--FILE--
<?php
session_start();
echo "ok\n";
?>
--EXPECTF--
Warning: session_start(): user session functions not defined in %s on line 3
Fatal error: session_start(): Failed to initialize storage module: user (path: ) in %s on line 3
......@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
/* $Id: php_sdl.c 321634 2012-01-01 13:15:04Z felipe $ */
/* $Id: php_sdl.c 322993 2012-02-01 12:16:52Z dmitry $ */
#include "php_soap.h"
#include "ext/libxml/php_libxml.h"
......@@ -237,11 +237,45 @@ void sdl_set_uri_credentials(sdlCtx *ctx, char *uri TSRMLS_DC)
s = strstr(ctx->sdl->source, "://");
if (!s) return;
s = strchr(s+3, '/');
l1 = s - ctx->sdl->source;
l1 = s ? (s - ctx->sdl->source) : strlen(ctx->sdl->source);
s = strstr((char*)uri, "://");
if (!s) return;
s = strchr(s+3, '/');
l2 = s - (char*)uri;
l2 = s ? (s - (char*)uri) : strlen((char*)uri);
if (l1 != l2) {
/* check for http://...:80/ */
if (l1 > 11 &&
ctx->sdl->source[4] == ':' &&
ctx->sdl->source[l1-3] == ':' &&
ctx->sdl->source[l1-2] == '8' &&
ctx->sdl->source[l1-1] == '0') {
l1 -= 3;
}
if (l2 > 11 &&
uri[4] == ':' &&
uri[l2-3] == ':' &&
uri[l2-2] == '8' &&
uri[l2-1] == '0') {
l2 -= 3;
}
/* check for https://...:443/ */
if (l1 > 13 &&
ctx->sdl->source[4] == 's' &&
ctx->sdl->source[l1-4] == ':' &&
ctx->sdl->source[l1-3] == '4' &&
ctx->sdl->source[l1-2] == '4' &&
ctx->sdl->source[l1-1] == '3') {
l1 -= 4;
}
if (l2 > 13 &&
uri[4] == 's' &&
uri[l2-4] == ':' &&
uri[l2-3] == '4' &&