mirror of
https://github.com/php/php-src.git
synced 2024-12-03 23:05:57 +08:00
Merge branch 'PHP-5.4' of ssh://git.php.net/php-src into PHP-5.4
This commit is contained in:
commit
a188693a27
@ -10,7 +10,7 @@ all: $(all_targets)
|
||||
@echo "Build complete."
|
||||
@echo "Don't forget to run 'make test'."
|
||||
@echo
|
||||
|
||||
|
||||
build-modules: $(PHP_MODULES) $(PHP_ZEND_EX)
|
||||
|
||||
build-binaries: $(PHP_BINARIES)
|
||||
@ -116,7 +116,7 @@ clean:
|
||||
rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/*
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h sapi/apache/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp
|
||||
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h sapi/apache/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak
|
||||
$(EGREP) define'.*include/php' $(top_srcdir)/configure | $(SED) 's/.*>//'|xargs rm -f
|
||||
|
||||
.PHONY: all clean install distclean test
|
||||
|
11
NEWS
11
NEWS
@ -3,10 +3,16 @@ PHP NEWS
|
||||
?? ??? 2013, PHP 5.4.19
|
||||
|
||||
- Core.
|
||||
. Fixed bug #65372 (Segfault in gc_zval_possible_root when return reference
|
||||
fails). (Laruence)
|
||||
. Fixed bug #65304 (Use of max int in array_sum). (Laruence)
|
||||
. Fixed bug #65291 (get_defined_constants() causes PHP to crash in a very
|
||||
limited case). (Arpad)
|
||||
. Improve fix for bug #63186 (compile failure on netbsd). (Matteo)
|
||||
. Fixed bug #61268 (--enable-dtrace leads make to clobber
|
||||
Zend/zend_dtrace.d) (Chris Jones)
|
||||
. Cherry picked some DTrace build commits (allowing builds on Linux,
|
||||
bug 62691, and bug 63706) from PHP 5.5 branch
|
||||
|
||||
- Session:
|
||||
. Fixed bug #62129 (rfc1867 crashes php even though turned off). (gxd305 at
|
||||
@ -14,6 +20,9 @@ PHP NEWS
|
||||
. Fixed bug #50308 (session id not appended properly for empty anchor tags).
|
||||
(Arpad)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #65018 (SoapHeader problems with SoapServer). (Dmitry)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #65328 (Segfault when getting SplStack object Value). (Laruence)
|
||||
|
||||
@ -22,7 +31,7 @@ PHP NEWS
|
||||
some specific contents). (Stas)
|
||||
|
||||
- Pgsql:
|
||||
. Fixed bug #65336 (pg_escape_literal/identifier() scilently returns false).
|
||||
. Fixed bug #65336 (pg_escape_literal/identifier() silently returns false).
|
||||
(Yasuo)
|
||||
|
||||
?? ??? 2013, PHP 5.4.18
|
||||
|
File diff suppressed because one or more lines are too long
40
Zend/tests/bug65372.phpt
Normal file
40
Zend/tests/bug65372.phpt
Normal file
@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
Bug #65372 (Segfault in gc_zval_possible_root when return reference fails)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class ParentClass
|
||||
{
|
||||
private static $_OBJECTS;
|
||||
|
||||
public static function Get()
|
||||
{
|
||||
self::$_OBJECTS[1] = new ChildClass();
|
||||
return self::$_OBJECTS[1];
|
||||
}
|
||||
}
|
||||
|
||||
class ChildClass extends ParentClass
|
||||
{
|
||||
public $Manager;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->Manager = $this;
|
||||
}
|
||||
|
||||
public static function &GetCurrent()
|
||||
{
|
||||
return ChildClass::Get();
|
||||
}
|
||||
|
||||
public static function &Get()
|
||||
{
|
||||
return parent::Get();
|
||||
}
|
||||
}
|
||||
|
||||
$staff = ChildClass::GetCurrent();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Only variable references should be returned by reference in %sbug65372.php on line 30
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Overridding Conflicting Methods should not result in a notice/warning about collisions
|
||||
Overriding Conflicting Methods should not result in a notice/warning about collisions
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
|
@ -2396,7 +2396,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
|
||||
MAKE_STD_ZVAL(arg_array);
|
||||
array_init(arg_array);
|
||||
|
||||
/* include_filename always points to the last filename of the last last called-fuction.
|
||||
/* include_filename always points to the last filename of the last last called-function.
|
||||
if we have called include in the frame above - this is the file we have included.
|
||||
*/
|
||||
|
||||
|
@ -1723,7 +1723,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
|
||||
}
|
||||
|
||||
{
|
||||
/* Push a seperator to the switch and foreach stacks */
|
||||
/* Push a separator to the switch and foreach stacks */
|
||||
zend_switch_entry switch_entry;
|
||||
|
||||
switch_entry.cond.op_type = IS_UNUSED;
|
||||
@ -1817,7 +1817,7 @@ void zend_do_end_function_declaration(const znode *function_token TSRMLS_DC) /*
|
||||
CG(active_op_array) = function_token->u.op_array;
|
||||
|
||||
|
||||
/* Pop the switch and foreach seperators */
|
||||
/* Pop the switch and foreach separators */
|
||||
zend_stack_del_top(&CG(switch_cond_stack));
|
||||
zend_stack_del_top(&CG(foreach_copy_stack));
|
||||
}
|
||||
@ -2584,7 +2584,7 @@ static int generate_free_foreach_copy(const zend_op *foreach_copy TSRMLS_DC) /*
|
||||
{
|
||||
zend_op *opline;
|
||||
|
||||
/* If we reach the seperator then stop applying the stack */
|
||||
/* If we reach the separator then stop applying the stack */
|
||||
if (foreach_copy->result_type == IS_UNUSED && foreach_copy->op1_type == IS_UNUSED) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -1072,7 +1072,7 @@ ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_
|
||||
}
|
||||
|
||||
/* The compiler is not-reentrant. Make sure we __autoload() only during run-time
|
||||
* (doesn't impact fuctionality of __autoload()
|
||||
* (doesn't impact functionality of __autoload()
|
||||
*/
|
||||
if (!use_autoload || zend_is_compiling(TSRMLS_C)) {
|
||||
if (!key) {
|
||||
|
@ -306,7 +306,7 @@ struct _zend_php_scanner_globals {
|
||||
unsigned char *script_filtered;
|
||||
size_t script_filtered_size;
|
||||
|
||||
/* input/ouput filters */
|
||||
/* input/output filters */
|
||||
zend_encoding_filter input_filter;
|
||||
zend_encoding_filter output_filter;
|
||||
const zend_encoding *script_encoding;
|
||||
|
@ -44,7 +44,7 @@ typedef struct _zend_lex_state {
|
||||
unsigned char *script_filtered;
|
||||
size_t script_filtered_size;
|
||||
|
||||
/* input/ouput filters */
|
||||
/* input/output filters */
|
||||
zend_encoding_filter input_filter;
|
||||
zend_encoding_filter output_filter;
|
||||
const zend_encoding *script_encoding;
|
||||
|
@ -2910,9 +2910,12 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
|
||||
} else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
zend_error(E_NOTICE, "Only variable references should be returned by reference");
|
||||
if (EG(return_value_ptr_ptr)) {
|
||||
retval_ptr = *retval_ptr_ptr;
|
||||
*EG(return_value_ptr_ptr) = retval_ptr;
|
||||
Z_ADDREF_P(retval_ptr);
|
||||
zval *ret;
|
||||
|
||||
ALLOC_ZVAL(ret);
|
||||
INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
|
||||
zval_copy_ctor(ret);
|
||||
*EG(return_value_ptr_ptr) = ret;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2324,9 +2324,12 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND
|
||||
} else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
zend_error(E_NOTICE, "Only variable references should be returned by reference");
|
||||
if (EG(return_value_ptr_ptr)) {
|
||||
retval_ptr = *retval_ptr_ptr;
|
||||
*EG(return_value_ptr_ptr) = retval_ptr;
|
||||
Z_ADDREF_P(retval_ptr);
|
||||
zval *ret;
|
||||
|
||||
ALLOC_ZVAL(ret);
|
||||
INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
|
||||
zval_copy_ctor(ret);
|
||||
*EG(return_value_ptr_ptr) = ret;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -6743,9 +6746,12 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE
|
||||
} else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
zend_error(E_NOTICE, "Only variable references should be returned by reference");
|
||||
if (EG(return_value_ptr_ptr)) {
|
||||
retval_ptr = *retval_ptr_ptr;
|
||||
*EG(return_value_ptr_ptr) = retval_ptr;
|
||||
Z_ADDREF_P(retval_ptr);
|
||||
zval *ret;
|
||||
|
||||
ALLOC_ZVAL(ret);
|
||||
INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
|
||||
zval_copy_ctor(ret);
|
||||
*EG(return_value_ptr_ptr) = ret;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -11055,9 +11061,12 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE
|
||||
} else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
zend_error(E_NOTICE, "Only variable references should be returned by reference");
|
||||
if (EG(return_value_ptr_ptr)) {
|
||||
retval_ptr = *retval_ptr_ptr;
|
||||
*EG(return_value_ptr_ptr) = retval_ptr;
|
||||
Z_ADDREF_P(retval_ptr);
|
||||
zval *ret;
|
||||
|
||||
ALLOC_ZVAL(ret);
|
||||
INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
|
||||
zval_copy_ctor(ret);
|
||||
*EG(return_value_ptr_ptr) = ret;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -27030,9 +27039,12 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER
|
||||
} else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
zend_error(E_NOTICE, "Only variable references should be returned by reference");
|
||||
if (EG(return_value_ptr_ptr)) {
|
||||
retval_ptr = *retval_ptr_ptr;
|
||||
*EG(return_value_ptr_ptr) = retval_ptr;
|
||||
Z_ADDREF_P(retval_ptr);
|
||||
zval *ret;
|
||||
|
||||
ALLOC_ZVAL(ret);
|
||||
INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
|
||||
zval_copy_ctor(ret);
|
||||
*EG(return_value_ptr_ptr) = ret;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
11
acinclude.m4
11
acinclude.m4
@ -2934,6 +2934,9 @@ dnl Add providerdesc.o into global objects when needed
|
||||
*solaris*)
|
||||
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.o"
|
||||
;;
|
||||
*linux*)
|
||||
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.o"
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl DTrace objects
|
||||
@ -2959,15 +2962,19 @@ dnl DTrace objects
|
||||
esac
|
||||
|
||||
dnl Generate Makefile.objects entries
|
||||
dnl The empty $ac_provsrc command stops an implicit circular dependency
|
||||
dnl in GNU Make which causes the .d file to be overwritten (Bug 61268)
|
||||
cat>>Makefile.objects<<EOF
|
||||
|
||||
$abs_srcdir/$ac_provsrc:;
|
||||
|
||||
$ac_bdir[$]ac_hdrobj: $abs_srcdir/$ac_provsrc
|
||||
dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@ && \$(SED) -ibak 's,PHP_,DTRACE_,g' \$[]@
|
||||
CFLAGS="\$(CFLAGS_CLEAN)" dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@.bak && \$(SED) 's,PHP_,DTRACE_,g' \$[]@.bak > \$[]@
|
||||
|
||||
\$(PHP_DTRACE_OBJS): $ac_bdir[$]ac_hdrobj
|
||||
|
||||
$ac_bdir[$]ac_provsrc.o: \$(PHP_DTRACE_OBJS)
|
||||
dtrace -G -o \$[]@ -s $abs_srcdir/$ac_provsrc $dtrace_objs
|
||||
CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o \$[]@ -s $abs_srcdir/$ac_provsrc $dtrace_objs
|
||||
|
||||
EOF
|
||||
])
|
||||
|
@ -1582,7 +1582,7 @@ cat <<X
|
||||
| see the file debug.log for error messages. |
|
||||
| |
|
||||
| If you are unable to fix this, send the file debug.log to the |
|
||||
| php-install@lists.php.net mailing list and include appropiate |
|
||||
| php-install@lists.php.net mailing list and include appropriate |
|
||||
| information about your setup. |
|
||||
X
|
||||
fi
|
||||
|
@ -1352,7 +1352,7 @@ PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_parse_date: Backwards compability function */
|
||||
/* {{{ php_parse_date: Backwards compatibility function */
|
||||
PHPAPI signed long php_parse_date(char *string, signed long *now)
|
||||
{
|
||||
timelib_time *parsed_time;
|
||||
|
@ -165,7 +165,7 @@ ZEND_END_MODULE_GLOBALS(date)
|
||||
#define DATEG(v) (date_globals.v)
|
||||
#endif
|
||||
|
||||
/* Backwards compability wrapper */
|
||||
/* Backwards compatibility wrapper */
|
||||
PHPAPI signed long php_parse_date(char *string, signed long *now);
|
||||
PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt);
|
||||
PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC);
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Bug #44648 (Attribute names not checked for wellformedness)
|
||||
Bug #44648 (Attribute names not checked for well formedness)
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
|
@ -11969,7 +11969,7 @@
|
||||
#>65 string ZSYS (Pre-System 7 system file)
|
||||
#>65 string acf3 (Aldus FreeHand)
|
||||
#>65 string cdev (control panel)
|
||||
#>65 string dfil (Desk Acessory suitcase)
|
||||
#>65 string dfil (Desk Accessory suitcase)
|
||||
#>65 string libr (library)
|
||||
#>65 string nX^d (WriteNow word processor)
|
||||
#>65 string nX^w (WriteNow dictionary)
|
||||
|
@ -39,7 +39,7 @@
|
||||
#ifdef PHP_WIN32
|
||||
#include <winsock2.h>
|
||||
#elif defined(NETWARE)
|
||||
#ifdef USE_WINSOCK /* Modified to use Winsock (NOVSOCK2.H), atleast for now */
|
||||
#ifdef USE_WINSOCK /* Modified to use Winsock (NOVSOCK2.H), at least for now */
|
||||
#include <novsock2.h>
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
@ -612,7 +612,7 @@ ftp_chmod(ftpbuf_t *ftp, const int mode, const char *filename, const int filenam
|
||||
/* {{{ ftp_alloc
|
||||
*/
|
||||
int
|
||||
ftp_alloc(ftpbuf_t *ftp, const int size, char **response)
|
||||
ftp_alloc(ftpbuf_t *ftp, const long size, char **response)
|
||||
{
|
||||
char buffer[64];
|
||||
|
||||
@ -620,8 +620,8 @@ ftp_alloc(ftpbuf_t *ftp, const int size, char **response)
|
||||
return 0;
|
||||
}
|
||||
|
||||
snprintf(buffer, sizeof(buffer) - 1, "%d", size);
|
||||
|
||||
snprintf(buffer, sizeof(buffer) - 1, "%ld", size);
|
||||
|
||||
if (!ftp_putcmd(ftp, "ALLO", buffer)) {
|
||||
return 0;
|
||||
}
|
||||
@ -787,7 +787,7 @@ ftp_pasv(ftpbuf_t *ftp, int pasv)
|
||||
/* {{{ ftp_get
|
||||
*/
|
||||
int
|
||||
ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC)
|
||||
ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC)
|
||||
{
|
||||
databuf_t *data = NULL;
|
||||
int lastch;
|
||||
@ -808,11 +808,7 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
|
||||
ftp->data = data;
|
||||
|
||||
if (resumepos > 0) {
|
||||
if (resumepos > 2147483647) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater than 2147483647 bytes.");
|
||||
goto bail;
|
||||
}
|
||||
snprintf(arg, sizeof(arg), "%u", resumepos);
|
||||
snprintf(arg, sizeof(arg), "%ld", resumepos);
|
||||
if (!ftp_putcmd(ftp, "REST", arg)) {
|
||||
goto bail;
|
||||
}
|
||||
@ -885,10 +881,10 @@ bail:
|
||||
/* {{{ ftp_put
|
||||
*/
|
||||
int
|
||||
ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC)
|
||||
ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC)
|
||||
{
|
||||
databuf_t *data = NULL;
|
||||
int size;
|
||||
long size;
|
||||
char *ptr;
|
||||
int ch;
|
||||
char arg[11];
|
||||
@ -905,11 +901,7 @@ ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, i
|
||||
ftp->data = data;
|
||||
|
||||
if (startpos > 0) {
|
||||
if (startpos > 2147483647) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater than 2147483647 bytes.");
|
||||
goto bail;
|
||||
}
|
||||
snprintf(arg, sizeof(arg), "%u", startpos);
|
||||
snprintf(arg, sizeof(arg), "%ld", startpos);
|
||||
if (!ftp_putcmd(ftp, "REST", arg)) {
|
||||
goto bail;
|
||||
}
|
||||
@ -966,7 +958,7 @@ bail:
|
||||
|
||||
/* {{{ ftp_size
|
||||
*/
|
||||
int
|
||||
long
|
||||
ftp_size(ftpbuf_t *ftp, const char *path)
|
||||
{
|
||||
if (ftp == NULL) {
|
||||
@ -981,7 +973,7 @@ ftp_size(ftpbuf_t *ftp, const char *path)
|
||||
if (!ftp_getresp(ftp) || ftp->resp != 213) {
|
||||
return -1;
|
||||
}
|
||||
return atoi(ftp->inbuf);
|
||||
return atol(ftp->inbuf);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -1143,7 +1135,7 @@ ftp_putcmd(ftpbuf_t *ftp, const char *cmd, const char *args)
|
||||
int
|
||||
ftp_readline(ftpbuf_t *ftp)
|
||||
{
|
||||
int size, rcvd;
|
||||
long size, rcvd;
|
||||
char *data, *eol;
|
||||
|
||||
/* shift the extra to the front */
|
||||
@ -1236,7 +1228,8 @@ ftp_getresp(ftpbuf_t *ftp)
|
||||
int
|
||||
my_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len)
|
||||
{
|
||||
int n, size, sent;
|
||||
long size, sent;
|
||||
int n;
|
||||
|
||||
size = len;
|
||||
while (size) {
|
||||
@ -1719,7 +1712,7 @@ bail:
|
||||
/* {{{ ftp_nb_get
|
||||
*/
|
||||
int
|
||||
ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC)
|
||||
ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC)
|
||||
{
|
||||
databuf_t *data = NULL;
|
||||
char arg[11];
|
||||
@ -1737,14 +1730,7 @@ ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t typ
|
||||
}
|
||||
|
||||
if (resumepos>0) {
|
||||
/* We are working on an architecture that supports 64-bit integers
|
||||
* since php is 32 bit by design, we bail out with warning
|
||||
*/
|
||||
if (resumepos > 2147483647) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater than 2147483648 bytes.");
|
||||
goto bail;
|
||||
}
|
||||
snprintf(arg, sizeof(arg), "%u", resumepos);
|
||||
snprintf(arg, sizeof(arg), "%ld", resumepos);
|
||||
if (!ftp_putcmd(ftp, "REST", arg)) {
|
||||
goto bail;
|
||||
}
|
||||
@ -1843,7 +1829,7 @@ bail:
|
||||
/* {{{ ftp_nb_put
|
||||
*/
|
||||
int
|
||||
ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC)
|
||||
ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC)
|
||||
{
|
||||
databuf_t *data = NULL;
|
||||
char arg[11];
|
||||
@ -1858,11 +1844,7 @@ ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type
|
||||
goto bail;
|
||||
}
|
||||
if (startpos > 0) {
|
||||
if (startpos > 2147483647) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater than 2147483647 bytes.");
|
||||
goto bail;
|
||||
}
|
||||
snprintf(arg, sizeof(arg), "%u", startpos);
|
||||
snprintf(arg, sizeof(arg), "%ld", startpos);
|
||||
if (!ftp_putcmd(ftp, "REST", arg)) {
|
||||
goto bail;
|
||||
}
|
||||
@ -1899,7 +1881,7 @@ bail:
|
||||
int
|
||||
ftp_nb_continue_write(ftpbuf_t *ftp TSRMLS_DC)
|
||||
{
|
||||
int size;
|
||||
long size;
|
||||
char *ptr;
|
||||
int ch;
|
||||
|
||||
|
@ -146,7 +146,7 @@ int ftp_chmod(ftpbuf_t *ftp, const int mode, const char *filename, const int fi
|
||||
* however some servers will not accept STOR or APPE until ALLO is confirmed.
|
||||
* If response is passed, it is estrdup()ed from ftp->inbuf and must be freed
|
||||
* or assigned to a zval returned to the user */
|
||||
int ftp_alloc(ftpbuf_t *ftp, const int size, char **response);
|
||||
int ftp_alloc(ftpbuf_t *ftp, const long size, char **response);
|
||||
|
||||
/* returns a NULL-terminated array of filenames in the given path
|
||||
* or NULL on error. the return array must be freed (but don't
|
||||
@ -169,15 +169,15 @@ int ftp_pasv(ftpbuf_t *ftp, int pasv);
|
||||
/* retrieves a file and saves its contents to outfp
|
||||
* returns true on success, false on error
|
||||
*/
|
||||
int ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC);
|
||||
int ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC);
|
||||
|
||||
/* stores the data from a file, socket, or process as a file on the remote server
|
||||
* returns true on success, false on error
|
||||
*/
|
||||
int ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC);
|
||||
int ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC);
|
||||
|
||||
/* returns the size of the given file, or -1 on error */
|
||||
int ftp_size(ftpbuf_t *ftp, const char *path);
|
||||
long ftp_size(ftpbuf_t *ftp, const char *path);
|
||||
|
||||
/* returns the last modified time of the given file, or -1 on error */
|
||||
time_t ftp_mdtm(ftpbuf_t *ftp, const char *path);
|
||||
@ -194,12 +194,12 @@ int ftp_site(ftpbuf_t *ftp, const char *cmd);
|
||||
/* retrieves part of a file and saves its contents to outfp
|
||||
* returns true on success, false on error
|
||||
*/
|
||||
int ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC);
|
||||
int ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC);
|
||||
|
||||
/* stores the data from a file, socket, or process as a file on the remote server
|
||||
* returns true on success, false on error
|
||||
*/
|
||||
int ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC);
|
||||
int ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC);
|
||||
|
||||
/* continues a previous nb_(f)get command
|
||||
*/
|
||||
|
@ -784,8 +784,8 @@ PHP_FUNCTION(ftp_nb_fget)
|
||||
ftptype_t xtype;
|
||||
php_stream *stream;
|
||||
char *file;
|
||||
int file_len, ret;
|
||||
long mode, resumepos=0;
|
||||
int file_len;
|
||||
long mode, resumepos=0, ret;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsl|l", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) {
|
||||
return;
|
||||
@ -968,9 +968,7 @@ PHP_FUNCTION(ftp_nb_get)
|
||||
RETURN_LONG(PHP_FTP_FAILED);
|
||||
}
|
||||
|
||||
if (ret == PHP_FTP_FINISHED) {
|
||||
php_stream_close(outstream);
|
||||
}
|
||||
php_stream_close(outstream);
|
||||
|
||||
RETURN_LONG(ret);
|
||||
}
|
||||
@ -982,7 +980,7 @@ PHP_FUNCTION(ftp_nb_continue)
|
||||
{
|
||||
zval *z_ftp;
|
||||
ftpbuf_t *ftp;
|
||||
int ret;
|
||||
long ret;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_ftp) == FAILURE) {
|
||||
return;
|
||||
@ -1120,7 +1118,7 @@ PHP_FUNCTION(ftp_put)
|
||||
ftpbuf_t *ftp;
|
||||
ftptype_t xtype;
|
||||
char *remote, *local;
|
||||
int remote_len, local_len;
|
||||
long remote_len, local_len;
|
||||
long mode, startpos=0;
|
||||
php_stream *instream;
|
||||
|
||||
@ -1173,8 +1171,8 @@ PHP_FUNCTION(ftp_nb_put)
|
||||
ftpbuf_t *ftp;
|
||||
ftptype_t xtype;
|
||||
char *remote, *local;
|
||||
int remote_len, local_len, ret;
|
||||
long mode, startpos=0;
|
||||
int remote_len, local_len;
|
||||
long mode, startpos=0, ret;
|
||||
php_stream *instream;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) {
|
||||
|
23
ext/ftp/tests/filesize_large.phpt
Normal file
23
ext/ftp/tests/filesize_large.phpt
Normal file
@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Verify php can handle filesizes >32bit
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require 'skipif.inc';
|
||||
if (2147483647 == PHP_INT_MAX) {
|
||||
die('skip 64-bit only');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require 'server.inc';
|
||||
|
||||
$ftp = ftp_connect('127.0.0.1', $port);
|
||||
if (!$ftp) die("Couldn't connect to the server");
|
||||
|
||||
ftp_login($ftp, 'user', 'pass');
|
||||
var_dump(ftp_size($ftp, 'largefile'));
|
||||
|
||||
ftp_close($ftp);
|
||||
?>
|
||||
--EXPECT--
|
||||
int(5368709120)
|
36
ext/ftp/tests/ftp_nb_get_large.phpt
Normal file
36
ext/ftp/tests/ftp_nb_get_large.phpt
Normal file
@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
Testing ftp_nb_fget can handle large files incl. resume
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require 'skipif.inc';
|
||||
if (2147483647 == PHP_INT_MAX) {
|
||||
die('skip ot supported on this system');
|
||||
}
|
||||
if (disk_free_space(__DIR__) < 10*1024*1024*1024) {
|
||||
die('not enough disk space');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require 'server.inc';
|
||||
|
||||
$ftp = ftp_connect('127.0.0.1', $port);
|
||||
ftp_login($ftp, 'user', 'pass');
|
||||
if (!$ftp) die("Couldn't connect to the server");
|
||||
|
||||
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
|
||||
touch($local_file);
|
||||
ftp_nb_get($ftp, $local_file, 'fget_large.txt', FTP_BINARY, 5368709119);
|
||||
$fp = fopen($local_file, 'r');
|
||||
fseek($fp, 5368709119);
|
||||
var_dump(fread($fp, 1));
|
||||
var_dump(filesize($local_file));
|
||||
fclose($fp);
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
|
||||
?>
|
||||
--EXPECT--
|
||||
string(1) "X"
|
||||
int(5368709120)
|
@ -357,7 +357,17 @@ if ($pid) {
|
||||
$transfer_type = $ascii? 'ASCII' : 'BINARY' ;
|
||||
fputs($fs, "Bar\r\n");
|
||||
fputs($s, "226 Closing data Connection.\r\n");
|
||||
break;
|
||||
break;
|
||||
case "fget_large":
|
||||
fputs($s, "150 File status okay; about to open data connection.\r\n");
|
||||
$transfer_type = $ascii? 'ASCII' : 'BINARY' ;
|
||||
if ($GLOBALS['rest_pos'] == '5368709119') {
|
||||
fputs($fs, "X");
|
||||
} else {
|
||||
fputs($fs, "Y");
|
||||
}
|
||||
fputs($s, "226 Closing data Connection.\r\n");
|
||||
break;
|
||||
default:
|
||||
fputs($s, "550 {$matches[1]}: No such file or directory \r\n");
|
||||
break;
|
||||
@ -393,11 +403,12 @@ if ($pid) {
|
||||
}elseif (preg_match('/^LIST no_exists\//', $buf, $matches)) {
|
||||
fputs($s, "425 Error establishing connection\r\n");
|
||||
|
||||
}elseif (preg_match('/^REST \d+/', $buf, $matches)) {
|
||||
}elseif (preg_match('/^REST (\d+)/', $buf, $matches)) {
|
||||
$GLOBALS['rest_pos'] = $matches[1];
|
||||
fputs($s, "350 OK\r\n");
|
||||
}
|
||||
|
||||
else {
|
||||
}elseif (preg_match('/^SIZE largefile/', $buf)) {
|
||||
fputs($s, "213 5368709120\r\n");
|
||||
}else {
|
||||
fputs($s, "500 Syntax error, command unrecognized.\r\n");
|
||||
dump_and_exit($buf);
|
||||
}
|
||||
@ -407,4 +418,4 @@ if ($pid) {
|
||||
}
|
||||
|
||||
fclose($socket);
|
||||
?>
|
||||
?>
|
||||
|
@ -79,7 +79,7 @@ const struct mbfl_convert_vtbl vtbl_utf8_wchar = {
|
||||
mbfl_filt_conv_common_ctor,
|
||||
mbfl_filt_conv_common_dtor,
|
||||
mbfl_filt_conv_utf8_wchar,
|
||||
mbfl_filt_conv_common_flush
|
||||
mbfl_filt_conv_utf8_wchar_flush
|
||||
};
|
||||
|
||||
const struct mbfl_convert_vtbl vtbl_wchar_utf8 = {
|
||||
@ -93,6 +93,17 @@ const struct mbfl_convert_vtbl vtbl_wchar_utf8 = {
|
||||
|
||||
#define CK(statement) do { if ((statement) < 0) return (-1); } while (0)
|
||||
|
||||
int mbfl_filt_put_invalid_char(int c, mbfl_convert_filter *filter)
|
||||
{
|
||||
int w;
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
w |= MBFL_WCSGROUP_THROUGH;
|
||||
filter->status = 0;
|
||||
filter->cache = 0;
|
||||
CK((*filter->output_function)(w, filter->data));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* UTF-8 => wchar
|
||||
*/
|
||||
@ -100,111 +111,104 @@ int mbfl_filt_conv_utf8_wchar(int c, mbfl_convert_filter *filter)
|
||||
{
|
||||
int s, c1, w = 0, flag = 0;
|
||||
|
||||
if (c < 0x80) {
|
||||
if (filter->status != 0) {
|
||||
w = (filter->cache & MBFL_WCSGROUP_MASK) | MBFL_WCSGROUP_THROUGH;
|
||||
CK((*filter->output_function)(w, filter->data));
|
||||
filter->status = 0;
|
||||
filter->cache = 0;
|
||||
}
|
||||
if (c >= 0) {
|
||||
retry:
|
||||
switch (filter->status & 0xff) {
|
||||
case 0x00:
|
||||
if (c < 0x80) {
|
||||
CK((*filter->output_function)(c, filter->data));
|
||||
}
|
||||
} else if (c < 0xc0) {
|
||||
int status = filter->status & 0xff;
|
||||
switch (status) {
|
||||
case 0x10: /* 2byte code 2nd char: 0x80-0xbf */
|
||||
case 0x21: /* 3byte code 3rd char: 0x80-0xbf */
|
||||
case 0x32: /* 4byte code 4th char: 0x80-0xbf */
|
||||
filter->status = 0;
|
||||
s = filter->cache | (c & 0x3f);
|
||||
filter->cache = 0;
|
||||
if ((status == 0x10 && s >= 0x80) ||
|
||||
(status == 0x21 && s >= 0x800 && (s < 0xd800 || s > 0xdfff)) ||
|
||||
(status == 0x32 && s >= 0x10000 && s < 0x110000)) {
|
||||
CK((*filter->output_function)(s, filter->data));
|
||||
} else {
|
||||
w = s & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
break;
|
||||
case 0x20: /* 3byte code 2nd char: 0:0xa0-0xbf,D:0x80-9F,1-C,E-F:0x80-0x9f */
|
||||
s = filter->cache | ((c & 0x3f) << 6);
|
||||
c1 = (s >> 12) & 0xf;
|
||||
if ((c1 == 0x0 && c >= 0xa0) ||
|
||||
(c1 == 0xd && c < 0xa0) ||
|
||||
(c1 > 0x0 && c1 != 0xd)) {
|
||||
filter->cache = s;
|
||||
filter->status++;
|
||||
} else {
|
||||
w = s & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
break;
|
||||
case 0x31: /* 4byte code 3rd char: 0x80-0xbf */
|
||||
filter->cache |= ((c & 0x3f) << 6);
|
||||
filter->status++;
|
||||
break;
|
||||
case 0x30: /* 4byte code 2nd char: 0:0x90-0xbf,1-3:0x80-0xbf,4:0x80-0x8f */
|
||||
s = filter->cache | ((c & 0x3f) << 12);
|
||||
c1 = (s >> 18) & 0x7;
|
||||
if ((c1 == 0x0 && c >= 0x90) ||
|
||||
(c1 > 0x0 && c1 < 0x4) ||
|
||||
(c1 == 0x4 && c < 0x90)) {
|
||||
filter->cache = s;
|
||||
filter->status++;
|
||||
} else {
|
||||
w = s & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
break;
|
||||
}
|
||||
} else if (c < 0xc2) { /* invalid: 0xc0,0xc1 */
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
} else if (c < 0xe0) { /* 2byte code first char: 0xc2-0xdf */
|
||||
if (filter->status == 0x0) {
|
||||
} else if (c >= 0xc2 && c <= 0xdf) { /* 2byte code first char: 0xc2-0xdf */
|
||||
filter->status = 0x10;
|
||||
filter->cache = (c & 0x1f) << 6;
|
||||
} else {
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
} else if (c < 0xf0) { /* 3byte code first char: 0xe0-0xef */
|
||||
if (filter->status == 0x0) {
|
||||
filter->cache = c & 0x1f;
|
||||
} else if (c >= 0xe0 && c <= 0xef) { /* 3byte code first char: 0xe0-0xef */
|
||||
filter->status = 0x20;
|
||||
filter->cache = (c & 0xf) << 12;
|
||||
} else {
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
} else if (c < 0xf5) { /* 4byte code first char: 0xf0-0xf4 */
|
||||
if (filter->status == 0x0) {
|
||||
filter->cache = c & 0xf;
|
||||
} else if (c >= 0xf0 && c <= 0xf4) { /* 3byte code first char: 0xf0-0xf4 */
|
||||
filter->status = 0x30;
|
||||
filter->cache = (c & 0x7) << 18;
|
||||
filter->cache = c & 0x7;
|
||||
} else {
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
mbfl_filt_put_invalid_char(c, filter);
|
||||
}
|
||||
} else {
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
w |= MBFL_WCSGROUP_THROUGH;
|
||||
CK((*filter->output_function)(w, filter->data));
|
||||
break;
|
||||
case 0x10: /* 2byte code 2nd char: 0x80-0xbf */
|
||||
case 0x21: /* 3byte code 3rd char: 0x80-0xbf */
|
||||
case 0x32: /* 4byte code 4th char: 0x80-0xbf */
|
||||
filter->status = 0;
|
||||
filter->cache = 0;
|
||||
if (c >= 0x80 && c <= 0xbf) {
|
||||
s = (filter->cache<<6) | (c & 0x3f);
|
||||
filter->cache = 0;
|
||||
CK((*filter->output_function)(s, filter->data));
|
||||
} else {
|
||||
mbfl_filt_put_invalid_char(filter->cache, filter);
|
||||
goto retry;
|
||||
}
|
||||
break;
|
||||
case 0x20: /* 3byte code 2nd char: 0:0xa0-0xbf,D:0x80-9F,1-C,E-F:0x80-0x9f */
|
||||
s = (filter->cache<<6) | (c & 0x3f);
|
||||
c1 = filter->cache & 0xf;
|
||||
|
||||
if ((c >= 0x80 && c <= 0xbf) &&
|
||||
((c1 == 0x0 && c >= 0xa0) ||
|
||||
(c1 == 0xd && c < 0xa0) ||
|
||||
(c1 > 0x0 && c1 != 0xd))) {
|
||||
filter->cache = s;
|
||||
filter->status++;
|
||||
} else {
|
||||
mbfl_filt_put_invalid_char(filter->cache, filter);
|
||||
goto retry;
|
||||
}
|
||||
break;
|
||||
case 0x30: /* 4byte code 2nd char: 0:0x90-0xbf,1-3:0x80-0xbf,4:0x80-0x8f */
|
||||
s = (filter->cache<<6) | (c & 0x3f);
|
||||
c1 = filter->cache & 0x7;
|
||||
|
||||
if ((c >= 0x80 && c <= 0xbf) &&
|
||||
((c1 == 0x0 && c >= 0x90) ||
|
||||
(c1 == 0x4 && c < 0x90) ||
|
||||
(c1 > 0x0 && c1 != 0x4))) {
|
||||
filter->cache = s;
|
||||
filter->status++;
|
||||
} else {
|
||||
mbfl_filt_put_invalid_char(filter->cache, filter);
|
||||
goto retry;
|
||||
}
|
||||
break;
|
||||
case 0x31: /* 4byte code 3rd char: 0x80-0xbf */
|
||||
if (c >= 0x80 && c <= 0xbf) {
|
||||
filter->cache = (filter->cache<<6) | (c & 0x3f);
|
||||
filter->status++;
|
||||
} else {
|
||||
mbfl_filt_put_invalid_char(filter->cache, filter);
|
||||
goto retry;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
filter->status = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
int mbfl_filt_conv_utf8_wchar_flush(mbfl_convert_filter *filter)
|
||||
{
|
||||
int status, cache;
|
||||
|
||||
status = filter->status;
|
||||
cache = filter->cache;
|
||||
|
||||
filter->status = 0;
|
||||
filter->cache = 0;
|
||||
|
||||
if (status != 0) {
|
||||
mbfl_filt_put_invalid_char(cache, filter);
|
||||
}
|
||||
|
||||
if (filter->flush_function != NULL) {
|
||||
(*filter->flush_function)(filter->data);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* wchar => UTF-8
|
||||
*/
|
||||
|
@ -37,5 +37,6 @@ extern const struct mbfl_convert_vtbl vtbl_wchar_utf8;
|
||||
|
||||
int mbfl_filt_conv_utf8_wchar(int c, mbfl_convert_filter *filter);
|
||||
int mbfl_filt_conv_wchar_utf8(int c, mbfl_convert_filter *filter);
|
||||
int mbfl_filt_conv_utf8_wchar_flush(mbfl_convert_filter *filter);
|
||||
|
||||
#endif /* MBFL_MBFILTER_UTF8_H */
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "mbfilter_sjis_mobile.h"
|
||||
|
||||
extern int mbfl_filt_ident_utf8(int c, mbfl_identify_filter *filter);
|
||||
extern int mbfl_filt_conv_utf8_wchar_flush(mbfl_convert_filter *filter);
|
||||
|
||||
extern const unsigned char mblen_table_utf8[];
|
||||
|
||||
@ -115,7 +116,7 @@ const struct mbfl_convert_vtbl vtbl_utf8_docomo_wchar = {
|
||||
mbfl_filt_conv_common_ctor,
|
||||
mbfl_filt_conv_common_dtor,
|
||||
mbfl_filt_conv_utf8_mobile_wchar,
|
||||
mbfl_filt_conv_common_flush
|
||||
mbfl_filt_conv_utf8_wchar_flush
|
||||
};
|
||||
|
||||
const struct mbfl_convert_vtbl vtbl_wchar_utf8_docomo = {
|
||||
@ -133,7 +134,7 @@ const struct mbfl_convert_vtbl vtbl_utf8_kddi_a_wchar = {
|
||||
mbfl_filt_conv_common_ctor,
|
||||
mbfl_filt_conv_common_dtor,
|
||||
mbfl_filt_conv_utf8_mobile_wchar,
|
||||
mbfl_filt_conv_common_flush
|
||||
mbfl_filt_conv_utf8_wchar_flush
|
||||
};
|
||||
|
||||
const struct mbfl_convert_vtbl vtbl_wchar_utf8_kddi_a = {
|
||||
@ -151,7 +152,7 @@ const struct mbfl_convert_vtbl vtbl_utf8_kddi_b_wchar = {
|
||||
mbfl_filt_conv_common_ctor,
|
||||
mbfl_filt_conv_common_dtor,
|
||||
mbfl_filt_conv_utf8_mobile_wchar,
|
||||
mbfl_filt_conv_common_flush
|
||||
mbfl_filt_conv_utf8_wchar_flush
|
||||
};
|
||||
|
||||
const struct mbfl_convert_vtbl vtbl_wchar_utf8_kddi_b = {
|
||||
@ -169,7 +170,7 @@ const struct mbfl_convert_vtbl vtbl_utf8_sb_wchar = {
|
||||
mbfl_filt_conv_common_ctor,
|
||||
mbfl_filt_conv_common_dtor,
|
||||
mbfl_filt_conv_utf8_mobile_wchar,
|
||||
mbfl_filt_conv_common_flush
|
||||
mbfl_filt_conv_utf8_wchar_flush
|
||||
};
|
||||
|
||||
const struct mbfl_convert_vtbl vtbl_wchar_utf8_sb = {
|
||||
@ -191,119 +192,97 @@ int mbfl_filt_conv_utf8_mobile_wchar(int c, mbfl_convert_filter *filter)
|
||||
int s, w = 0, flag = 0;
|
||||
int s1 = 0, c1 = 0, snd = 0;
|
||||
|
||||
if (c < 0x80) {
|
||||
if (c >= 0) {
|
||||
retry:
|
||||
switch (filter->status & 0xff) {
|
||||
case 0x00:
|
||||
if (c < 0x80) {
|
||||
CK((*filter->output_function)(c, filter->data));
|
||||
}
|
||||
filter->status = 0;
|
||||
} else if (c < 0xc0) {
|
||||
int status = filter->status & 0xff;
|
||||
switch (status) {
|
||||
case 0x10: /* 2byte code 2nd char: 0x80-0xbf */
|
||||
case 0x21: /* 3byte code 3rd char: 0x80-0xbf */
|
||||
case 0x32: /* 4byte code 4th char: 0x80-0xbf */
|
||||
filter->status = 0;
|
||||
s = filter->cache | (c & 0x3f);
|
||||
filter->cache = 0;
|
||||
if ((status == 0x10 && s >= 0x80) ||
|
||||
(status == 0x21 && s >= 0x800 && (s < 0xd800 || s > 0xdfff)) ||
|
||||
(status == 0x32 && s >= 0x10000 && s < 0x110000)) {
|
||||
|
||||
if (filter->from->no_encoding == mbfl_no_encoding_utf8_docomo &&
|
||||
mbfilter_conv_r_map_tbl(s, &s1, mbfl_docomo2uni_pua, 4) > 0) {
|
||||
s = mbfilter_sjis_emoji_docomo2unicode(s1, &snd);
|
||||
} else if (filter->from->no_encoding == mbfl_no_encoding_utf8_kddi_a &&
|
||||
mbfilter_conv_r_map_tbl(s, &s1, mbfl_kddi2uni_pua, 7) > 0) {
|
||||
s = mbfilter_sjis_emoji_kddi2unicode(s1, &snd);
|
||||
} else if (filter->from->no_encoding == mbfl_no_encoding_utf8_kddi_b &&
|
||||
mbfilter_conv_r_map_tbl(s, &s1, mbfl_kddi2uni_pua_b, 8) > 0) {
|
||||
s = mbfilter_sjis_emoji_kddi2unicode(s1, &snd);
|
||||
} else if (filter->from->no_encoding == mbfl_no_encoding_utf8_sb &&
|
||||
mbfilter_conv_r_map_tbl(s, &s1, mbfl_sb2uni_pua, 6) > 0) {
|
||||
s = mbfilter_sjis_emoji_sb2unicode(s1, &snd);
|
||||
}
|
||||
|
||||
if (snd > 0) {
|
||||
CK((*filter->output_function)(snd, filter->data));
|
||||
}
|
||||
CK((*filter->output_function)(s, filter->data));
|
||||
} else {
|
||||
w = s & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
break;
|
||||
case 0x20: /* 3byte code 2nd char: 0:0xa0-0xbf,D:0x80-9F,1-C,E-F:0x80-0x9f */
|
||||
s = filter->cache | ((c & 0x3f) << 6);
|
||||
c1 = (s >> 12) & 0xf;
|
||||
if ((c1 == 0x0 && c >= 0xa0) ||
|
||||
(c1 == 0xd && c < 0xa0) ||
|
||||
(c1 > 0x0 && c1 != 0xd)) {
|
||||
filter->cache = s;
|
||||
filter->status++;
|
||||
} else {
|
||||
w = s & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
break;
|
||||
case 0x31: /* 4byte code 3rd char: 0x80-0xbf */
|
||||
filter->cache |= ((c & 0x3f) << 6);
|
||||
filter->status++;
|
||||
break;
|
||||
case 0x30: /* 4byte code 2nd char: 0:0x90-0xbf,1-3:0x80-0xbf,4:0x80-0x8f */
|
||||
s = filter->cache | ((c & 0x3f) << 12);
|
||||
c1 = (s >> 18) & 0x7;
|
||||
if ((c1 == 0x0 && c >= 0x90) ||
|
||||
(c1 > 0x0 && c1 < 0x4) ||
|
||||
(c1 == 0x4 && c < 0x90)) {
|
||||
filter->cache = s;
|
||||
filter->status++;
|
||||
} else {
|
||||
w = s & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
break;
|
||||
}
|
||||
} else if (c < 0xc2) { /* invalid: 0xc0,0xc1 */
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
} else if (c < 0xe0) { /* 2byte code first char: 0xc2-0xdf */
|
||||
if (filter->status == 0x0) {
|
||||
} else if (c >= 0xc2 && c <= 0xdf) { /* 2byte code first char: 0xc2-0xdf */
|
||||
filter->status = 0x10;
|
||||
filter->cache = (c & 0x1f) << 6;
|
||||
} else {
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
} else if (c < 0xf0) { /* 3byte code first char: 0xe0-0xef */
|
||||
if (filter->status == 0x0) {
|
||||
filter->cache = c & 0x1f;
|
||||
} else if (c >= 0xe0 && c <= 0xef) { /* 3byte code first char: 0xe0-0xef */
|
||||
filter->status = 0x20;
|
||||
filter->cache = (c & 0xf) << 12;
|
||||
} else {
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
} else if (c < 0xf5) { /* 4byte code first char: 0xf0-0xf4 */
|
||||
if (filter->status == 0x0) {
|
||||
filter->cache = c & 0xf;
|
||||
} else if (c >= 0xf0 && c <= 0xf4) { /* 3byte code first char: 0xf0-0xf4 */
|
||||
filter->status = 0x30;
|
||||
filter->cache = (c & 0x7) << 18;
|
||||
filter->cache = c & 0x7;
|
||||
} else {
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
mbfl_filt_put_invalid_char(c, filter);
|
||||
}
|
||||
} else {
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
w |= MBFL_WCSGROUP_THROUGH;
|
||||
CK((*filter->output_function)(w, filter->data));
|
||||
break;
|
||||
case 0x10: /* 2byte code 2nd char: 0x80-0xbf */
|
||||
case 0x21: /* 3byte code 3rd char: 0x80-0xbf */
|
||||
case 0x32: /* 4byte code 4th char: 0x80-0xbf */
|
||||
filter->status = 0;
|
||||
filter->cache = 0;
|
||||
if (c >= 0x80 && c <= 0xbf) {
|
||||
s = (filter->cache<<6) | (c & 0x3f);
|
||||
filter->cache = 0;
|
||||
|
||||
if (filter->from->no_encoding == mbfl_no_encoding_utf8_docomo &&
|
||||
mbfilter_conv_r_map_tbl(s, &s1, mbfl_docomo2uni_pua, 4) > 0) {
|
||||
s = mbfilter_sjis_emoji_docomo2unicode(s1, &snd);
|
||||
} else if (filter->from->no_encoding == mbfl_no_encoding_utf8_kddi_a &&
|
||||
mbfilter_conv_r_map_tbl(s, &s1, mbfl_kddi2uni_pua, 7) > 0) {
|
||||
s = mbfilter_sjis_emoji_kddi2unicode(s1, &snd);
|
||||
} else if (filter->from->no_encoding == mbfl_no_encoding_utf8_kddi_b &&
|
||||
mbfilter_conv_r_map_tbl(s, &s1, mbfl_kddi2uni_pua_b, 8) > 0) {
|
||||
s = mbfilter_sjis_emoji_kddi2unicode(s1, &snd);
|
||||
} else if (filter->from->no_encoding == mbfl_no_encoding_utf8_sb &&
|
||||
mbfilter_conv_r_map_tbl(s, &s1, mbfl_sb2uni_pua, 6) > 0) {
|
||||
s = mbfilter_sjis_emoji_sb2unicode(s1, &snd);
|
||||
}
|
||||
|
||||
if (snd > 0) {
|
||||
CK((*filter->output_function)(snd, filter->data));
|
||||
}
|
||||
CK((*filter->output_function)(s, filter->data));
|
||||
} else {
|
||||
mbfl_filt_put_invalid_char(filter->cache, filter);
|
||||
goto retry;
|
||||
}
|
||||
break;
|
||||
case 0x20: /* 3byte code 2nd char: 0:0xa0-0xbf,D:0x80-9F,1-C,E-F:0x80-0x9f */
|
||||
s = (filter->cache<<6) | (c & 0x3f);
|
||||
c1 = filter->cache & 0xf;
|
||||
|
||||
if ((c >= 0x80 && c <= 0xbf) &&
|
||||
((c1 == 0x0 && c >= 0xa0) ||
|
||||
(c1 == 0xd && c < 0xa0) ||
|
||||
(c1 > 0x0 && c1 != 0xd))) {
|
||||
filter->cache = s;
|
||||
filter->status++;
|
||||
} else {
|
||||
mbfl_filt_put_invalid_char(filter->cache, filter);
|
||||
goto retry;
|
||||
}
|
||||
break;
|
||||
case 0x30: /* 4byte code 2nd char: 0:0x90-0xbf,1-3:0x80-0xbf,4:0x80-0x8f */
|
||||
s = (filter->cache<<6) | (c & 0x3f);
|
||||
c1 = filter->cache & 0x7;
|
||||
|
||||
if ((c >= 0x80 && c <= 0xbf) &&
|
||||
((c1 == 0x0 && c >= 0x90) ||
|
||||
(c1 == 0x4 && c < 0x90) ||
|
||||
(c1 > 0x0 && c1 != 0x4))) {
|
||||
filter->cache = s;
|
||||
filter->status++;
|
||||
} else {
|
||||
mbfl_filt_put_invalid_char(filter->cache, filter);
|
||||
goto retry;
|
||||
}
|
||||
break;
|
||||
case 0x31: /* 4byte code 3rd char: 0x80-0xbf */
|
||||
if (c >= 0x80 && c <= 0xbf) {
|
||||
filter->cache = (filter->cache<<6) | (c & 0x3f);
|
||||
filter->status++;
|
||||
} else {
|
||||
mbfl_filt_put_invalid_char(filter->cache, filter);
|
||||
goto retry;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
filter->status = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return c;
|
||||
|
@ -673,7 +673,7 @@ History
|
||||
2004/10/18: [impl] (thanks Imai Yasumasa)
|
||||
enclose #include <sys/types.h> by #ifndef __BORLANDC__.
|
||||
2004/10/18: [bug] (thanks Imai Yasumasa)
|
||||
memory acess violation in select_opt_exact_info().
|
||||
memory access violation in select_opt_exact_info().
|
||||
2004/09/25: [dist] fix doc/API and doc/API.ja.
|
||||
2004/09/25: [bug] fix OP_SEMI_END_BUF process in match_at() for
|
||||
the case USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE
|
||||
|
29
ext/mbstring/tests/bug65045.phpt
Normal file
29
ext/mbstring/tests/bug65045.phpt
Normal file
@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
Bug #65045: mb_convert_encoding breaks well-formed character
|
||||
--SKIPIF--
|
||||
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
//declare(encoding = 'UTF-8');
|
||||
mb_internal_encoding('UTF-8');
|
||||
|
||||
$str = "\xF0\xA4\xAD". "\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2";
|
||||
$expected = "\xEF\xBF\xBD"."\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2";
|
||||
|
||||
$str2 = "\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD";
|
||||
$expected2 = "\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2"."\xEF\xBF\xBD";
|
||||
|
||||
mb_substitute_character(0xFFFD);
|
||||
var_dump(
|
||||
$expected === htmlspecialchars_decode(htmlspecialchars($str, ENT_SUBSTITUTE, 'UTF-8')),
|
||||
$expected2 === htmlspecialchars_decode(htmlspecialchars($str2, ENT_SUBSTITUTE, 'UTF-8')),
|
||||
$expected === mb_convert_encoding($str, 'UTF-8', 'UTF-8'),
|
||||
$expected2 === mb_convert_encoding($str2, 'UTF-8', 'UTF-8')
|
||||
);
|
||||
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
@ -25,28 +25,28 @@ var_dump(chk_enc("\x31\x32\x33", 0));
|
||||
var_dump(chk_enc("\x41\x42\x43", 0));
|
||||
var_dump(chk_enc("\xc0\xb1\xc0\xb2\xc0\xb3", 6));
|
||||
var_dump(chk_enc("\xc1\x81\xc1\x82\xc1\x83", 6));
|
||||
var_dump(chk_enc("\xe0\x80\xb1\xe0\x80\xb2\xe0\x80\xb3", 6));
|
||||
var_dump(chk_enc("\xe0\x81\x81\xe0\x81\x82\xe0\x81\x83", 6));
|
||||
var_dump(chk_enc("\xf0\x80\x80\xb1\xf0\x80\x80\xb2\xf0\x80\x80\xb3", 9));
|
||||
var_dump(chk_enc("\xf0\x80\x81\x81\xf0\x80\x81\x82\xf0\x81\x83", 8));
|
||||
var_dump(chk_enc("\xe0\x80\xb1\xe0\x80\xb2\xe0\x80\xb3", 9));
|
||||
var_dump(chk_enc("\xe0\x81\x81\xe0\x81\x82\xe0\x81\x83", 9));
|
||||
var_dump(chk_enc("\xf0\x80\x80\xb1\xf0\x80\x80\xb2\xf0\x80\x80\xb3", 12));
|
||||
var_dump(chk_enc("\xf0\x80\x81\x81\xf0\x80\x81\x82\xf0\x81\x83", 11));
|
||||
var_dump(chk_enc("\xf8\x80\x80\x80\xb1\xf8\x80\x80\x80\xb2\xf8\x80\x80\x80\xb3", 15));
|
||||
var_dump(chk_enc("\xf8\x80\x80\x81\x81\xf8\x80\x80\x81\x82\xf8\x80\x80\x81\x83", 15));
|
||||
var_dump(chk_enc("\xfc\x80\x80\x80\x80\xb1\xfc\x80\x80\x80\x80\xb2\xfc\x80\x80\x80\x80\xb3", 18));
|
||||
var_dump(chk_enc("\xfc\x80\x80\x80\x81\x81\xfc\x80\x80\x80\x81\x82\xfc\x80\x80\x80\x81\x83", 18));
|
||||
|
||||
var_dump(chk_enc("\xc2\xa2\xc2\xa3\xc2\xa5", 0));
|
||||
var_dump(chk_enc("\xe0\x82\xa2\xe0\x82\xa3\xe0\x82\xa5", 6));
|
||||
var_dump(chk_enc("\xf0\x80\x82\xa2\xf0\x80\x82\xa3\xf0\x80\x82\xa5", 9));
|
||||
var_dump(chk_enc("\xe0\x82\xa2\xe0\x82\xa3\xe0\x82\xa5", 9));
|
||||
var_dump(chk_enc("\xf0\x80\x82\xa2\xf0\x80\x82\xa3\xf0\x80\x82\xa5", 12));
|
||||
var_dump(chk_enc("\xf8\x80\x80\x82\xa2\xf8\x80\x80\x82\xa3\xf8\x80\x80\x82\xa5", 15));
|
||||
var_dump(chk_enc("\xfc\x80\x80\x80\x82\xa2\xfc\x80\x80\x80\x82\xa3\xfc\x80\x80\x80\x82\xa5", 18));
|
||||
|
||||
var_dump(chk_enc("\xc1\xbf", 2));
|
||||
var_dump(chk_enc("\xc2\x80", 0));
|
||||
var_dump(chk_enc("\xdf\xbf", 0));
|
||||
var_dump(chk_enc("\xe0\x9f\xff", 2));
|
||||
var_dump(chk_enc("\xe0\x9f\xff", 3));
|
||||
var_dump(chk_enc("\xe0\xa0\x80", 2));
|
||||
var_dump(chk_enc("\xef\xbf\xbf", 0));
|
||||
var_dump(chk_enc("\xf0\x8f\xbf\xbf", 3));
|
||||
var_dump(chk_enc("\xf0\x8f\xbf\xbf", 4));
|
||||
var_dump(chk_enc("\xf0\x90\x80\x80", 0));
|
||||
var_dump(chk_enc("\xf7\xbf\xbf\xbf", 4));
|
||||
var_dump(chk_enc("\xf8\x87\xbf\xbf\xbf", 5));
|
||||
@ -61,7 +61,7 @@ echo "UTF-8 and surrogates area\n";
|
||||
$out = '';
|
||||
$cnt = 0;
|
||||
for ($i = 0xd7ff; $i <= 0xe000; ++$i) {
|
||||
$s = chk_enc(pack('C3', 0xe0 | ($i >> 12), 0x80 | ($i >> 6) & 0x3f, 0x80 | $i & 0x3f), 2);
|
||||
$s = chk_enc(pack('C3', 0xe0 | ($i >> 12), 0x80 | ($i >> 6) & 0x3f, 0x80 | $i & 0x3f), 3);
|
||||
if ($s === false) {
|
||||
$cnt++;
|
||||
} else {
|
||||
|
@ -4,7 +4,7 @@ mb_http_output()
|
||||
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
//TODO: Add more encoding. Wrong paramter type test.
|
||||
//TODO: Add more encoding. Wrong parameter type test.
|
||||
//$debug = true;
|
||||
ini_set('include_path', dirname(__FILE__));
|
||||
include_once('common.inc');
|
||||
|
@ -1918,7 +1918,7 @@ PHP_FUNCTION(mysql_result)
|
||||
|
||||
/*
|
||||
johannes TODO:
|
||||
Do 2 zend_parse_paramters calls instead of type "z" and switch below
|
||||
Do 2 zend_parse_parameters calls instead of type "z" and switch below
|
||||
Q: String or long first?
|
||||
*/
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z", &result, &row, &field) == FAILURE) {
|
||||
|
@ -166,7 +166,7 @@ mysqlnd.collect_memory_statistics=1
|
||||
mysqli_get_client_stats_assert_gt('bytes_sent', $info, $expected, $test_counter);
|
||||
mysqli_get_client_stats_assert_gt('bytes_received', $info, $expected, $test_counter);
|
||||
|
||||
// real_data_* get incremeneted after mysqli_*fetch*()
|
||||
// real_data_* get incremented after mysqli_*fetch*()
|
||||
mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, "0", $test_counter);
|
||||
mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter);
|
||||
|
||||
|
@ -1142,6 +1142,7 @@ MYSQLND ** mysqlnd_stream_array_check_for_readiness(MYSQLND ** conn_array TSRMLS
|
||||
static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, php_socket_t * max_fd TSRMLS_DC)
|
||||
{
|
||||
php_socket_t this_fd;
|
||||
php_stream *stream = NULL;
|
||||
int cnt = 0;
|
||||
MYSQLND **p = conn_array;
|
||||
|
||||
@ -1151,7 +1152,8 @@ static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, p
|
||||
* when casting. It is only used here so that the buffered data warning
|
||||
* is not displayed.
|
||||
* */
|
||||
if (SUCCESS == php_stream_cast((*p)->data->net->stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
|
||||
stream = (*p)->data->net->stream;
|
||||
if (stream != NULL && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
|
||||
(void*)&this_fd, 1) && this_fd >= 0) {
|
||||
|
||||
PHP_SAFE_FD_SET(this_fd, fds);
|
||||
@ -1169,6 +1171,7 @@ static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, p
|
||||
static int mysqlnd_stream_array_from_fd_set(MYSQLND ** conn_array, fd_set * fds TSRMLS_DC)
|
||||
{
|
||||
php_socket_t this_fd;
|
||||
php_stream *stream = NULL;
|
||||
int ret = 0;
|
||||
zend_bool disproportion = FALSE;
|
||||
|
||||
@ -1176,7 +1179,8 @@ static int mysqlnd_stream_array_from_fd_set(MYSQLND ** conn_array, fd_set * fds
|
||||
MYSQLND **fwd = conn_array, **bckwd = conn_array;
|
||||
|
||||
while (*fwd) {
|
||||
if (SUCCESS == php_stream_cast((*fwd)->data->net->stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
|
||||
stream = (*fwd)->data->net->stream;
|
||||
if (stream != NULL && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
|
||||
(void*)&this_fd, 1) && this_fd >= 0) {
|
||||
if (PHP_SAFE_FD_ISSET(this_fd, fds)) {
|
||||
if (disproportion) {
|
||||
|
@ -758,7 +758,7 @@ MYSQLND_METHOD(mysqlnd_net, consume_uneaten_data)(MYSQLND_NET * const net, enum
|
||||
/*
|
||||
Switch to non-blocking mode and try to consume something from
|
||||
the line, if possible, then continue. This saves us from looking for
|
||||
the actuall place where out-of-order packets have been sent.
|
||||
the actual place where out-of-order packets have been sent.
|
||||
If someone is completely sure that everything is fine, he can switch it
|
||||
off.
|
||||
*/
|
||||
|
@ -8,7 +8,7 @@ if (!getenv("TEST_PHP_EXECUTABLE") || !is_executable(getenv("TEST_PHP_EXECUTABLE
|
||||
--FILE--
|
||||
<?php
|
||||
echo "ok\n";
|
||||
pcntl_exec(getenv("TEST_PHP_EXECUTABLE"));
|
||||
pcntl_exec(getenv("TEST_PHP_EXECUTABLE"), ['-n']);
|
||||
echo "nok\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
|
@ -14,7 +14,7 @@ if (getenv("PCNTL_EXEC_TEST_IS_CHILD")) {
|
||||
exit;
|
||||
}
|
||||
echo "ok\n";
|
||||
pcntl_exec(getenv("TEST_PHP_EXECUTABLE"), array(__FILE__), array(
|
||||
pcntl_exec(getenv("TEST_PHP_EXECUTABLE"), array('-n', __FILE__), array(
|
||||
b"PCNTL_EXEC_TEST_IS_CHILD" => b"1",
|
||||
b"FOO" => b"BAR",
|
||||
1 => b"long")
|
||||
|
@ -48,6 +48,7 @@ if (($tmp[1] !== 'localhost') && ($tmp[1] !== '127.0.0.1'))
|
||||
}
|
||||
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
||||
putenv('PDOTEST_ATTR='.serialize([PDO::MYSQL_ATTR_LOCAL_INFILE=>true]));
|
||||
$db = MySQLPDOTest::factory();
|
||||
MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
|
||||
|
||||
|
@ -18,7 +18,7 @@ $db = MySQLPDOTest::factory();
|
||||
ob_end_clean();
|
||||
|
||||
/* PDO Driver for MySQL, client library version => 6.0.3-alpha */
|
||||
$reg = 'Client API version.*' . pcre_quote($db->getAttribute(PDO::ATTR_CLIENT_VERSION), '/');
|
||||
$reg = 'Client API version.*' . preg_quote($db->getAttribute(PDO::ATTR_CLIENT_VERSION), '/');
|
||||
|
||||
if (!preg_match("/$reg/", $tmp)) {
|
||||
printf("[001] Cannot find MySQL PDO driver line in phpinfo() output\n");
|
||||
|
@ -82,7 +82,7 @@ else
|
||||
# false -> "" as string, which pgsql doesn't like
|
||||
if (!$res->execute(array(false))) {
|
||||
$err = $res->errorInfo();
|
||||
// Strip additional lines ouputted by recent PgSQL versions
|
||||
// Strip additional lines outputted by recent PgSQL versions
|
||||
$err[2] = trim(current(explode("\n", $err[2])));
|
||||
print_r($err);
|
||||
} else {
|
||||
|
17
ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt
Normal file
17
ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt
Normal file
@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
PDO_sqlite: Testing sqliteCreateFunction() produces warning when
|
||||
un-callable function passed
|
||||
--CREDITS--
|
||||
Chris MacPherson chris@kombine.co.uk
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('pdo_sqlite')) print 'skip not loaded'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$db = new PDO( 'sqlite::memory:');
|
||||
|
||||
$db->sqliteCreateFunction('bar-alias', 'bar');
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: PDO::sqliteCreateFunction(): function 'bar' is not callable in %s on line %d
|
@ -914,6 +914,60 @@ static void _free_result(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
static int _php_pgsql_detect_identifier_escape(const char *identifier, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
/* Handle edge case. Cannot be a escaped string */
|
||||
if (len <= 2) {
|
||||
return FAILURE;
|
||||
}
|
||||
/* Detect double qoutes */
|
||||
if (identifier[0] == '"' && identifier[len-1] == '"') {
|
||||
/* Detect wrong format of " inside of escaped string */
|
||||
for (i = 1; i < len-1; i++) {
|
||||
if (identifier[i] == '"' && (identifier[++i] != '"' || i == len-1)) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return FAILURE;
|
||||
}
|
||||
/* Escaped properly */
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
#if !HAVE_PQESCAPELITERAL
|
||||
/* {{{ _php_pgsql_escape_identifier
|
||||
* Since PQescapeIdentifier() is unavailable (PostgreSQL 9.0 <), idenfifers
|
||||
* should be escaped by pgsql module.
|
||||
* Note: this function does not care for encoding. Therefore users should not
|
||||
* use this with SJIS/BIG5 etc. (i.e. Encoding base injection may possible with
|
||||
* before PostgreSQL 9.0)
|
||||
*/
|
||||
static char *_php_pgsql_escape_identifier(const char *field, size_t field_len)
|
||||
{
|
||||
ulong field_escaped_len = field_len*2 + 3;
|
||||
ulong i, j = 0;
|
||||
char *field_escaped;
|
||||
|
||||
field_escaped = (char *)malloc(field_escaped_len);
|
||||
field_escaped[j++] = '"';
|
||||
for (i = 0; i < field_len; i++) {
|
||||
if (field[i] == '"') {
|
||||
field_escaped[j++] = '"';
|
||||
field_escaped[j++] = '"';
|
||||
} else {
|
||||
field_escaped[j++] = field[i];
|
||||
}
|
||||
}
|
||||
field_escaped[j++] = '"';
|
||||
field_escaped[j] = '\0';
|
||||
return field_escaped;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* {{{ PHP_INI
|
||||
*/
|
||||
PHP_INI_BEGIN()
|
||||
@ -5015,8 +5069,9 @@ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, z
|
||||
{
|
||||
PGresult *pg_result;
|
||||
char *src, *tmp_name, *tmp_name2 = NULL;
|
||||
char *escaped;
|
||||
smart_str querystr = {0};
|
||||
int new_len;
|
||||
size_t new_len;
|
||||
int i, num_rows;
|
||||
zval *elem;
|
||||
|
||||
@ -5038,20 +5093,29 @@ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, z
|
||||
"SELECT a.attname, a.attnum, t.typname, a.attlen, a.attnotnull, a.atthasdef, a.attndims, t.typtype = 'e' "
|
||||
"FROM pg_class as c, pg_attribute a, pg_type t, pg_namespace n "
|
||||
"WHERE a.attnum > 0 AND a.attrelid = c.oid AND c.relname = '");
|
||||
tmp_name2 = php_addslashes(tmp_name2, strlen(tmp_name2), &new_len, 0 TSRMLS_CC);
|
||||
smart_str_appendl(&querystr, tmp_name2, new_len);
|
||||
|
||||
escaped = (char *)safe_emalloc(strlen(tmp_name2), 2, 1);
|
||||
#if HAVE_PQESCAPE_CONN
|
||||
new_len = PQescapeStringConn(pg_link, escaped, tmp_name2, strlen(tmp_name2), NULL);
|
||||
#else
|
||||
new_len = PQescapeString(escaped, tmp_name2, strlen(tmp_name2));
|
||||
#endif
|
||||
smart_str_appends(&querystr, escaped);
|
||||
efree(escaped);
|
||||
|
||||
smart_str_appends(&querystr, "' AND c.relnamespace = n.oid AND n.nspname = '");
|
||||
tmp_name = php_addslashes(tmp_name, strlen(tmp_name), &new_len, 0 TSRMLS_CC);
|
||||
smart_str_appendl(&querystr, tmp_name, new_len);
|
||||
escaped = (char *)safe_emalloc(strlen(tmp_name), 2, 1);
|
||||
#if HAVE_PQESCAPE_CONN
|
||||
new_len = PQescapeStringConn(pg_link, escaped, tmp_name, strlen(tmp_name), NULL);
|
||||
#else
|
||||
new_len = PQescapeString(escaped, tmp_name, strlen(tmp_name));
|
||||
#endif
|
||||
smart_str_appends(&querystr, escaped);
|
||||
efree(escaped);
|
||||
|
||||
smart_str_appends(&querystr, "' AND a.atttypid = t.oid ORDER BY a.attnum;");
|
||||
smart_str_0(&querystr);
|
||||
|
||||
efree(tmp_name2);
|
||||
efree(tmp_name);
|
||||
efree(src);
|
||||
|
||||
efree(src);
|
||||
|
||||
pg_result = PQexec(pg_link, querystr.c);
|
||||
if (PQresultStatus(pg_result) != PGRES_TUPLES_OK || (num_rows = PQntuples(pg_result)) == 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Table '%s' doesn't exists", table_name);
|
||||
@ -5274,6 +5338,7 @@ static int php_pgsql_add_quotes(zval *src, zend_bool should_free TSRMLS_DC)
|
||||
assert(Z_TYPE_P(src) == IS_STRING);
|
||||
assert(should_free == 1 || should_free == 0);
|
||||
|
||||
smart_str_appendc(&str, 'E');
|
||||
smart_str_appendc(&str, '\'');
|
||||
smart_str_appendl(&str, Z_STRVAL_P(src), Z_STRLEN_P(src));
|
||||
smart_str_appendc(&str, '\'');
|
||||
@ -5314,7 +5379,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
|
||||
uint field_len = -1;
|
||||
ulong num_idx = -1;
|
||||
zval *meta, **def, **type, **not_null, **has_default, **is_enum, **val, *new_val;
|
||||
int new_len, key_type, err = 0, skip_field;
|
||||
int key_type, err = 0, skip_field;
|
||||
php_pgsql_data_type data_type;
|
||||
|
||||
assert(pg_link != NULL);
|
||||
@ -5327,6 +5392,8 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
|
||||
}
|
||||
MAKE_STD_ZVAL(meta);
|
||||
array_init(meta);
|
||||
|
||||
/* table_name is escaped by php_pgsql_meta_data */
|
||||
if (php_pgsql_meta_data(pg_link, table_name, meta TSRMLS_CC) == FAILURE) {
|
||||
zval_dtor(meta);
|
||||
FREE_ZVAL(meta);
|
||||
@ -5539,15 +5606,15 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
|
||||
}
|
||||
else {
|
||||
Z_TYPE_P(new_val) = IS_STRING;
|
||||
#if HAVE_PQESCAPE
|
||||
#if HAVE_PQESCAPE_CONN
|
||||
{
|
||||
char *tmp;
|
||||
tmp = (char *)safe_emalloc(Z_STRLEN_PP(val), 2, 1);
|
||||
Z_STRLEN_P(new_val) = (int)PQescapeString(tmp, Z_STRVAL_PP(val), Z_STRLEN_PP(val));
|
||||
tmp = (char *)safe_emalloc(Z_STRLEN_PP(val), 2, 1);
|
||||
Z_STRLEN_P(new_val) = (int)PQescapeStringConn(pg_link, tmp, Z_STRVAL_PP(val), Z_STRLEN_PP(val), NULL);
|
||||
Z_STRVAL_P(new_val) = tmp;
|
||||
}
|
||||
#else
|
||||
Z_STRVAL_P(new_val) = php_addslashes(Z_STRVAL_PP(val), Z_STRLEN_PP(val), &Z_STRLEN_P(new_val), 0 TSRMLS_CC);
|
||||
Z_STRVAL_P(new_val) = (int)PQescapeString(Z_STRVAL_PP(val), Z_STRLEN_PP(val), &Z_STRLEN_P(new_val), 0 TSRMLS_CC);
|
||||
#endif
|
||||
php_pgsql_add_quotes(new_val, 1 TSRMLS_CC);
|
||||
}
|
||||
@ -5833,6 +5900,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
|
||||
else {
|
||||
unsigned char *tmp;
|
||||
size_t to_len;
|
||||
smart_str s = {0};
|
||||
#ifdef HAVE_PQESCAPE_BYTEA_CONN
|
||||
tmp = PQescapeByteaConn(pg_link, Z_STRVAL_PP(val), Z_STRLEN_PP(val), &to_len);
|
||||
#else
|
||||
@ -5844,7 +5912,11 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
|
||||
memcpy(Z_STRVAL_P(new_val), tmp, to_len);
|
||||
PQfreemem(tmp);
|
||||
php_pgsql_add_quotes(new_val, 1 TSRMLS_CC);
|
||||
|
||||
smart_str_appendl(&s, Z_STRVAL_P(new_val), Z_STRLEN_P(new_val));
|
||||
smart_str_0(&s);
|
||||
efree(Z_STRVAL_P(new_val));
|
||||
Z_STRVAL_P(new_val) = s.c;
|
||||
Z_STRLEN_P(new_val) = s.len;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -5929,11 +6001,22 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
|
||||
FREE_ZVAL(new_val);
|
||||
break; /* break out for() */
|
||||
}
|
||||
/* If field is NULL and HAS DEFAULT, should be skipped */
|
||||
if (!skip_field) {
|
||||
/* If field is NULL and HAS DEFAULT, should be skipped */
|
||||
field = php_addslashes(field, strlen(field), &new_len, 0 TSRMLS_CC);
|
||||
add_assoc_zval(result, field, new_val);
|
||||
efree(field);
|
||||
char *escaped;
|
||||
size_t new_len, field_len = strlen(field);
|
||||
|
||||
if (_php_pgsql_detect_identifier_escape(field, field_len) == SUCCESS) {
|
||||
escaped = strndup(field, field_len);
|
||||
} else {
|
||||
#if HAVE_PQESCAPELITERAL
|
||||
escaped = PQescapeIdentifier(pg_link, field, field_len);
|
||||
#else
|
||||
escaped = _php_pgsql_escape_identifier(field, field_len);
|
||||
#endif
|
||||
}
|
||||
add_assoc_zval(result, escaped, new_val);
|
||||
free(escaped);
|
||||
}
|
||||
} /* for */
|
||||
zval_dtor(meta);
|
||||
@ -6008,6 +6091,45 @@ static int do_exec(smart_str *querystr, int expect, PGconn *pg_link, ulong opt T
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const char *table)
|
||||
{
|
||||
char *table_copy, *escaped, *token, *tmp;
|
||||
size_t len;
|
||||
|
||||
/* schame.table should be "schame"."table" */
|
||||
table_copy = estrdup(table);
|
||||
token = php_strtok_r(table_copy, ".", &tmp);
|
||||
len = strlen(token);
|
||||
if (_php_pgsql_detect_identifier_escape(token, len) == SUCCESS) {
|
||||
escaped = strndup(token, len);
|
||||
} else {
|
||||
#if HAVE_PQESCAPELITERAL
|
||||
escaped = PQescapeIdentifier(pg_link, token, len);
|
||||
#else
|
||||
escaped = _php_pgsql_escape_identifier(token, len);
|
||||
#endif
|
||||
}
|
||||
smart_str_appends(querystr, escaped);
|
||||
free(escaped);
|
||||
if (tmp && *tmp) {
|
||||
len = strlen(tmp);
|
||||
/* "schema"."table" format */
|
||||
if (_php_pgsql_detect_identifier_escape(tmp, len) == SUCCESS) {
|
||||
escaped = strndup(tmp, len);
|
||||
} else {
|
||||
#if HAVE_PQESCAPELITERAL
|
||||
escaped = PQescapeIdentifier(pg_link, tmp, len);
|
||||
#else
|
||||
escaped = _php_pgsql_escape_identifier(tmp, len);
|
||||
#endif
|
||||
}
|
||||
smart_str_appendc(querystr, '.');
|
||||
smart_str_appends(querystr, escaped);
|
||||
free(escaped);
|
||||
}
|
||||
efree(table_copy);
|
||||
}
|
||||
|
||||
/* {{{ php_pgsql_insert
|
||||
*/
|
||||
PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, ulong opt, char **sql TSRMLS_DC)
|
||||
@ -6027,7 +6149,7 @@ PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var
|
||||
|
||||
if (zend_hash_num_elements(Z_ARRVAL_P(var_array)) == 0) {
|
||||
smart_str_appends(&querystr, "INSERT INTO ");
|
||||
smart_str_appends(&querystr, table);
|
||||
build_tablename(&querystr, pg_link, table);
|
||||
smart_str_appends(&querystr, " DEFAULT VALUES");
|
||||
|
||||
goto no_values;
|
||||
@ -6042,11 +6164,11 @@ PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var
|
||||
}
|
||||
var_array = converted;
|
||||
}
|
||||
|
||||
|
||||
smart_str_appends(&querystr, "INSERT INTO ");
|
||||
smart_str_appends(&querystr, table);
|
||||
build_tablename(&querystr, pg_link, table);
|
||||
smart_str_appends(&querystr, " (");
|
||||
|
||||
|
||||
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(var_array), &pos);
|
||||
while ((key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(var_array), &fld,
|
||||
&fld_len, &num_idx, 0, &pos)) != HASH_KEY_NON_EXISTANT) {
|
||||
@ -6233,7 +6355,7 @@ PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *var
|
||||
}
|
||||
|
||||
smart_str_appends(&querystr, "UPDATE ");
|
||||
smart_str_appends(&querystr, table);
|
||||
build_tablename(&querystr, pg_link, table);
|
||||
smart_str_appends(&querystr, " SET ");
|
||||
|
||||
if (build_assignment_string(&querystr, Z_ARRVAL_P(var_array), 0, ",", 1 TSRMLS_CC))
|
||||
@ -6334,7 +6456,7 @@ PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids
|
||||
}
|
||||
|
||||
smart_str_appends(&querystr, "DELETE FROM ");
|
||||
smart_str_appends(&querystr, table);
|
||||
build_tablename(&querystr, pg_link, table);
|
||||
smart_str_appends(&querystr, " WHERE ");
|
||||
|
||||
if (build_assignment_string(&querystr, Z_ARRVAL_P(ids_array), 1, " AND ", sizeof(" AND ")-1 TSRMLS_CC))
|
||||
@ -6470,7 +6592,7 @@ PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids
|
||||
}
|
||||
|
||||
smart_str_appends(&querystr, "SELECT * FROM ");
|
||||
smart_str_appends(&querystr, table);
|
||||
build_tablename(&querystr, pg_link, table);
|
||||
smart_str_appends(&querystr, " WHERE ");
|
||||
|
||||
if (build_assignment_string(&querystr, Z_ARRVAL_P(ids_array), 1, " AND ", sizeof(" AND ")-1 TSRMLS_CC))
|
||||
|
@ -20,10 +20,10 @@ var_dump($converted);
|
||||
?>
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
["num"]=>
|
||||
[""num""]=>
|
||||
string(4) "1234"
|
||||
["str"]=>
|
||||
string(5) "'AAA'"
|
||||
["bin"]=>
|
||||
string(5) "'BBB'"
|
||||
}
|
||||
[""str""]=>
|
||||
string(6) "E'AAA'"
|
||||
[""bin""]=>
|
||||
string(6) "E'BBB'"
|
||||
}
|
@ -21,10 +21,10 @@ var_dump($converted);
|
||||
?>
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
["num"]=>
|
||||
[""num""]=>
|
||||
string(4) "1234"
|
||||
["str"]=>
|
||||
string(5) "'AAA'"
|
||||
["bin"]=>
|
||||
string(11) "'\\x424242'"
|
||||
}
|
||||
[""str""]=>
|
||||
string(6) "E'AAA'"
|
||||
[""bin""]=>
|
||||
string(12) "E'\\x424242'"
|
||||
}
|
@ -20,5 +20,5 @@ echo pg_insert($db, $table_name, $fields, PGSQL_DML_STRING)."\n";
|
||||
echo "Ok\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
INSERT INTO php_pgsql_test (num,str,bin) VALUES (1234,'AAA','BBB');
|
||||
Ok
|
||||
INSERT INTO "php_pgsql_test" ("num","str","bin") VALUES (1234,E'AAA',E'BBB');
|
||||
Ok
|
@ -22,5 +22,5 @@ echo pg_insert($db, $table_name, $fields, PGSQL_DML_STRING)."\n";
|
||||
echo "Ok\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
INSERT INTO php_pgsql_test (num,str,bin) VALUES (1234,'AAA','\\x424242');
|
||||
Ok
|
||||
INSERT INTO "php_pgsql_test" ("num","str","bin") VALUES (1234,E'AAA',E'\\x424242');
|
||||
Ok
|
@ -33,5 +33,5 @@ array(1) {
|
||||
string(3) "BBB"
|
||||
}
|
||||
}
|
||||
SELECT * FROM php_pgsql_test WHERE num=1234;
|
||||
SELECT * FROM "php_pgsql_test" WHERE "num"=1234;
|
||||
Ok
|
||||
|
@ -35,5 +35,5 @@ array(1) {
|
||||
string(8) "\x424242"
|
||||
}
|
||||
}
|
||||
SELECT * FROM php_pgsql_test WHERE num=1234;
|
||||
Ok
|
||||
SELECT * FROM "php_pgsql_test" WHERE "num"=1234;
|
||||
Ok
|
@ -21,5 +21,5 @@ echo pg_update($db, $table_name, $fields, $ids, PGSQL_DML_STRING)."\n";
|
||||
echo "Ok\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
UPDATE php_pgsql_test SET num=1234,str='ABC',bin='XYZ' WHERE num=1234;
|
||||
Ok
|
||||
UPDATE "php_pgsql_test" SET "num"=1234,"str"=E'ABC',"bin"=E'XYZ' WHERE "num"=1234;
|
||||
Ok
|
@ -23,5 +23,5 @@ echo pg_update($db, $table_name, $fields, $ids, PGSQL_DML_STRING)."\n";
|
||||
echo "Ok\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
UPDATE php_pgsql_test SET num=1234,str='ABC',bin='\\x58595a' WHERE num=1234;
|
||||
Ok
|
||||
UPDATE "php_pgsql_test" SET "num"=1234,"str"=E'ABC',"bin"=E'\\x58595a' WHERE "num"=1234;
|
||||
Ok
|
@ -52,8 +52,8 @@ array(2) {
|
||||
string(1) "2"
|
||||
}
|
||||
}
|
||||
DELETE FROM test_47199 WHERE null_field IS NULL AND not_null_field=2;
|
||||
UPDATE test_47199 SET null_field=NULL,not_null_field=0 WHERE not_null_field=1 AND null_field IS NULL;
|
||||
DELETE FROM "test_47199" WHERE "null_field" IS NULL AND "not_null_field"=2;
|
||||
UPDATE "test_47199" SET "null_field"=NULL,"not_null_field"=0 WHERE "not_null_field"=1 AND "null_field" IS NULL;
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(2) {
|
||||
|
@ -25,6 +25,6 @@ var_dump($converted);
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
["a"]=>
|
||||
string(4) "'ok'"
|
||||
}
|
||||
[""a""]=>
|
||||
string(5) "E'ok'"
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
// These vars are used to connect db and create test table.
|
||||
// values can be set to meet your environment
|
||||
|
||||
$conn_str = "host=localhost dbname=test"; // connection string
|
||||
$conn_str = "host=localhost dbname=test port=5432"; // connection string
|
||||
$table_name = "php_pgsql_test"; // test table that should be exist
|
||||
$num_test_record = 1000; // Number of records to create
|
||||
|
||||
|
@ -45,8 +45,8 @@ pg_query('DROP SCHEMA phptests');
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(37) "DELETE FROM foo WHERE id=1 AND id2=2;"
|
||||
string(46) "DELETE FROM phptests.foo WHERE id=2 AND id2=3;"
|
||||
string(43) "DELETE FROM "foo" WHERE "id"=1 AND "id2"=2;"
|
||||
string(54) "DELETE FROM "phptests"."foo" WHERE "id"=2 AND "id2"=3;"
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(2) {
|
||||
|
@ -28,7 +28,7 @@ pg_query('DROP SCHEMA phptests');
|
||||
--EXPECTF--
|
||||
|
||||
Warning: pg_insert(): Table 'foo' doesn't exists in %s on line %d
|
||||
string(47) "INSERT INTO phptests.foo (id,id2) VALUES (1,2);"
|
||||
string(55) "INSERT INTO "phptests"."foo" ("id","id2") VALUES (1,2);"
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(2) {
|
||||
|
@ -35,8 +35,8 @@ pg_query('DROP SCHEMA phptests');
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(32) "UPDATE foo SET id=10 WHERE id=1;"
|
||||
string(43) "UPDATE phptests.foo SET id=100 WHERE id2=2;"
|
||||
string(38) "UPDATE "foo" SET "id"=10 WHERE "id"=1;"
|
||||
string(51) "UPDATE "phptests"."foo" SET "id"=100 WHERE "id2"=2;"
|
||||
array(2) {
|
||||
["id"]=>
|
||||
string(2) "10"
|
||||
|
@ -13,7 +13,7 @@ PHP Testfest Berlin 2009-05-10
|
||||
}
|
||||
// needed because of #ifdef HAVE_CTERMID in posix.c
|
||||
if (!function_exists('posix_ctermid')) {
|
||||
die('SKIP - Fuction posix_ctermid() not available');
|
||||
die('SKIP - Function posix_ctermid() not available');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
|
@ -5237,7 +5237,7 @@ ZEND_METHOD(reflection_extension, getVersion)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionFunction[] ReflectionExtension::getFunctions()
|
||||
Returns an array of this extension's fuctions */
|
||||
Returns an array of this extension's functions */
|
||||
ZEND_METHOD(reflection_extension, getFunctions)
|
||||
{
|
||||
reflection_object *intern;
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
rewriter uses arg_seperator.output for modifying URLs
|
||||
rewriter uses arg_separator.output for modifying URLs
|
||||
--SKIPIF--
|
||||
<?php include('skipif.inc'); ?>
|
||||
--INI--
|
||||
|
@ -1081,6 +1081,14 @@ static int schema_group(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr groupType, sdlTyp
|
||||
nsptr = xmlSearchNs(groupType->doc, groupType, BAD_CAST(ns));
|
||||
if (nsptr != NULL) {
|
||||
smart_str_appends(&key, (char*)nsptr->href);
|
||||
} else {
|
||||
xmlAttrPtr ns = get_attribute(groupType->properties, "targetNamespace");
|
||||
if (ns == NULL) {
|
||||
ns = tns;
|
||||
}
|
||||
if (ns) {
|
||||
smart_str_appends(&key, (char*)ns->children->content);
|
||||
}
|
||||
}
|
||||
smart_str_appendc(&key, ':');
|
||||
smart_str_appends(&key, type);
|
||||
@ -1509,6 +1517,14 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr element, sdlTyp
|
||||
if (nsptr != NULL) {
|
||||
smart_str_appends(&nscat, (char*)nsptr->href);
|
||||
newType->namens = estrdup((char*)nsptr->href);
|
||||
} else {
|
||||
xmlAttrPtr ns = get_attribute(attrs, "targetNamespace");
|
||||
if (ns == NULL) {
|
||||
ns = tns;
|
||||
}
|
||||
if (ns) {
|
||||
smart_str_appends(&nscat, (char*)ns->children->content);
|
||||
}
|
||||
}
|
||||
smart_str_appendc(&nscat, ':');
|
||||
smart_str_appends(&nscat, type);
|
||||
@ -1735,6 +1751,14 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrType, sdl
|
||||
if (nsptr != NULL) {
|
||||
smart_str_appends(&key, (char*)nsptr->href);
|
||||
newAttr->namens = estrdup((char*)nsptr->href);
|
||||
} else {
|
||||
xmlAttrPtr ns = get_attribute(attrType->properties, "targetNamespace");
|
||||
if (ns == NULL) {
|
||||
ns = tns;
|
||||
}
|
||||
if (ns) {
|
||||
smart_str_appends(&key, (char*)ns->children->content);
|
||||
}
|
||||
}
|
||||
smart_str_appendc(&key, ':');
|
||||
smart_str_appends(&key, attr_name);
|
||||
@ -2036,13 +2060,31 @@ static void copy_extra_attribute(void *attribute)
|
||||
}
|
||||
}
|
||||
|
||||
static void* schema_find_by_ref(HashTable *ht, char *ref)
|
||||
{
|
||||
void **tmp;
|
||||
|
||||
if (zend_hash_find(ht, ref, strlen(ref)+1, (void**)&tmp) == SUCCESS) {
|
||||
return tmp;
|
||||
} else {
|
||||
ref = strrchr(ref, ':');
|
||||
if (ref) {
|
||||
if (zend_hash_find(ht, ref, strlen(ref)+1, (void**)&tmp) == SUCCESS) {
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void schema_attribute_fixup(sdlCtx *ctx, sdlAttributePtr attr)
|
||||
{
|
||||
sdlAttributePtr *tmp;
|
||||
|
||||
if (attr->ref != NULL) {
|
||||
if (ctx->attributes != NULL) {
|
||||
if (zend_hash_find(ctx->attributes, attr->ref, strlen(attr->ref)+1, (void**)&tmp) == SUCCESS) {
|
||||
tmp = (sdlAttributePtr*)schema_find_by_ref(ctx->attributes, attr->ref);
|
||||
if (tmp) {
|
||||
schema_attribute_fixup(ctx, *tmp);
|
||||
if ((*tmp)->name != NULL && attr->name == NULL) {
|
||||
attr->name = estrdup((*tmp)->name);
|
||||
@ -2092,7 +2134,8 @@ static void schema_attributegroup_fixup(sdlCtx *ctx, sdlAttributePtr attr, HashT
|
||||
|
||||
if (attr->ref != NULL) {
|
||||
if (ctx->attributeGroups != NULL) {
|
||||
if (zend_hash_find(ctx->attributeGroups, attr->ref, strlen(attr->ref)+1, (void**)&tmp) == SUCCESS) {
|
||||
tmp = (sdlTypePtr*)schema_find_by_ref(ctx->attributeGroups, attr->ref);
|
||||
if (tmp) {
|
||||
if ((*tmp)->attributes) {
|
||||
zend_hash_internal_pointer_reset((*tmp)->attributes);
|
||||
while (zend_hash_get_current_data((*tmp)->attributes,(void**)&tmp_attr) == SUCCESS) {
|
||||
@ -2149,7 +2192,7 @@ static void schema_content_model_fixup(sdlCtx *ctx, sdlContentModelPtr model)
|
||||
model->kind = XSD_CONTENT_GROUP;
|
||||
model->u.group = (*tmp);
|
||||
} else {
|
||||
soap_error0(E_ERROR, "Parsing Schema: unresolved group 'ref' attribute");
|
||||
soap_error1(E_ERROR, "Parsing Schema: unresolved group 'ref' attribute '%s'", model->u.group_ref);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -2193,7 +2236,8 @@ static void schema_type_fixup(sdlCtx *ctx, sdlTypePtr type)
|
||||
|
||||
if (type->ref != NULL) {
|
||||
if (ctx->sdl->elements != NULL) {
|
||||
if (zend_hash_find(ctx->sdl->elements, type->ref, strlen(type->ref)+1, (void**)&tmp) == SUCCESS) {
|
||||
tmp = (sdlTypePtr*)schema_find_by_ref(ctx->sdl->elements, type->ref);
|
||||
if (tmp) {
|
||||
type->kind = (*tmp)->kind;
|
||||
type->encode = (*tmp)->encode;
|
||||
if ((*tmp)->nillable) {
|
||||
@ -2209,7 +2253,7 @@ static void schema_type_fixup(sdlCtx *ctx, sdlTypePtr type)
|
||||
} else if (strcmp(type->ref, SCHEMA_NAMESPACE ":schema") == 0) {
|
||||
type->encode = get_conversion(XSD_ANYXML);
|
||||
} else {
|
||||
soap_error0(E_ERROR, "Parsing Schema: unresolved element 'ref' attribute");
|
||||
soap_error1(E_ERROR, "Parsing Schema: unresolved element 'ref' attribute '%s'", type->ref);
|
||||
}
|
||||
}
|
||||
efree(type->ref);
|
||||
|
@ -3658,7 +3658,44 @@ ignore_header:
|
||||
return function;
|
||||
}
|
||||
|
||||
static int serialize_response_call2(xmlNodePtr body, sdlFunctionPtr function, char *function_name, char *uri, zval *ret, int version, int main TSRMLS_DC)
|
||||
static void set_soap_header_attributes(xmlNodePtr h, HashTable *ht, int version)
|
||||
{
|
||||
zval **tmp;
|
||||
|
||||
if (zend_hash_find(ht, "mustUnderstand", sizeof("mustUnderstand"), (void**)&tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_BOOL && Z_LVAL_PP(tmp)) {
|
||||
if (version == SOAP_1_1) {
|
||||
xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":mustUnderstand"), BAD_CAST("1"));
|
||||
} else {
|
||||
xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":mustUnderstand"), BAD_CAST("true"));
|
||||
}
|
||||
}
|
||||
if (zend_hash_find(ht, "actor", sizeof("actor"), (void**)&tmp) == SUCCESS) {
|
||||
if (Z_TYPE_PP(tmp) == IS_STRING) {
|
||||
if (version == SOAP_1_1) {
|
||||
xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":actor"), BAD_CAST(Z_STRVAL_PP(tmp)));
|
||||
} else {
|
||||
xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(Z_STRVAL_PP(tmp)));
|
||||
}
|
||||
} else if (Z_TYPE_PP(tmp) == IS_LONG) {
|
||||
if (version == SOAP_1_1) {
|
||||
if (Z_LVAL_PP(tmp) == SOAP_ACTOR_NEXT) {
|
||||
xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":actor"), BAD_CAST(SOAP_1_1_ACTOR_NEXT));
|
||||
}
|
||||
} else {
|
||||
if (Z_LVAL_PP(tmp) == SOAP_ACTOR_NEXT) {
|
||||
xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_NEXT));
|
||||
} else if (Z_LVAL_PP(tmp) == SOAP_ACTOR_NONE) {
|
||||
xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_NONE));
|
||||
} else if (Z_LVAL_PP(tmp) == SOAP_ACTOR_UNLIMATERECEIVER) {
|
||||
xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_UNLIMATERECEIVER));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int serialize_response_call2(xmlNodePtr body, sdlFunctionPtr function, char *function_name, char *uri, zval *ret, int version, int main, xmlNodePtr *node TSRMLS_DC)
|
||||
{
|
||||
xmlNodePtr method = NULL, param;
|
||||
sdlParamPtr parameter = NULL;
|
||||
@ -3758,6 +3795,9 @@ static int serialize_response_call2(xmlNodePtr body, sdlFunctionPtr function, ch
|
||||
if (use == SOAP_ENCODED && version == SOAP_1_2 && method != NULL) {
|
||||
xmlSetNsProp(method, body->ns, BAD_CAST("encodingStyle"), BAD_CAST(SOAP_1_2_ENC_NAMESPACE));
|
||||
}
|
||||
if (node) {
|
||||
*node = method;
|
||||
}
|
||||
return use;
|
||||
}
|
||||
|
||||
@ -3839,7 +3879,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
|
||||
}
|
||||
|
||||
if (headers->function) {
|
||||
if (serialize_response_call2(head, headers->function, Z_STRVAL(headers->function_name), uri, hdr_ret, version, 0 TSRMLS_CC) == SOAP_ENCODED) {
|
||||
if (serialize_response_call2(head, headers->function, Z_STRVAL(headers->function_name), uri, hdr_ret, version, 0, NULL TSRMLS_CC) == SOAP_ENCODED) {
|
||||
use = SOAP_ENCODED;
|
||||
}
|
||||
} else {
|
||||
@ -4025,15 +4065,15 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
|
||||
zval *hdr_ret = &h->retval;
|
||||
char *hdr_ns = h->hdr?h->hdr->ns:NULL;
|
||||
char *hdr_name = Z_STRVAL(h->function_name);
|
||||
|
||||
HashTable *ht = NULL;
|
||||
|
||||
if (Z_TYPE(h->retval) == IS_OBJECT &&
|
||||
instanceof_function(Z_OBJCE(h->retval), soap_header_class_entry TSRMLS_CC)) {
|
||||
HashTable* ht = Z_OBJPROP(h->retval);
|
||||
zval **tmp;
|
||||
sdlSoapBindingFunctionHeaderPtr *hdr;
|
||||
smart_str key = {0};
|
||||
|
||||
ht = Z_OBJPROP(h->retval);
|
||||
if (zend_hash_find(ht, "namespace", sizeof("namespace"), (void**)&tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_STRING) {
|
||||
smart_str_appendl(&key, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
|
||||
@ -4064,9 +4104,14 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
|
||||
}
|
||||
|
||||
if (h->function) {
|
||||
if (serialize_response_call2(head, h->function, Z_STRVAL(h->function_name), uri, hdr_ret, version, 0 TSRMLS_CC) == SOAP_ENCODED) {
|
||||
xmlNodePtr xmlHdr = NULL;
|
||||
|
||||
if (serialize_response_call2(head, h->function, Z_STRVAL(h->function_name), uri, hdr_ret, version, 0, &xmlHdr TSRMLS_CC) == SOAP_ENCODED) {
|
||||
use = SOAP_ENCODED;
|
||||
}
|
||||
if (ht) {
|
||||
set_soap_header_attributes(xmlHdr, ht, version);
|
||||
}
|
||||
} else {
|
||||
xmlNodePtr xmlHdr = master_to_xml(hdr_enc, hdr_ret, hdr_use, head TSRMLS_CC);
|
||||
if (hdr_name) {
|
||||
@ -4076,6 +4121,9 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
|
||||
xmlNsPtr nsptr = encode_add_ns(xmlHdr,hdr_ns);
|
||||
xmlSetNs(xmlHdr, nsptr);
|
||||
}
|
||||
if (ht) {
|
||||
set_soap_header_attributes(xmlHdr, ht, version);
|
||||
}
|
||||
}
|
||||
}
|
||||
h = h->next;
|
||||
@ -4089,7 +4137,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
|
||||
|
||||
body = xmlNewChild(envelope, ns, BAD_CAST("Body"), NULL);
|
||||
|
||||
if (serialize_response_call2(body, function, function_name, uri, ret, version, 1 TSRMLS_CC) == SOAP_ENCODED) {
|
||||
if (serialize_response_call2(body, function, function_name, uri, ret, version, 1, NULL TSRMLS_CC) == SOAP_ENCODED) {
|
||||
use = SOAP_ENCODED;
|
||||
}
|
||||
|
||||
@ -4281,38 +4329,7 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function
|
||||
}
|
||||
nsptr = encode_add_ns(h, Z_STRVAL_PP(ns));
|
||||
xmlSetNs(h, nsptr);
|
||||
|
||||
if (zend_hash_find(ht, "mustUnderstand", sizeof("mustUnderstand"), (void**)&tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_BOOL && Z_LVAL_PP(tmp)) {
|
||||
if (version == SOAP_1_1) {
|
||||
xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":mustUnderstand"), BAD_CAST("1"));
|
||||
} else {
|
||||
xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":mustUnderstand"), BAD_CAST("true"));
|
||||
}
|
||||
}
|
||||
if (zend_hash_find(ht, "actor", sizeof("actor"), (void**)&tmp) == SUCCESS) {
|
||||
if (Z_TYPE_PP(tmp) == IS_STRING) {
|
||||
if (version == SOAP_1_1) {
|
||||
xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":actor"), BAD_CAST(Z_STRVAL_PP(tmp)));
|
||||
} else {
|
||||
xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(Z_STRVAL_PP(tmp)));
|
||||
}
|
||||
} else if (Z_TYPE_PP(tmp) == IS_LONG) {
|
||||
if (version == SOAP_1_1) {
|
||||
if (Z_LVAL_PP(tmp) == SOAP_ACTOR_NEXT) {
|
||||
xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":actor"), BAD_CAST(SOAP_1_1_ACTOR_NEXT));
|
||||
}
|
||||
} else {
|
||||
if (Z_LVAL_PP(tmp) == SOAP_ACTOR_NEXT) {
|
||||
xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_NEXT));
|
||||
} else if (Z_LVAL_PP(tmp) == SOAP_ACTOR_NONE) {
|
||||
xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_NONE));
|
||||
} else if (Z_LVAL_PP(tmp) == SOAP_ACTOR_UNLIMATERECEIVER) {
|
||||
xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_UNLIMATERECEIVER));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
set_soap_header_attributes(h, ht, version);
|
||||
}
|
||||
zend_hash_move_forward(soap_headers);
|
||||
}
|
||||
|
28
ext/soap/tests/bugs/bug65018.phpt
Normal file
28
ext/soap/tests/bugs/bug65018.phpt
Normal file
@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
Bug #65018 (SoapHeader problems with SoapServer)
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
class Tool{
|
||||
public function TOKEN($id){
|
||||
return new SoapHeader('namespace1', 'TOKEN', $id, true);
|
||||
}
|
||||
public function Method(){}
|
||||
}
|
||||
|
||||
$input = $input =
|
||||
'<?xml version="1.0"?>'.PHP_EOL.
|
||||
'<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="namespace1"'.
|
||||
' xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'.
|
||||
' xmlns:xsd="http://www.w3.org/2001/XMLSchema">'.
|
||||
'<SOAP-ENV:Header><ns1:TOKEN soapenv:mustUnderstand="1">abc</ns1:TOKEN></SOAP-ENV:Header>'.
|
||||
'<SOAP-ENV:Body><ns1:Method /></SOAP-ENV:Body></SOAP-ENV:Envelope>';
|
||||
|
||||
$soap = new SoapServer(null, array('uri' => '127.0.0.1'));
|
||||
$soap->setClass('Tool');
|
||||
$soap->handle($input);
|
||||
?>
|
||||
--EXPECT--
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="namespace1" xmlns:ns2="127.0.0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header><ns1:TOKEN SOAP-ENV:mustUnderstand="1">abc</ns1:TOKEN></SOAP-ENV:Header><SOAP-ENV:Body><ns2:MethodResponse><return xsi:nil="true"/></ns2:MethodResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
@ -16,7 +16,7 @@
|
||||
* @since PHP 5.1.2
|
||||
*
|
||||
* This container allows to store objects uniquly without the need to compare
|
||||
* them one by one. This is only possible internally. The code represenation
|
||||
* them one by one. This is only possible internally. The code representation
|
||||
* here therefore has a complexity of O(n) while the actual implementation has
|
||||
* complexity O(1).
|
||||
*/
|
||||
|
@ -260,7 +260,7 @@ class Exception
|
||||
/** The exception message */
|
||||
protected $message;
|
||||
|
||||
/** The string represenations as generated during construction */
|
||||
/** The string representations as generated during construction */
|
||||
private $string;
|
||||
|
||||
/** The code passed to the constructor */
|
||||
@ -336,7 +336,7 @@ class Exception
|
||||
{
|
||||
}
|
||||
|
||||
/** @return string represenation of exception
|
||||
/** @return string representation of exception
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
|
@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
Bug #63680 (Memleak in splfixedarray with cycle reference)
|
||||
--INI--
|
||||
zend.enable_gc=1
|
||||
--FILE--
|
||||
<?php
|
||||
function dummy() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
SPL: priorityQueue paramter test on insert method
|
||||
SPL: priorityQueue parameter test on insert method
|
||||
--CREDITS--
|
||||
Sean Burlington www.practicalweb.co.uk
|
||||
TestFest London May 2009
|
||||
|
@ -12731,7 +12731,7 @@ struct VdbeFunc {
|
||||
*/
|
||||
struct sqlite3_context {
|
||||
FuncDef *pFunc; /* Pointer to function information. MUST BE FIRST */
|
||||
VdbeFunc *pVdbeFunc; /* Auxilary data, if created. */
|
||||
VdbeFunc *pVdbeFunc; /* Auxiliary data, if created. */
|
||||
Mem s; /* The return value is stored here */
|
||||
Mem *pMem; /* Memory cell used to store aggregate context */
|
||||
int isError; /* Error code returned by the function. */
|
||||
@ -44929,7 +44929,7 @@ SQLITE_PRIVATE int sqlite3WalOpen(
|
||||
}
|
||||
|
||||
/*
|
||||
** Change the size to which the WAL file is trucated on each reset.
|
||||
** Change the size to which the WAL file is truncated on each reset.
|
||||
*/
|
||||
SQLITE_PRIVATE void sqlite3WalLimit(Wal *pWal, i64 iLimit){
|
||||
if( pWal ) pWal->mxWalSize = iLimit;
|
||||
@ -59355,7 +59355,7 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){
|
||||
|
||||
/* The complex case - There is a multi-file write-transaction active.
|
||||
** This requires a master journal file to ensure the transaction is
|
||||
** committed atomicly.
|
||||
** committed atomically.
|
||||
*/
|
||||
#ifndef SQLITE_OMIT_DISKIO
|
||||
else{
|
||||
@ -61383,7 +61383,7 @@ SQLITE_API void *sqlite3_aggregate_context(sqlite3_context *p, int nByte){
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the auxilary data pointer, if any, for the iArg'th argument to
|
||||
** Return the auxiliary data pointer, if any, for the iArg'th argument to
|
||||
** the user-function defined by pCtx.
|
||||
*/
|
||||
SQLITE_API void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){
|
||||
@ -61398,7 +61398,7 @@ SQLITE_API void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){
|
||||
}
|
||||
|
||||
/*
|
||||
** Set the auxilary data pointer and delete function, for the iArg'th
|
||||
** Set the auxiliary data pointer and delete function, for the iArg'th
|
||||
** argument to the user-function defined by pCtx. Any previous value is
|
||||
** deleted by calling the delete function specified when it was set.
|
||||
*/
|
||||
@ -63408,7 +63408,7 @@ SQLITE_PRIVATE int sqlite3VdbeExec(
|
||||
}
|
||||
#endif
|
||||
|
||||
/* On any opcode with the "out2-prerelase" tag, free any
|
||||
/* On any opcode with the "out2-prerelease" tag, free any
|
||||
** external allocations out of mem[p2] and set mem[p2] to be
|
||||
** an undefined integer. Opcodes will either fill in the integer
|
||||
** value or convert mem[p2] to a different type.
|
||||
|
@ -503,7 +503,7 @@ static long php_unpack(char *data, int size, int issigned, int *map)
|
||||
|
||||
/* unpack() is based on Perl's unpack(), but is modified a bit from there.
|
||||
* Rather than depending on error-prone ordered lists or syntactically
|
||||
* unpleasant pass-by-reference, we return an object with named paramters
|
||||
* unpleasant pass-by-reference, we return an object with named parameters
|
||||
* (like *_fetch_object()). Syntax is "f[repeat]name/...", where "f" is the
|
||||
* formatter char (like pack()), "[repeat]" is the optional repeater argument,
|
||||
* and "name" is the name of the variable to use.
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Test array_count_values() function : Test all normal paramter variations
|
||||
Test array_count_values() function : Test all normal parameter variations
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : proto array array_count_values(array input)
|
||||
@ -9,7 +9,7 @@ Test array_count_values() function : Test all normal paramter variations
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test behaviour with paramter variations
|
||||
* Test behaviour with parameter variations
|
||||
*/
|
||||
|
||||
echo "*** Testing array_count_values() : parameter variations ***\n";
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
chmod() basic fuctionality
|
||||
chmod() basic functionality
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) != 'WIN') {
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
chmod() basic fuctionality
|
||||
chmod() basic functionality
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
|
Binary file not shown.
@ -120,7 +120,7 @@ var_dump($count);
|
||||
echo "\n-- Testing objects --\n";
|
||||
/* we get "Catchable fatal error: saying Object of class could not be converted
|
||||
to string" by default, when an object is passed instead of string:
|
||||
The error can be avoided by chosing the __toString magix method as follows: */
|
||||
The error can be avoided by choosing the __toString magix method as follows: */
|
||||
|
||||
class subject
|
||||
{
|
||||
|
@ -33,7 +33,7 @@ var_dump($count);
|
||||
echo "\n-- Testing objects --\n";
|
||||
/* we get "Catchable fatal error: saying Object of class could not be converted
|
||||
to string" by default, when an object is passed instead of string:
|
||||
The error can be avoided by chosing the __toString magix method as follows: */
|
||||
The error can be avoided by choosing the __toString magix method as follows: */
|
||||
|
||||
class subject
|
||||
{
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1443,7 +1443,7 @@ static PHP_FUNCTION(tidy_get_config)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int tidy_get_status()
|
||||
Get status of specfied document. */
|
||||
Get status of specified document. */
|
||||
static PHP_FUNCTION(tidy_get_status)
|
||||
{
|
||||
TIDY_FETCH_OBJECT;
|
||||
|
@ -279,7 +279,7 @@ XMLRPC_VALUE xml_element_to_SOAP_REQUEST_worker(XMLRPC_REQUEST request,
|
||||
else if (!strcmp(attr_iter->key, TOKEN_MUSTUNDERSTAND)) {
|
||||
b_must_understand = strchr(attr_iter->val, '1') ? 1 : 0;
|
||||
}
|
||||
/* actor, used in conjuction with must understand. */
|
||||
/* actor, used in conjunction with must understand. */
|
||||
else if (!strcmp(attr_iter->key, TOKEN_ACTOR)) {
|
||||
actor = attr_iter->val;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ if test "$PHP_APXS" != "no"; then
|
||||
# Test that we're trying to configure with apache 1.x
|
||||
PHP_AP_EXTRACT_VERSION($APXS_HTTPD)
|
||||
if test "$APACHE_VERSION" -ge 2000000; then
|
||||
AC_MSG_ERROR([You have enabled Apache 1.3 support while your server is Apache 2. Please use the appropiate switch --with-apxs2])
|
||||
AC_MSG_ERROR([You have enabled Apache 1.3 support while your server is Apache 2. Please use the appropriate switch --with-apxs2])
|
||||
fi
|
||||
|
||||
for flag in $APXS_CFLAGS; do
|
||||
|
@ -62,7 +62,7 @@ if test "$PHP_APXS2FILTER" != "no"; then
|
||||
# Test that we're trying to configure with apache 2.x
|
||||
PHP_AP_EXTRACT_VERSION($APXS_HTTPD)
|
||||
if test "$APACHE_VERSION" -le 2000000; then
|
||||
AC_MSG_ERROR([You have enabled Apache 2 support while your server is Apache 1.3. Please use the appropiate switch --with-apxs (without the 2)])
|
||||
AC_MSG_ERROR([You have enabled Apache 2 support while your server is Apache 1.3. Please use the appropriate switch --with-apxs (without the 2)])
|
||||
elif test "$APACHE_VERSION" -lt 2000040; then
|
||||
AC_MSG_ERROR([Please note that Apache version >= 2.0.40 is required])
|
||||
fi
|
||||
|
@ -61,7 +61,7 @@ if test "$PHP_APXS2" != "no"; then
|
||||
# Test that we're trying to configure with apache 2.x
|
||||
PHP_AP_EXTRACT_VERSION($APXS_HTTPD)
|
||||
if test "$APACHE_VERSION" -le 2000000; then
|
||||
AC_MSG_ERROR([You have enabled Apache 2 support while your server is Apache 1.3. Please use the appropiate switch --with-apxs (without the 2)])
|
||||
AC_MSG_ERROR([You have enabled Apache 2 support while your server is Apache 1.3. Please use the appropriate switch --with-apxs (without the 2)])
|
||||
elif test "$APACHE_VERSION" -lt 2000044; then
|
||||
AC_MSG_ERROR([Please note that Apache version >= 2.0.44 is required])
|
||||
fi
|
||||
|
@ -60,7 +60,7 @@ if test "$PHP_APACHE_HOOKS" != "no"; then
|
||||
# Test that we're trying to configure with apache 1.x
|
||||
PHP_AP_EXTRACT_VERSION($APXS_HTTPD)
|
||||
if test "$APACHE_VERSION" -ge 2000000; then
|
||||
AC_MSG_ERROR([You have enabled Apache 1.3 support while your server is Apache 2. Please use the appropiate switch --with-apxs2])
|
||||
AC_MSG_ERROR([You have enabled Apache 1.3 support while your server is Apache 2. Please use the appropriate switch --with-apxs2])
|
||||
fi
|
||||
|
||||
for flag in $APXS_CFLAGS; do
|
||||
|
@ -401,7 +401,7 @@ pm.max_spare_servers = 3
|
||||
; - %{megabytes}M
|
||||
; - %{mega}M
|
||||
; %n: pool name
|
||||
; %o: ouput header
|
||||
; %o: output header
|
||||
; it must be associated with embraces to specify the name of the header:
|
||||
; - %{Content-Type}o
|
||||
; - %{X-Powered-By}o
|
||||
|
@ -44,7 +44,7 @@ install-programs: $(builddir)/phpize $(builddir)/php-config
|
||||
echo " page: $(program_prefix)$${page}$(program_suffix).1"; \
|
||||
$(INSTALL_DATA) $(builddir)/man1/$${page}.1 $(INSTALL_ROOT)$(mandir)/man1/$(program_prefix)$${page}$(program_suffix).1; \
|
||||
done
|
||||
|
||||
|
||||
$(builddir)/phpize: $(srcdir)/phpize.in $(top_builddir)/config.status
|
||||
(CONFIG_FILES=$@ CONFIG_HEADERS= $(top_builddir)/config.status)
|
||||
|
||||
|
Binary file not shown.
@ -104,7 +104,7 @@ abstract class gtTestCase {
|
||||
|
||||
|
||||
/**
|
||||
* Add contructor argument initialisation to test case
|
||||
* Add constructor argument initialisation to test case
|
||||
*
|
||||
*/
|
||||
public function constructorArgInit() {
|
||||
|
@ -6,7 +6,7 @@ class C { public static $p = 'original'; }
|
||||
class D extends C { }
|
||||
class E extends D { }
|
||||
|
||||
echo "\nInherited static properties refer to the same value accross classes:\n";
|
||||
echo "\nInherited static properties refer to the same value across classes:\n";
|
||||
var_dump(C::$p, D::$p, E::$p);
|
||||
|
||||
echo "\nChanging one changes all the others:\n";
|
||||
@ -20,7 +20,7 @@ var_dump(C::$p, D::$p, E::$p);
|
||||
?>
|
||||
==Done==
|
||||
--EXPECTF--
|
||||
Inherited static properties refer to the same value accross classes:
|
||||
Inherited static properties refer to the same value across classes:
|
||||
%unicode|string%(8) "original"
|
||||
%unicode|string%(8) "original"
|
||||
%unicode|string%(8) "original"
|
||||
|
Loading…
Reference in New Issue
Block a user