dmitry Wed Aug 10 08:02:17 2005 EDT
Modified files:
/php-src NEWS
/ZendEngine2 zend_compile.c zend_compile.h
/php-src/ext/standard basic_functions.c
Log:
Fixed bug #25359 (array_multisort() doesn't work in a function if array is
global or reference)
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.2035&r2=1.2036&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2035 php-src/NEWS:1.2036
--- php-src/NEWS:1.2035 Wed Aug 10 06:39:25 2005
+++ php-src/NEWS Wed Aug 10 08:02:11 2005
@@ -54,6 +54,8 @@
- Fixed bug #32010 (Memory leak in mssql_fetch_batch). (fmk)
- Fixed bug #29334 (win32 mail() provides incorrect Date: header). (Jani)
- Fixed bug #29253 (array_diff with $GLOBALS argument fails). (Dmitry)
+- Fixed bug #25359 (array_multisort() doesn't work in a function if array is
+ global or reference). (Dmitry)
14 Jul 2005, PHP 5.1 Beta 3
- Upgraded bundled SQLite library for PDO:SQLite to 3.2.2 (Ilia)
http://cvs.php.net/diff.php/ZendEngine2/zend_compile.c?r1=1.647&r2=1.648&ty=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.647 ZendEngine2/zend_compile.c:1.648
--- ZendEngine2/zend_compile.c:1.647 Thu Aug 4 10:04:36 2005
+++ ZendEngine2/zend_compile.c Wed Aug 10 08:02:13 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.c,v 1.647 2005/08/04 14:04:36 dmitry Exp $ */
+/* $Id: zend_compile.c,v 1.648 2005/08/10 12:02:13 dmitry Exp $ */
#include <zend_language_parser.h>
#include "zend.h"
@@ -1499,7 +1499,12 @@
}
if (function_ptr) {
- send_by_reference = ARG_SHOULD_BE_SENT_BY_REF(function_ptr,
(zend_uint) offset) ? ZEND_ARG_SEND_BY_REF : 0;
+ if (ARG_MAY_BE_SENT_BY_REF(function_ptr, (zend_uint) offset)) {
+ op = (param->op_type &
(IS_VAR|IS_CV))?ZEND_SEND_REF:ZEND_SEND_VAL;
+ send_by_reference = 0;
+ } else {
+ send_by_reference =
ARG_SHOULD_BE_SENT_BY_REF(function_ptr, (zend_uint) offset) ?
ZEND_ARG_SEND_BY_REF : 0;
+ }
} else {
send_by_reference = 0;
}
http://cvs.php.net/diff.php/ZendEngine2/zend_compile.h?r1=1.316&r2=1.317&ty=u
Index: ZendEngine2/zend_compile.h
diff -u ZendEngine2/zend_compile.h:1.316 ZendEngine2/zend_compile.h:1.317
--- ZendEngine2/zend_compile.h:1.316 Wed Aug 3 09:30:49 2005
+++ ZendEngine2/zend_compile.h Wed Aug 10 08:02:14 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.h,v 1.316 2005/08/03 13:30:49 sniper Exp $ */
+/* $Id: zend_compile.h,v 1.317 2005/08/10 12:02:14 dmitry Exp $ */
#ifndef ZEND_COMPILE_H
#define ZEND_COMPILE_H
@@ -648,6 +648,10 @@
#define ZEND_ARG_COMPILE_TIME_BOUND (1<<1)
#define ZEND_ARG_SEND_FUNCTION (1<<2)
+#define ZEND_SEND_BY_VAL 0
+#define ZEND_SEND_BY_REF 1
+#define ZEND_SEND_PREFER_REF 2
+
/* Lost In Stupid Parentheses */
#define ARG_SHOULD_BE_SENT_BY_REF(zf, arg_num)
\
(
\
@@ -657,15 +661,31 @@
(
\
(
\
arg_num<=((zend_function *)
zf)->common.num_args \
- && ((zend_function *)
zf)->common.arg_info[arg_num-1].pass_by_reference \
+ && ((zend_function *)
zf)->common.arg_info[arg_num-1].pass_by_reference == ZEND_SEND_BY_REF \
)
\
|| (
\
arg_num>((zend_function *) zf)->common.num_args
\
- && ((zend_function *)
zf)->common.pass_rest_by_reference \
+ && ((zend_function *)
zf)->common.pass_rest_by_reference == ZEND_SEND_BY_REF
\
)
\
)
\
)
+#define ARG_MAY_BE_SENT_BY_REF(zf, arg_num)
\
+ (
\
+ zf
\
+ && ((zend_function *) zf)->common.arg_info
\
+ &&
\
+ (
\
+ (
\
+ arg_num<=((zend_function *)
zf)->common.num_args \
+ && ((zend_function *)
zf)->common.arg_info[arg_num-1].pass_by_reference == ZEND_SEND_PREFER_REF \
+ )
\
+ || (
\
+ arg_num>((zend_function *) zf)->common.num_args
\
+ && ((zend_function *)
zf)->common.pass_rest_by_reference == ZEND_SEND_PREFER_REF
\
+ )
\
+ )
\
+ )
#define ZEND_RETURN_VAL 0
#define ZEND_RETURN_REF 1
http://cvs.php.net/diff.php/php-src/ext/standard/basic_functions.c?r1=1.726&r2=1.727&ty=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.726
php-src/ext/standard/basic_functions.c:1.727
--- php-src/ext/standard/basic_functions.c:1.726 Tue Aug 9 10:40:59 2005
+++ php-src/ext/standard/basic_functions.c Wed Aug 10 08:02:14 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.726 2005/08/09 14:40:59 iliaa Exp $ */
+/* $Id: basic_functions.c,v 1.727 2005/08/10 12:02:14 dmitry Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -142,6 +142,10 @@
ZEND_ARG_PASS_INFO(1)
ZEND_END_ARG_INFO()
+static
+ ZEND_BEGIN_ARG_INFO(all_args_prefer_ref, ZEND_SEND_PREFER_REF)
+ ZEND_END_ARG_INFO()
+
typedef struct _php_shutdown_function_entry {
zval **arguments;
int arg_count;
@@ -449,7 +453,7 @@
PHP_FE(call_user_func_array,
NULL)
PHP_FE(call_user_method, second_arg_force_ref)
PHP_FE(call_user_method_array, second_arg_force_ref)
- PHP_FE(serialize,
NULL)
+ PHP_FE(serialize,
NULL)
PHP_FE(unserialize,
NULL)
PHP_FE(var_dump,
NULL)
@@ -762,7 +766,7 @@
PHP_FE(compact,
NULL)
PHP_FE(array_fill,
NULL)
PHP_FE(range,
NULL)
- PHP_FE(array_multisort,
NULL)
+ PHP_FE(array_multisort,
all_args_prefer_ref)
PHP_FE(array_push, first_arg_force_ref)
PHP_FE(array_pop, first_arg_force_ref)
PHP_FE(array_shift, first_arg_force_ref)-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
