mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-14 12:40:50 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6daaf1103b | ||
|
|
073d24bb50 | ||
|
|
bdb901b64a | ||
|
|
5cd8ff9885 | ||
|
|
63f3ff7b5f | ||
|
|
0fc90b100d | ||
|
|
de65817136 | ||
|
|
2381b817aa | ||
|
|
9a6b72a05a | ||
|
|
5a3886f15c | ||
|
|
0aadab0e2e | ||
|
|
40dc242904 | ||
|
|
74ba88e186 | ||
|
|
d79dd9cc1c | ||
|
|
ff20a9019d | ||
|
|
27524b52b5 | ||
|
|
d85ac7fb3f | ||
|
|
f28ac55b6d | ||
|
|
a8c7e50f4d | ||
|
|
29ee38bf0d | ||
|
|
1b0e6067d5 | ||
|
|
b7b6c35eea | ||
|
|
27dc82d0ec | ||
|
|
ad5a63e8bc | ||
|
|
345032946c | ||
|
|
763f4aef8b | ||
|
|
ce09822269 | ||
|
|
c2b2afacc0 | ||
|
|
4a1c9be857 | ||
|
|
18b2b2a0bc | ||
|
|
b902a25cc3 | ||
|
|
b8b92bd790 | ||
|
|
0d558afc05 | ||
|
|
050dd59c63 | ||
|
|
72a8489a12 | ||
|
|
101c780500 | ||
|
|
87cabc04ac | ||
|
|
25c08a839a | ||
|
|
e3528f086a | ||
|
|
9937e2fda5 | ||
|
|
5e9268f469 | ||
|
|
de79c51555 | ||
|
|
823e330c75 | ||
|
|
d0cd112702 | ||
|
|
cd6eda5e5f | ||
|
|
b8d88bf2c5 | ||
|
|
d7441f6695 | ||
|
|
7d2609b0f5 | ||
|
|
018b9445da | ||
|
|
a3f5b9f62d | ||
|
|
aee271ec0d | ||
|
|
1984919ddc | ||
|
|
304bff90f4 | ||
|
|
c9cfd98bcd | ||
|
|
288e9c6423 | ||
|
|
df7321359e | ||
|
|
064ba179b1 | ||
|
|
915c428ba1 | ||
|
|
49fbe2579e | ||
|
|
717268cb1e | ||
|
|
5f17c4d08e | ||
|
|
cf2626f10c | ||
|
|
f345152037 | ||
|
|
41eb3c959d | ||
|
|
fd3fa9b53c | ||
|
|
caab95155d | ||
|
|
224dc52ea9 | ||
|
|
b3d522d215 | ||
|
|
890ea8411f | ||
|
|
8cb128159d | ||
|
|
54fe719953 | ||
|
|
91108818e1 | ||
|
|
8b6b39fdcf | ||
|
|
290becb1f1 | ||
|
|
9c1e1bbc05 | ||
|
|
c439ac6c35 | ||
|
|
9d75b9fb27 | ||
|
|
63dba7ec9d | ||
|
|
906d3ae0ed | ||
|
|
d4f5ca467f | ||
|
|
e3d9e18e7b | ||
|
|
2b7e89e20a | ||
|
|
a07ae67a21 | ||
|
|
3d4ef50dd7 | ||
|
|
bb42643ae0 | ||
|
|
d3fd163d27 | ||
|
|
55ee543e2f | ||
|
|
7cd5ae6fab | ||
|
|
812dfbc431 | ||
|
|
b4bed6fde0 | ||
|
|
4ded6ee971 | ||
|
|
5f1cbfacf9 | ||
|
|
0d89265a69 | ||
|
|
4c45e95cfe | ||
|
|
d04bcb8969 | ||
|
|
16a9fec889 | ||
|
|
49b3fef86a | ||
|
|
4dc4302a30 | ||
|
|
a7fc8eecb0 | ||
|
|
e2c9f3983a | ||
|
|
69808d698c | ||
|
|
ad7793d94c | ||
|
|
ab6481993e | ||
|
|
824bac9f23 | ||
|
|
7a526f01b5 | ||
|
|
2d14cc2a49 | ||
|
|
eb22041ffe | ||
|
|
1dcca1fdb9 | ||
|
|
a9c288ed3c | ||
|
|
0db6adda48 | ||
|
|
5c0890ba8a | ||
|
|
91b8a6752e | ||
|
|
f8f643b4f7 | ||
|
|
9765763413 | ||
|
|
a3bd4fda09 | ||
|
|
9b399be778 | ||
|
|
e18e7a5983 | ||
|
|
66fe7fabad | ||
|
|
bd1d2d8fb0 | ||
|
|
a209cf7a5a | ||
|
|
e50eb1ce34 | ||
|
|
bb73d18c85 | ||
|
|
9cb3a759a7 | ||
|
|
70c3a722e2 | ||
|
|
0adba0abb9 | ||
|
|
6af3683a4c | ||
|
|
6410f6ff68 | ||
|
|
1f5b1cfb2b | ||
|
|
2cf5614f5f | ||
|
|
b6ceea4a25 | ||
|
|
ee7cfa022d | ||
|
|
5cc797d119 | ||
|
|
757f4a952c | ||
|
|
2fa5f39e4c | ||
|
|
1b43f95040 | ||
|
|
b636c03426 | ||
|
|
e78c53680f | ||
|
|
fb610b4e80 | ||
|
|
825174e480 | ||
|
|
60ce3811ae | ||
|
|
2ecf94e07e | ||
|
|
098855433d | ||
|
|
cb47396d46 | ||
|
|
f860486de5 | ||
|
|
00697927d8 | ||
|
|
297324146e | ||
|
|
27ebcb8d0e | ||
|
|
8f19a8da65 | ||
|
|
8bef8e66cf | ||
|
|
ef9069b4ef | ||
|
|
910d4751e3 | ||
|
|
2186e1583d | ||
|
|
42cb9ac7a6 | ||
|
|
dab1d76e9d | ||
|
|
646813a37a | ||
|
|
9aad9114e3 | ||
|
|
9e4651f6f1 | ||
|
|
18cc5386de | ||
|
|
2129de4569 | ||
|
|
288a4ec3bd | ||
|
|
8f4a6d6e1b | ||
|
|
c5e5a6c2ac | ||
|
|
1494298231 | ||
|
|
8aa19c9fd8 | ||
|
|
9976b5cd7f | ||
|
|
5b0560efc3 | ||
|
|
52555a7894 | ||
|
|
b6feabc8c6 | ||
|
|
df31eb8fdc | ||
|
|
33d377e701 | ||
|
|
683a7d719b | ||
|
|
fb38fdc7fd | ||
|
|
0d6247f968 | ||
|
|
a1daebefda | ||
|
|
8d22c23161 | ||
|
|
420068c6e1 | ||
|
|
0b5c2887cd | ||
|
|
85a622e42f | ||
|
|
c1f22176f3 | ||
|
|
aa4f9b322b | ||
|
|
1ce00048fd | ||
|
|
2be67ca457 | ||
|
|
4a205092f7 | ||
|
|
26b27767a6 | ||
|
|
813e867652 | ||
|
|
a55d3b9295 | ||
|
|
df501fd464 | ||
|
|
d42fa2a059 | ||
|
|
4d7d85640d | ||
|
|
55b16f40a2 | ||
|
|
6919d15a2e | ||
|
|
30d64b0efb | ||
|
|
1fe1f7305b | ||
|
|
db61685edf | ||
|
|
4417421ab6 | ||
|
|
a4b4477466 | ||
|
|
d89d46d940 | ||
|
|
8aaecef524 | ||
|
|
62be976abe | ||
|
|
2aaa3d538a | ||
|
|
4628c9b375 | ||
|
|
51b809e3ad | ||
|
|
06994a419d | ||
|
|
865f221627 | ||
|
|
4c0bb6d76e | ||
|
|
872ef919ca | ||
|
|
29e755ac66 | ||
|
|
8495d63034 | ||
|
|
aa76f779ef | ||
|
|
2524428504 | ||
|
|
9789df7764 |
No files matched your search
@@ -1,6 +1,73 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2013, PHP 5.5.5
|
||||
12 Dec 2013, PHP 5.5.7
|
||||
|
||||
- CLI server:
|
||||
. Added some MIME types to the CLI web server (Chris Jones)
|
||||
. Implemented FR #65917 (getallheaders() is not supported by the built-in web
|
||||
server) - also implements apache_response_headers() (Andrea Faulds)
|
||||
|
||||
- Core:
|
||||
. Fixed bug #66094 (unregister_tick_function tries to cast a Closure to a
|
||||
string). (Laruence)
|
||||
|
||||
- OPCache
|
||||
. Fixed bug #66176 (Invalid constant substitution). (Dmitry)
|
||||
. Fixed bug #65915 (Inconsistent results with require return value). (Dmitry)
|
||||
. Fixed bug #65559 (Opcache: cache not cleared if changes occur while
|
||||
running). (Dmitry)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed memory corruption in openssl_x509_parse() (CVE-2013-6420).
|
||||
(Stefan Esser).
|
||||
|
||||
- readline
|
||||
. Fixed Bug #65714 (PHP cli forces the tty to cooked mode). (Remi)
|
||||
|
||||
14 Nov 2013, PHP 5.5.6
|
||||
|
||||
- Core:
|
||||
. Fixed bug #65947 (basename is no more working after fgetcsv in certain
|
||||
situation). (Laruence)
|
||||
. Improved performance of array_merge() and func_get_args() by eliminating
|
||||
useless copying. (Dmitry)
|
||||
. Fixed bug #65939 (Space before ";" breaks php.ini parsing).
|
||||
(brainstorm at nopcode dot org)
|
||||
. Fixed bug #65911 (scope resolution operator - strange behavior with $this).
|
||||
(Bob Weinand)
|
||||
. Fixed bug #65936 (dangling context pointer causes crash). (Tony)
|
||||
|
||||
- FPM:
|
||||
. Changed default listen() backlog to 65535. (Tony)
|
||||
|
||||
- JSON
|
||||
. Fixed whitespace part of bug #64874 ("json_decode handles whitespace and
|
||||
case-sensitivity incorrectly"). (Andrea Faulds)
|
||||
|
||||
- MySQLi:
|
||||
. Fixed bug #66043 (Segfault calling bind_param() on mysqli). (Laruence)
|
||||
|
||||
- OPcache
|
||||
. Increased limit for opcache.max_accelerated_files to 1,000,000. (Chris)
|
||||
. Fixed issue #115 (path issue when using phar). (Dmitry)
|
||||
. Fixed issue #149 (Phar mount points not working with OPcache enabled).
|
||||
(Dmitry)
|
||||
|
||||
- ODBC
|
||||
. Fixed bug #65950 (Field name truncation if the field name is bigger than
|
||||
32 characters). (patch submitted by: michael dot y at zend dot com, Yasuo)
|
||||
|
||||
- PDO:
|
||||
. Fixed bug #66033 (Segmentation Fault when constructor of PDO statement
|
||||
throws an exception). (Laruence)
|
||||
. Fixed bug 65946 (sql_parser permanently converts values bound to strings)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #64760 (var_export() does not use full precision for floating-point
|
||||
numbers) (Yasuo)
|
||||
|
||||
|
||||
17 Oct 2013, PHP 5.5.5
|
||||
|
||||
- Core:
|
||||
. Fixed bug #64979 (Wrong behavior of static variables in closure generators).
|
||||
|
||||
@@ -17,7 +17,7 @@ See https://wiki.php.net/rfc and https://wiki.php.net/rfc/voting for more
|
||||
information on the process.
|
||||
|
||||
Bug fixes **do not** require an RFC, but require a bugtracker ticket. Always
|
||||
open a ticket at http://bugs.php.net and reference the bug id using #NNNNNN.
|
||||
open a ticket at https://bugs.php.net and reference the bug id using #NNNNNN.
|
||||
|
||||
Fix #55371: get_magic_quotes_gpc() throws deprecation warning
|
||||
|
||||
@@ -28,3 +28,12 @@ open a ticket at http://bugs.php.net and reference the bug id using #NNNNNN.
|
||||
|
||||
We do not merge pull requests directly on github. All PRs will be
|
||||
pulled and pushed through http://git.php.net.
|
||||
|
||||
|
||||
Guidelines for contributors
|
||||
===========================
|
||||
- [CODING_STANDARDS](/CODING_STANDARDS)
|
||||
- [README.GIT-RULES](/README.GIT-RULES)
|
||||
- [README.MAILINGLIST_RULES](/README.MAILINGLIST_RULES)
|
||||
- [README.RELEASE_PROCESS](/README.RELEASE_PROCESS)
|
||||
|
||||
@@ -343,6 +343,8 @@ None
|
||||
|
||||
- Intl:
|
||||
- This extension now requires ICU 4.0+.
|
||||
- Phar:
|
||||
- Added ability of resolving alias created by Phar::map
|
||||
|
||||
========================================
|
||||
9. New Global Constants
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ AC_DEFUN([LIBZEND_BISON_CHECK],[
|
||||
bison_version=none
|
||||
if test "$YACC"; then
|
||||
AC_CACHE_CHECK([for bison version], php_cv_bison_version, [
|
||||
bison_version_vars=`bison --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /' | tr -d a-z`
|
||||
bison_version_vars=`$YACC --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /g' | tr -d a-z`
|
||||
php_cv_bison_version=invalid
|
||||
if test -n "$bison_version_vars"; then
|
||||
set $bison_version_vars
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #65911 (scope resolution operator - strange behavior with $this)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {}
|
||||
|
||||
class B
|
||||
{
|
||||
public function go()
|
||||
{
|
||||
$this->foo = 'bar';
|
||||
echo A::$this->foo; // should not output 'bar'
|
||||
}
|
||||
}
|
||||
|
||||
$obj = new B();
|
||||
$obj->go();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Access to undeclared static property: A::$this in %s on line %d
|
||||
@@ -461,12 +461,17 @@ ZEND_FUNCTION(func_get_args)
|
||||
|
||||
array_init_size(return_value, arg_count);
|
||||
for (i=0; i<arg_count; i++) {
|
||||
zval *element;
|
||||
zval *element, *arg;
|
||||
|
||||
ALLOC_ZVAL(element);
|
||||
*element = **((zval **) (p-(arg_count-i)));
|
||||
zval_copy_ctor(element);
|
||||
INIT_PZVAL(element);
|
||||
arg = *((zval **) (p-(arg_count-i)));
|
||||
if (!Z_ISREF_P(arg)) {
|
||||
element = arg;
|
||||
Z_ADDREF_P(element);
|
||||
} else {
|
||||
ALLOC_ZVAL(element);
|
||||
INIT_PZVAL_COPY(element, arg);
|
||||
zval_copy_ctor(element);
|
||||
}
|
||||
zend_hash_next_index_insert(return_value->value.ht, &element, sizeof(zval *), NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -908,6 +908,7 @@ static zend_bool opline_is_fetch_this(const zend_op *opline TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
if ((opline->opcode == ZEND_FETCH_W) && (opline->op1_type == IS_CONST)
|
||||
&& (Z_TYPE(CONSTANT(opline->op1.constant)) == IS_STRING)
|
||||
&& ((opline->extended_value & ZEND_FETCH_STATIC_MEMBER) != ZEND_FETCH_STATIC_MEMBER)
|
||||
&& (Z_HASH_P(&CONSTANT(opline->op1.constant)) == THIS_HASHVAL)
|
||||
&& (Z_STRLEN(CONSTANT(opline->op1.constant)) == (sizeof("this")-1))
|
||||
&& !memcmp(Z_STRVAL(CONSTANT(opline->op1.constant)), "this", sizeof("this"))) {
|
||||
|
||||
@@ -789,6 +789,7 @@ static zend_always_inline int fast_mul_function(zval *result, zval *op1, zval *o
|
||||
|
||||
static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
#if 0
|
||||
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG) && 0) {
|
||||
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
|
||||
if (UNEXPECTED(Z_LVAL_P(op2) == 0)) {
|
||||
@@ -843,6 +844,7 @@ static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *o
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return div_function(result, op1, op2 TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
+13
-15
@@ -4453,22 +4453,22 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST|
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1, free_op2;
|
||||
zval **container;
|
||||
zval *container;
|
||||
zval **value = NULL;
|
||||
int result = 0;
|
||||
ulong hval;
|
||||
zval *offset;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_IS);
|
||||
container = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_IS);
|
||||
|
||||
offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
|
||||
|
||||
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
|
||||
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
|
||||
HashTable *ht;
|
||||
int isset = 0;
|
||||
|
||||
ht = Z_ARRVAL_PP(container);
|
||||
ht = Z_ARRVAL_P(container);
|
||||
|
||||
switch (Z_TYPE_P(offset)) {
|
||||
case IS_DOUBLE:
|
||||
@@ -4487,9 +4487,7 @@ ZEND_VM_C_LABEL(num_index_prop):
|
||||
if (OP2_TYPE == IS_CONST) {
|
||||
hval = Z_HASH_P(offset);
|
||||
} else {
|
||||
if (!prop_dim) {
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_prop));
|
||||
}
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_prop));
|
||||
if (IS_INTERNED(Z_STRVAL_P(offset))) {
|
||||
hval = INTERNED_HASH(Z_STRVAL_P(offset));
|
||||
} else {
|
||||
@@ -4524,20 +4522,20 @@ ZEND_VM_C_LABEL(num_index_prop):
|
||||
}
|
||||
}
|
||||
FREE_OP2();
|
||||
} else if (Z_TYPE_PP(container) == IS_OBJECT) {
|
||||
} else if (Z_TYPE_P(container) == IS_OBJECT) {
|
||||
if (IS_OP2_TMP_FREE()) {
|
||||
MAKE_REAL_ZVAL_PTR(offset);
|
||||
}
|
||||
if (prop_dim) {
|
||||
if (Z_OBJ_HT_P(*container)->has_property) {
|
||||
result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_property) {
|
||||
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check property of non-object");
|
||||
result = 0;
|
||||
}
|
||||
} else {
|
||||
if (Z_OBJ_HT_P(*container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check element of non-array");
|
||||
result = 0;
|
||||
@@ -4548,7 +4546,7 @@ ZEND_VM_C_LABEL(num_index_prop):
|
||||
} else {
|
||||
FREE_OP2();
|
||||
}
|
||||
} else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
|
||||
} else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */
|
||||
zval tmp;
|
||||
|
||||
if (Z_TYPE_P(offset) != IS_LONG) {
|
||||
@@ -4566,11 +4564,11 @@ ZEND_VM_C_LABEL(num_index_prop):
|
||||
}
|
||||
if (Z_TYPE_P(offset) == IS_LONG) {
|
||||
if (opline->extended_value & ZEND_ISSET) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) {
|
||||
result = 1;
|
||||
}
|
||||
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') {
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
|
||||
+156
-180
@@ -16074,22 +16074,22 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1;
|
||||
zval **container;
|
||||
zval *container;
|
||||
zval **value = NULL;
|
||||
int result = 0;
|
||||
ulong hval;
|
||||
zval *offset;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
|
||||
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
|
||||
|
||||
offset = opline->op2.zv;
|
||||
|
||||
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
|
||||
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
|
||||
HashTable *ht;
|
||||
int isset = 0;
|
||||
|
||||
ht = Z_ARRVAL_PP(container);
|
||||
ht = Z_ARRVAL_P(container);
|
||||
|
||||
switch (Z_TYPE_P(offset)) {
|
||||
case IS_DOUBLE:
|
||||
@@ -16108,9 +16108,7 @@ num_index_prop:
|
||||
if (IS_CONST == IS_CONST) {
|
||||
hval = Z_HASH_P(offset);
|
||||
} else {
|
||||
if (!prop_dim) {
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
}
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
if (IS_INTERNED(Z_STRVAL_P(offset))) {
|
||||
hval = INTERNED_HASH(Z_STRVAL_P(offset));
|
||||
} else {
|
||||
@@ -16145,20 +16143,20 @@ num_index_prop:
|
||||
}
|
||||
}
|
||||
|
||||
} else if (Z_TYPE_PP(container) == IS_OBJECT) {
|
||||
} else if (Z_TYPE_P(container) == IS_OBJECT) {
|
||||
if (0) {
|
||||
MAKE_REAL_ZVAL_PTR(offset);
|
||||
}
|
||||
if (prop_dim) {
|
||||
if (Z_OBJ_HT_P(*container)->has_property) {
|
||||
result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_property) {
|
||||
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check property of non-object");
|
||||
result = 0;
|
||||
}
|
||||
} else {
|
||||
if (Z_OBJ_HT_P(*container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check element of non-array");
|
||||
result = 0;
|
||||
@@ -16169,7 +16167,7 @@ num_index_prop:
|
||||
} else {
|
||||
|
||||
}
|
||||
} else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
|
||||
} else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */
|
||||
zval tmp;
|
||||
|
||||
if (Z_TYPE_P(offset) != IS_LONG) {
|
||||
@@ -16187,11 +16185,11 @@ num_index_prop:
|
||||
}
|
||||
if (Z_TYPE_P(offset) == IS_LONG) {
|
||||
if (opline->extended_value & ZEND_ISSET) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) {
|
||||
result = 1;
|
||||
}
|
||||
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') {
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
@@ -18168,22 +18166,22 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(in
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1, free_op2;
|
||||
zval **container;
|
||||
zval *container;
|
||||
zval **value = NULL;
|
||||
int result = 0;
|
||||
ulong hval;
|
||||
zval *offset;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
|
||||
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
|
||||
|
||||
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
|
||||
|
||||
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
|
||||
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
|
||||
HashTable *ht;
|
||||
int isset = 0;
|
||||
|
||||
ht = Z_ARRVAL_PP(container);
|
||||
ht = Z_ARRVAL_P(container);
|
||||
|
||||
switch (Z_TYPE_P(offset)) {
|
||||
case IS_DOUBLE:
|
||||
@@ -18202,9 +18200,7 @@ num_index_prop:
|
||||
if (IS_TMP_VAR == IS_CONST) {
|
||||
hval = Z_HASH_P(offset);
|
||||
} else {
|
||||
if (!prop_dim) {
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
}
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
if (IS_INTERNED(Z_STRVAL_P(offset))) {
|
||||
hval = INTERNED_HASH(Z_STRVAL_P(offset));
|
||||
} else {
|
||||
@@ -18239,20 +18235,20 @@ num_index_prop:
|
||||
}
|
||||
}
|
||||
zval_dtor(free_op2.var);
|
||||
} else if (Z_TYPE_PP(container) == IS_OBJECT) {
|
||||
} else if (Z_TYPE_P(container) == IS_OBJECT) {
|
||||
if (1) {
|
||||
MAKE_REAL_ZVAL_PTR(offset);
|
||||
}
|
||||
if (prop_dim) {
|
||||
if (Z_OBJ_HT_P(*container)->has_property) {
|
||||
result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_property) {
|
||||
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check property of non-object");
|
||||
result = 0;
|
||||
}
|
||||
} else {
|
||||
if (Z_OBJ_HT_P(*container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check element of non-array");
|
||||
result = 0;
|
||||
@@ -18263,7 +18259,7 @@ num_index_prop:
|
||||
} else {
|
||||
zval_dtor(free_op2.var);
|
||||
}
|
||||
} else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
|
||||
} else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */
|
||||
zval tmp;
|
||||
|
||||
if (Z_TYPE_P(offset) != IS_LONG) {
|
||||
@@ -18281,11 +18277,11 @@ num_index_prop:
|
||||
}
|
||||
if (Z_TYPE_P(offset) == IS_LONG) {
|
||||
if (opline->extended_value & ZEND_ISSET) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) {
|
||||
result = 1;
|
||||
}
|
||||
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') {
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
@@ -20644,22 +20640,22 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(in
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1, free_op2;
|
||||
zval **container;
|
||||
zval *container;
|
||||
zval **value = NULL;
|
||||
int result = 0;
|
||||
ulong hval;
|
||||
zval *offset;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
|
||||
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
|
||||
|
||||
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
|
||||
|
||||
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
|
||||
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
|
||||
HashTable *ht;
|
||||
int isset = 0;
|
||||
|
||||
ht = Z_ARRVAL_PP(container);
|
||||
ht = Z_ARRVAL_P(container);
|
||||
|
||||
switch (Z_TYPE_P(offset)) {
|
||||
case IS_DOUBLE:
|
||||
@@ -20678,9 +20674,7 @@ num_index_prop:
|
||||
if (IS_VAR == IS_CONST) {
|
||||
hval = Z_HASH_P(offset);
|
||||
} else {
|
||||
if (!prop_dim) {
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
}
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
if (IS_INTERNED(Z_STRVAL_P(offset))) {
|
||||
hval = INTERNED_HASH(Z_STRVAL_P(offset));
|
||||
} else {
|
||||
@@ -20715,20 +20709,20 @@ num_index_prop:
|
||||
}
|
||||
}
|
||||
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
|
||||
} else if (Z_TYPE_PP(container) == IS_OBJECT) {
|
||||
} else if (Z_TYPE_P(container) == IS_OBJECT) {
|
||||
if (0) {
|
||||
MAKE_REAL_ZVAL_PTR(offset);
|
||||
}
|
||||
if (prop_dim) {
|
||||
if (Z_OBJ_HT_P(*container)->has_property) {
|
||||
result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_property) {
|
||||
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check property of non-object");
|
||||
result = 0;
|
||||
}
|
||||
} else {
|
||||
if (Z_OBJ_HT_P(*container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check element of non-array");
|
||||
result = 0;
|
||||
@@ -20739,7 +20733,7 @@ num_index_prop:
|
||||
} else {
|
||||
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
|
||||
}
|
||||
} else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
|
||||
} else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */
|
||||
zval tmp;
|
||||
|
||||
if (Z_TYPE_P(offset) != IS_LONG) {
|
||||
@@ -20757,11 +20751,11 @@ num_index_prop:
|
||||
}
|
||||
if (Z_TYPE_P(offset) == IS_LONG) {
|
||||
if (opline->extended_value & ZEND_ISSET) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) {
|
||||
result = 1;
|
||||
}
|
||||
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') {
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
@@ -23936,22 +23930,22 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op1;
|
||||
zval **container;
|
||||
zval *container;
|
||||
zval **value = NULL;
|
||||
int result = 0;
|
||||
ulong hval;
|
||||
zval *offset;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
|
||||
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
|
||||
|
||||
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
|
||||
|
||||
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
|
||||
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
|
||||
HashTable *ht;
|
||||
int isset = 0;
|
||||
|
||||
ht = Z_ARRVAL_PP(container);
|
||||
ht = Z_ARRVAL_P(container);
|
||||
|
||||
switch (Z_TYPE_P(offset)) {
|
||||
case IS_DOUBLE:
|
||||
@@ -23970,9 +23964,7 @@ num_index_prop:
|
||||
if (IS_CV == IS_CONST) {
|
||||
hval = Z_HASH_P(offset);
|
||||
} else {
|
||||
if (!prop_dim) {
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
}
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
if (IS_INTERNED(Z_STRVAL_P(offset))) {
|
||||
hval = INTERNED_HASH(Z_STRVAL_P(offset));
|
||||
} else {
|
||||
@@ -24007,20 +23999,20 @@ num_index_prop:
|
||||
}
|
||||
}
|
||||
|
||||
} else if (Z_TYPE_PP(container) == IS_OBJECT) {
|
||||
} else if (Z_TYPE_P(container) == IS_OBJECT) {
|
||||
if (0) {
|
||||
MAKE_REAL_ZVAL_PTR(offset);
|
||||
}
|
||||
if (prop_dim) {
|
||||
if (Z_OBJ_HT_P(*container)->has_property) {
|
||||
result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_property) {
|
||||
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check property of non-object");
|
||||
result = 0;
|
||||
}
|
||||
} else {
|
||||
if (Z_OBJ_HT_P(*container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check element of non-array");
|
||||
result = 0;
|
||||
@@ -24031,7 +24023,7 @@ num_index_prop:
|
||||
} else {
|
||||
|
||||
}
|
||||
} else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
|
||||
} else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */
|
||||
zval tmp;
|
||||
|
||||
if (Z_TYPE_P(offset) != IS_LONG) {
|
||||
@@ -24049,11 +24041,11 @@ num_index_prop:
|
||||
}
|
||||
if (Z_TYPE_P(offset) == IS_LONG) {
|
||||
if (opline->extended_value & ZEND_ISSET) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) {
|
||||
result = 1;
|
||||
}
|
||||
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') {
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
@@ -25440,22 +25432,22 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CON
|
||||
{
|
||||
USE_OPLINE
|
||||
|
||||
zval **container;
|
||||
zval *container;
|
||||
zval **value = NULL;
|
||||
int result = 0;
|
||||
ulong hval;
|
||||
zval *offset;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
|
||||
container = _get_obj_zval_ptr_unused(TSRMLS_C);
|
||||
|
||||
offset = opline->op2.zv;
|
||||
|
||||
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
|
||||
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
|
||||
HashTable *ht;
|
||||
int isset = 0;
|
||||
|
||||
ht = Z_ARRVAL_PP(container);
|
||||
ht = Z_ARRVAL_P(container);
|
||||
|
||||
switch (Z_TYPE_P(offset)) {
|
||||
case IS_DOUBLE:
|
||||
@@ -25474,9 +25466,7 @@ num_index_prop:
|
||||
if (IS_CONST == IS_CONST) {
|
||||
hval = Z_HASH_P(offset);
|
||||
} else {
|
||||
if (!prop_dim) {
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
}
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
if (IS_INTERNED(Z_STRVAL_P(offset))) {
|
||||
hval = INTERNED_HASH(Z_STRVAL_P(offset));
|
||||
} else {
|
||||
@@ -25511,20 +25501,20 @@ num_index_prop:
|
||||
}
|
||||
}
|
||||
|
||||
} else if (Z_TYPE_PP(container) == IS_OBJECT) {
|
||||
} else if (Z_TYPE_P(container) == IS_OBJECT) {
|
||||
if (0) {
|
||||
MAKE_REAL_ZVAL_PTR(offset);
|
||||
}
|
||||
if (prop_dim) {
|
||||
if (Z_OBJ_HT_P(*container)->has_property) {
|
||||
result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_property) {
|
||||
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check property of non-object");
|
||||
result = 0;
|
||||
}
|
||||
} else {
|
||||
if (Z_OBJ_HT_P(*container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check element of non-array");
|
||||
result = 0;
|
||||
@@ -25535,7 +25525,7 @@ num_index_prop:
|
||||
} else {
|
||||
|
||||
}
|
||||
} else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
|
||||
} else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */
|
||||
zval tmp;
|
||||
|
||||
if (Z_TYPE_P(offset) != IS_LONG) {
|
||||
@@ -25553,11 +25543,11 @@ num_index_prop:
|
||||
}
|
||||
if (Z_TYPE_P(offset) == IS_LONG) {
|
||||
if (opline->extended_value & ZEND_ISSET) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) {
|
||||
result = 1;
|
||||
}
|
||||
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') {
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
@@ -26756,22 +26746,22 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op2;
|
||||
zval **container;
|
||||
zval *container;
|
||||
zval **value = NULL;
|
||||
int result = 0;
|
||||
ulong hval;
|
||||
zval *offset;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
|
||||
container = _get_obj_zval_ptr_unused(TSRMLS_C);
|
||||
|
||||
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
|
||||
|
||||
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
|
||||
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
|
||||
HashTable *ht;
|
||||
int isset = 0;
|
||||
|
||||
ht = Z_ARRVAL_PP(container);
|
||||
ht = Z_ARRVAL_P(container);
|
||||
|
||||
switch (Z_TYPE_P(offset)) {
|
||||
case IS_DOUBLE:
|
||||
@@ -26790,9 +26780,7 @@ num_index_prop:
|
||||
if (IS_TMP_VAR == IS_CONST) {
|
||||
hval = Z_HASH_P(offset);
|
||||
} else {
|
||||
if (!prop_dim) {
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
}
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
if (IS_INTERNED(Z_STRVAL_P(offset))) {
|
||||
hval = INTERNED_HASH(Z_STRVAL_P(offset));
|
||||
} else {
|
||||
@@ -26827,20 +26815,20 @@ num_index_prop:
|
||||
}
|
||||
}
|
||||
zval_dtor(free_op2.var);
|
||||
} else if (Z_TYPE_PP(container) == IS_OBJECT) {
|
||||
} else if (Z_TYPE_P(container) == IS_OBJECT) {
|
||||
if (1) {
|
||||
MAKE_REAL_ZVAL_PTR(offset);
|
||||
}
|
||||
if (prop_dim) {
|
||||
if (Z_OBJ_HT_P(*container)->has_property) {
|
||||
result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_property) {
|
||||
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check property of non-object");
|
||||
result = 0;
|
||||
}
|
||||
} else {
|
||||
if (Z_OBJ_HT_P(*container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check element of non-array");
|
||||
result = 0;
|
||||
@@ -26851,7 +26839,7 @@ num_index_prop:
|
||||
} else {
|
||||
zval_dtor(free_op2.var);
|
||||
}
|
||||
} else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
|
||||
} else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */
|
||||
zval tmp;
|
||||
|
||||
if (Z_TYPE_P(offset) != IS_LONG) {
|
||||
@@ -26869,11 +26857,11 @@ num_index_prop:
|
||||
}
|
||||
if (Z_TYPE_P(offset) == IS_LONG) {
|
||||
if (opline->extended_value & ZEND_ISSET) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) {
|
||||
result = 1;
|
||||
}
|
||||
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') {
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
@@ -28072,22 +28060,22 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op2;
|
||||
zval **container;
|
||||
zval *container;
|
||||
zval **value = NULL;
|
||||
int result = 0;
|
||||
ulong hval;
|
||||
zval *offset;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
|
||||
container = _get_obj_zval_ptr_unused(TSRMLS_C);
|
||||
|
||||
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
|
||||
|
||||
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
|
||||
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
|
||||
HashTable *ht;
|
||||
int isset = 0;
|
||||
|
||||
ht = Z_ARRVAL_PP(container);
|
||||
ht = Z_ARRVAL_P(container);
|
||||
|
||||
switch (Z_TYPE_P(offset)) {
|
||||
case IS_DOUBLE:
|
||||
@@ -28106,9 +28094,7 @@ num_index_prop:
|
||||
if (IS_VAR == IS_CONST) {
|
||||
hval = Z_HASH_P(offset);
|
||||
} else {
|
||||
if (!prop_dim) {
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
}
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
if (IS_INTERNED(Z_STRVAL_P(offset))) {
|
||||
hval = INTERNED_HASH(Z_STRVAL_P(offset));
|
||||
} else {
|
||||
@@ -28143,20 +28129,20 @@ num_index_prop:
|
||||
}
|
||||
}
|
||||
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
|
||||
} else if (Z_TYPE_PP(container) == IS_OBJECT) {
|
||||
} else if (Z_TYPE_P(container) == IS_OBJECT) {
|
||||
if (0) {
|
||||
MAKE_REAL_ZVAL_PTR(offset);
|
||||
}
|
||||
if (prop_dim) {
|
||||
if (Z_OBJ_HT_P(*container)->has_property) {
|
||||
result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_property) {
|
||||
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check property of non-object");
|
||||
result = 0;
|
||||
}
|
||||
} else {
|
||||
if (Z_OBJ_HT_P(*container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check element of non-array");
|
||||
result = 0;
|
||||
@@ -28167,7 +28153,7 @@ num_index_prop:
|
||||
} else {
|
||||
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
|
||||
}
|
||||
} else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
|
||||
} else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */
|
||||
zval tmp;
|
||||
|
||||
if (Z_TYPE_P(offset) != IS_LONG) {
|
||||
@@ -28185,11 +28171,11 @@ num_index_prop:
|
||||
}
|
||||
if (Z_TYPE_P(offset) == IS_LONG) {
|
||||
if (opline->extended_value & ZEND_ISSET) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) {
|
||||
result = 1;
|
||||
}
|
||||
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') {
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
@@ -29808,22 +29794,22 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(
|
||||
{
|
||||
USE_OPLINE
|
||||
|
||||
zval **container;
|
||||
zval *container;
|
||||
zval **value = NULL;
|
||||
int result = 0;
|
||||
ulong hval;
|
||||
zval *offset;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
|
||||
container = _get_obj_zval_ptr_unused(TSRMLS_C);
|
||||
|
||||
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
|
||||
|
||||
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
|
||||
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
|
||||
HashTable *ht;
|
||||
int isset = 0;
|
||||
|
||||
ht = Z_ARRVAL_PP(container);
|
||||
ht = Z_ARRVAL_P(container);
|
||||
|
||||
switch (Z_TYPE_P(offset)) {
|
||||
case IS_DOUBLE:
|
||||
@@ -29842,9 +29828,7 @@ num_index_prop:
|
||||
if (IS_CV == IS_CONST) {
|
||||
hval = Z_HASH_P(offset);
|
||||
} else {
|
||||
if (!prop_dim) {
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
}
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
if (IS_INTERNED(Z_STRVAL_P(offset))) {
|
||||
hval = INTERNED_HASH(Z_STRVAL_P(offset));
|
||||
} else {
|
||||
@@ -29879,20 +29863,20 @@ num_index_prop:
|
||||
}
|
||||
}
|
||||
|
||||
} else if (Z_TYPE_PP(container) == IS_OBJECT) {
|
||||
} else if (Z_TYPE_P(container) == IS_OBJECT) {
|
||||
if (0) {
|
||||
MAKE_REAL_ZVAL_PTR(offset);
|
||||
}
|
||||
if (prop_dim) {
|
||||
if (Z_OBJ_HT_P(*container)->has_property) {
|
||||
result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_property) {
|
||||
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check property of non-object");
|
||||
result = 0;
|
||||
}
|
||||
} else {
|
||||
if (Z_OBJ_HT_P(*container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check element of non-array");
|
||||
result = 0;
|
||||
@@ -29903,7 +29887,7 @@ num_index_prop:
|
||||
} else {
|
||||
|
||||
}
|
||||
} else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
|
||||
} else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */
|
||||
zval tmp;
|
||||
|
||||
if (Z_TYPE_P(offset) != IS_LONG) {
|
||||
@@ -29921,11 +29905,11 @@ num_index_prop:
|
||||
}
|
||||
if (Z_TYPE_P(offset) == IS_LONG) {
|
||||
if (opline->extended_value & ZEND_ISSET) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) {
|
||||
result = 1;
|
||||
}
|
||||
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') {
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
@@ -33302,22 +33286,22 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(i
|
||||
{
|
||||
USE_OPLINE
|
||||
|
||||
zval **container;
|
||||
zval *container;
|
||||
zval **value = NULL;
|
||||
int result = 0;
|
||||
ulong hval;
|
||||
zval *offset;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = _get_zval_ptr_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
|
||||
container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
|
||||
|
||||
offset = opline->op2.zv;
|
||||
|
||||
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
|
||||
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
|
||||
HashTable *ht;
|
||||
int isset = 0;
|
||||
|
||||
ht = Z_ARRVAL_PP(container);
|
||||
ht = Z_ARRVAL_P(container);
|
||||
|
||||
switch (Z_TYPE_P(offset)) {
|
||||
case IS_DOUBLE:
|
||||
@@ -33336,9 +33320,7 @@ num_index_prop:
|
||||
if (IS_CONST == IS_CONST) {
|
||||
hval = Z_HASH_P(offset);
|
||||
} else {
|
||||
if (!prop_dim) {
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
}
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
if (IS_INTERNED(Z_STRVAL_P(offset))) {
|
||||
hval = INTERNED_HASH(Z_STRVAL_P(offset));
|
||||
} else {
|
||||
@@ -33373,20 +33355,20 @@ num_index_prop:
|
||||
}
|
||||
}
|
||||
|
||||
} else if (Z_TYPE_PP(container) == IS_OBJECT) {
|
||||
} else if (Z_TYPE_P(container) == IS_OBJECT) {
|
||||
if (0) {
|
||||
MAKE_REAL_ZVAL_PTR(offset);
|
||||
}
|
||||
if (prop_dim) {
|
||||
if (Z_OBJ_HT_P(*container)->has_property) {
|
||||
result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_property) {
|
||||
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check property of non-object");
|
||||
result = 0;
|
||||
}
|
||||
} else {
|
||||
if (Z_OBJ_HT_P(*container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check element of non-array");
|
||||
result = 0;
|
||||
@@ -33397,7 +33379,7 @@ num_index_prop:
|
||||
} else {
|
||||
|
||||
}
|
||||
} else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
|
||||
} else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */
|
||||
zval tmp;
|
||||
|
||||
if (Z_TYPE_P(offset) != IS_LONG) {
|
||||
@@ -33415,11 +33397,11 @@ num_index_prop:
|
||||
}
|
||||
if (Z_TYPE_P(offset) == IS_LONG) {
|
||||
if (opline->extended_value & ZEND_ISSET) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) {
|
||||
result = 1;
|
||||
}
|
||||
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') {
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
@@ -35258,22 +35240,22 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op2;
|
||||
zval **container;
|
||||
zval *container;
|
||||
zval **value = NULL;
|
||||
int result = 0;
|
||||
ulong hval;
|
||||
zval *offset;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = _get_zval_ptr_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
|
||||
container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
|
||||
|
||||
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
|
||||
|
||||
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
|
||||
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
|
||||
HashTable *ht;
|
||||
int isset = 0;
|
||||
|
||||
ht = Z_ARRVAL_PP(container);
|
||||
ht = Z_ARRVAL_P(container);
|
||||
|
||||
switch (Z_TYPE_P(offset)) {
|
||||
case IS_DOUBLE:
|
||||
@@ -35292,9 +35274,7 @@ num_index_prop:
|
||||
if (IS_TMP_VAR == IS_CONST) {
|
||||
hval = Z_HASH_P(offset);
|
||||
} else {
|
||||
if (!prop_dim) {
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
}
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
if (IS_INTERNED(Z_STRVAL_P(offset))) {
|
||||
hval = INTERNED_HASH(Z_STRVAL_P(offset));
|
||||
} else {
|
||||
@@ -35329,20 +35309,20 @@ num_index_prop:
|
||||
}
|
||||
}
|
||||
zval_dtor(free_op2.var);
|
||||
} else if (Z_TYPE_PP(container) == IS_OBJECT) {
|
||||
} else if (Z_TYPE_P(container) == IS_OBJECT) {
|
||||
if (1) {
|
||||
MAKE_REAL_ZVAL_PTR(offset);
|
||||
}
|
||||
if (prop_dim) {
|
||||
if (Z_OBJ_HT_P(*container)->has_property) {
|
||||
result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_property) {
|
||||
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check property of non-object");
|
||||
result = 0;
|
||||
}
|
||||
} else {
|
||||
if (Z_OBJ_HT_P(*container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check element of non-array");
|
||||
result = 0;
|
||||
@@ -35353,7 +35333,7 @@ num_index_prop:
|
||||
} else {
|
||||
zval_dtor(free_op2.var);
|
||||
}
|
||||
} else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
|
||||
} else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */
|
||||
zval tmp;
|
||||
|
||||
if (Z_TYPE_P(offset) != IS_LONG) {
|
||||
@@ -35371,11 +35351,11 @@ num_index_prop:
|
||||
}
|
||||
if (Z_TYPE_P(offset) == IS_LONG) {
|
||||
if (opline->extended_value & ZEND_ISSET) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) {
|
||||
result = 1;
|
||||
}
|
||||
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') {
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
@@ -37595,22 +37575,22 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_free_op free_op2;
|
||||
zval **container;
|
||||
zval *container;
|
||||
zval **value = NULL;
|
||||
int result = 0;
|
||||
ulong hval;
|
||||
zval *offset;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = _get_zval_ptr_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
|
||||
container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
|
||||
|
||||
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
|
||||
|
||||
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
|
||||
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
|
||||
HashTable *ht;
|
||||
int isset = 0;
|
||||
|
||||
ht = Z_ARRVAL_PP(container);
|
||||
ht = Z_ARRVAL_P(container);
|
||||
|
||||
switch (Z_TYPE_P(offset)) {
|
||||
case IS_DOUBLE:
|
||||
@@ -37629,9 +37609,7 @@ num_index_prop:
|
||||
if (IS_VAR == IS_CONST) {
|
||||
hval = Z_HASH_P(offset);
|
||||
} else {
|
||||
if (!prop_dim) {
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
}
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
if (IS_INTERNED(Z_STRVAL_P(offset))) {
|
||||
hval = INTERNED_HASH(Z_STRVAL_P(offset));
|
||||
} else {
|
||||
@@ -37666,20 +37644,20 @@ num_index_prop:
|
||||
}
|
||||
}
|
||||
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
|
||||
} else if (Z_TYPE_PP(container) == IS_OBJECT) {
|
||||
} else if (Z_TYPE_P(container) == IS_OBJECT) {
|
||||
if (0) {
|
||||
MAKE_REAL_ZVAL_PTR(offset);
|
||||
}
|
||||
if (prop_dim) {
|
||||
if (Z_OBJ_HT_P(*container)->has_property) {
|
||||
result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_property) {
|
||||
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check property of non-object");
|
||||
result = 0;
|
||||
}
|
||||
} else {
|
||||
if (Z_OBJ_HT_P(*container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check element of non-array");
|
||||
result = 0;
|
||||
@@ -37690,7 +37668,7 @@ num_index_prop:
|
||||
} else {
|
||||
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
|
||||
}
|
||||
} else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
|
||||
} else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */
|
||||
zval tmp;
|
||||
|
||||
if (Z_TYPE_P(offset) != IS_LONG) {
|
||||
@@ -37708,11 +37686,11 @@ num_index_prop:
|
||||
}
|
||||
if (Z_TYPE_P(offset) == IS_LONG) {
|
||||
if (opline->extended_value & ZEND_ISSET) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) {
|
||||
result = 1;
|
||||
}
|
||||
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') {
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
@@ -40600,22 +40578,22 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int
|
||||
{
|
||||
USE_OPLINE
|
||||
|
||||
zval **container;
|
||||
zval *container;
|
||||
zval **value = NULL;
|
||||
int result = 0;
|
||||
ulong hval;
|
||||
zval *offset;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = _get_zval_ptr_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
|
||||
container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
|
||||
|
||||
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
|
||||
|
||||
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
|
||||
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
|
||||
HashTable *ht;
|
||||
int isset = 0;
|
||||
|
||||
ht = Z_ARRVAL_PP(container);
|
||||
ht = Z_ARRVAL_P(container);
|
||||
|
||||
switch (Z_TYPE_P(offset)) {
|
||||
case IS_DOUBLE:
|
||||
@@ -40634,9 +40612,7 @@ num_index_prop:
|
||||
if (IS_CV == IS_CONST) {
|
||||
hval = Z_HASH_P(offset);
|
||||
} else {
|
||||
if (!prop_dim) {
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
}
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
|
||||
if (IS_INTERNED(Z_STRVAL_P(offset))) {
|
||||
hval = INTERNED_HASH(Z_STRVAL_P(offset));
|
||||
} else {
|
||||
@@ -40671,20 +40647,20 @@ num_index_prop:
|
||||
}
|
||||
}
|
||||
|
||||
} else if (Z_TYPE_PP(container) == IS_OBJECT) {
|
||||
} else if (Z_TYPE_P(container) == IS_OBJECT) {
|
||||
if (0) {
|
||||
MAKE_REAL_ZVAL_PTR(offset);
|
||||
}
|
||||
if (prop_dim) {
|
||||
if (Z_OBJ_HT_P(*container)->has_property) {
|
||||
result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_property) {
|
||||
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check property of non-object");
|
||||
result = 0;
|
||||
}
|
||||
} else {
|
||||
if (Z_OBJ_HT_P(*container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(container)->has_dimension) {
|
||||
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check element of non-array");
|
||||
result = 0;
|
||||
@@ -40695,7 +40671,7 @@ num_index_prop:
|
||||
} else {
|
||||
|
||||
}
|
||||
} else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
|
||||
} else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */
|
||||
zval tmp;
|
||||
|
||||
if (Z_TYPE_P(offset) != IS_LONG) {
|
||||
@@ -40713,11 +40689,11 @@ num_index_prop:
|
||||
}
|
||||
if (Z_TYPE_P(offset) == IS_LONG) {
|
||||
if (opline->extended_value & ZEND_ISSET) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) {
|
||||
result = 1;
|
||||
}
|
||||
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
|
||||
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container) && Z_STRVAL_P(container)[offset->value.lval] != '0') {
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=5
|
||||
PHP_RELEASE_VERSION=5
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=7
|
||||
PHP_EXTRA_VERSION=""
|
||||
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
|
||||
|
||||
|
||||
@@ -97,6 +97,7 @@ static php_stream_filter_status_t php_bz2_decompress_filter(
|
||||
status = BZ2_bzDecompressInit(streamp, 0, data->small_footprint);
|
||||
|
||||
if (BZ_OK != status) {
|
||||
php_stream_bucket_delref(bucket TSRMLS_CC);
|
||||
return PSFS_ERR_FATAL;
|
||||
}
|
||||
|
||||
|
||||
+660
-658
File diff suppressed because it is too large.
Load diff
@@ -1406,6 +1406,7 @@ PHPAPI signed long php_parse_date(char *string, signed long *now)
|
||||
|
||||
parsed_time = timelib_strtotime(string, strlen(string), &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
|
||||
if (error->error_count) {
|
||||
timelib_time_dtor(parsed_time);
|
||||
timelib_error_container_dtor(error);
|
||||
return -1;
|
||||
}
|
||||
|
||||
+6
-3
@@ -625,7 +625,8 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
char *file_mode;
|
||||
char mode[4], *pmode, *lock_file_mode = NULL;
|
||||
int persistent_flag = persistent ? STREAM_OPEN_PERSISTENT : 0;
|
||||
char *opened_path, *lock_name;
|
||||
char *opened_path = NULL;
|
||||
char *lock_name;
|
||||
|
||||
if(ac < 2) {
|
||||
WRONG_PARAM_COUNT;
|
||||
@@ -848,8 +849,10 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
if (!persistent) {
|
||||
info->lock.name = opened_path;
|
||||
} else {
|
||||
info->lock.name = pestrdup(opened_path, persistent);
|
||||
efree(opened_path);
|
||||
if (opened_path) {
|
||||
info->lock.name = pestrdup(opened_path, persistent);
|
||||
efree(opened_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-5
@@ -2643,6 +2643,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
} else {
|
||||
decode = ImageInfo->decode_unicode_le;
|
||||
}
|
||||
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
|
||||
if (zend_multibyte_encoding_converter(
|
||||
(unsigned char**)pszInfoPtr,
|
||||
&len,
|
||||
@@ -2650,7 +2651,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
ByteCount,
|
||||
zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC),
|
||||
zend_multibyte_fetch_encoding(decode TSRMLS_CC)
|
||||
TSRMLS_CC) < 0) {
|
||||
TSRMLS_CC) == (size_t)-1) {
|
||||
len = exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount);
|
||||
}
|
||||
return len;
|
||||
@@ -2663,6 +2664,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
*pszEncoding = estrdup((const char*)szValuePtr);
|
||||
szValuePtr = szValuePtr+8;
|
||||
ByteCount -= 8;
|
||||
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
|
||||
if (zend_multibyte_encoding_converter(
|
||||
(unsigned char**)pszInfoPtr,
|
||||
&len,
|
||||
@@ -2670,7 +2672,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
ByteCount,
|
||||
zend_multibyte_fetch_encoding(ImageInfo->encode_jis TSRMLS_CC),
|
||||
zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? ImageInfo->decode_jis_be : ImageInfo->decode_jis_le TSRMLS_CC)
|
||||
TSRMLS_CC) < 0) {
|
||||
TSRMLS_CC) == (size_t)-1) {
|
||||
len = exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount);
|
||||
}
|
||||
return len;
|
||||
@@ -2700,8 +2702,8 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
static int exif_process_unicode(image_info_type *ImageInfo, xp_field_type *xp_field, int tag, char *szValuePtr, int ByteCount TSRMLS_DC)
|
||||
{
|
||||
xp_field->tag = tag;
|
||||
|
||||
/* Copy the comment */
|
||||
|
||||
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
|
||||
if (zend_multibyte_encoding_converter(
|
||||
(unsigned char**)&xp_field->value,
|
||||
&xp_field->size,
|
||||
@@ -2709,7 +2711,7 @@ static int exif_process_unicode(image_info_type *ImageInfo, xp_field_type *xp_fi
|
||||
ByteCount,
|
||||
zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC),
|
||||
zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? ImageInfo->decode_unicode_be : ImageInfo->decode_unicode_le TSRMLS_CC)
|
||||
TSRMLS_CC) < 0) {
|
||||
TSRMLS_CC) == (size_t)-1) {
|
||||
xp_field->size = exif_process_string_raw(&xp_field->value, szValuePtr, ByteCount);
|
||||
}
|
||||
return xp_field->size;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
|
||||
<html><head>
|
||||
<title>301 Moved Permanently</title>
|
||||
</head><body>
|
||||
<h1>Moved Permanently</h1>
|
||||
<p>The document has moved <a href="http://www.getid3.org/temp/62523.jpg">here</a>.</p>
|
||||
<hr>
|
||||
<address>Apache Server at getid3.org Port 80</address>
|
||||
</body></html>
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug 62523 (php crashes with segfault when exif_read_data called)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
extension_loaded("exif") or die("skip need exif");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo "Test\n";
|
||||
var_dump(count(exif_read_data(__DIR__."/bug62523_1.jpg")));
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
Test
|
||||
|
||||
Warning: exif_read_data(bug62523_1.jpg): File not supported in %sbug62523_1.php on line %d
|
||||
int(1)
|
||||
Done
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 504 KiB |
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug 62523 (php crashes with segfault when exif_read_data called)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
extension_loaded("exif") or die("skip need exif");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo "Test\n";
|
||||
var_dump(count(exif_read_data(__DIR__."/bug62523_2.jpg")));
|
||||
?>
|
||||
Done
|
||||
--EXPECT--
|
||||
Test
|
||||
int(76)
|
||||
Done
|
||||
@@ -0,0 +1,12 @@
|
||||
<html>
|
||||
<head><title>Found</title></head>
|
||||
<body>
|
||||
<h1>Found</h1>
|
||||
<p>The resource was found at <a href="http://dl.dropboxusercontent.com/u/7562584/Bugs/Php/bad_exif.jpeg">http://dl.dropboxusercontent.com/u/7562584/Bugs/Php/bad_exif.jpeg</a>;
|
||||
you should be redirected automatically.
|
||||
|
||||
<!-- --></p>
|
||||
<hr noshade>
|
||||
<div align="right">WSGI Server</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug 62523 (php crashes with segfault when exif_read_data called)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
extension_loaded("exif") or die("skip need exif");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo "Test\n";
|
||||
var_dump(count(exif_read_data(__DIR__."/bug62523_3.jpg")));
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
Test
|
||||
|
||||
Warning: exif_read_data(bug62523_3.jpg): File not supported in %sbug62523_3.php on line %d
|
||||
int(1)
|
||||
Done
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.4 KiB |
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
PHP crash when zend_multibyte_encoding_converter returns (size_t)-1)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
$infile = dirname(__FILE__).'/exif_encoding_crash.jpg';
|
||||
$exif_data = exif_read_data($infile);
|
||||
echo "*** no core dump ***\n";
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
*** no core dump ***
|
||||
===DONE===
|
||||
@@ -714,7 +714,7 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||
if (flags & FILTER_FLAG_NO_RES_RANGE) {
|
||||
if (
|
||||
(ip[0] == 0) ||
|
||||
(ip[0] == 100 && (ip[1] >= 64 || ip[1] <= 127)) ||
|
||||
(ip[0] == 100 && (ip[1] >= 64 && ip[1] <= 127)) ||
|
||||
(ip[0] == 128 && ip[1] == 0) ||
|
||||
(ip[0] == 191 && ip[1] == 255) ||
|
||||
(ip[0] == 169 && ip[1] == 254) ||
|
||||
|
||||
@@ -15,7 +15,7 @@ var_dump(filter_var("192.168.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE
|
||||
var_dump(filter_var("192.0.34.166", FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE));
|
||||
var_dump(filter_var("127.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
|
||||
var_dump(filter_var("192.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
|
||||
var_dump(filter_var("100.0.0.0", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
|
||||
var_dump(filter_var("100.64.0.0", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
|
||||
var_dump(filter_var("100.127.255.255", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
|
||||
var_dump(filter_var("192.0.34.166", FILTER_VALIDATE_IP));
|
||||
var_dump(filter_var("256.1237.123.1", FILTER_VALIDATE_IP));
|
||||
|
||||
+4
-4
@@ -630,7 +630,7 @@ ftp_alloc(ftpbuf_t *ftp, const long size, char **response)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (response && ftp->inbuf) {
|
||||
if (response) {
|
||||
*response = estrdup(ftp->inbuf);
|
||||
}
|
||||
|
||||
@@ -1638,7 +1638,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
if (ftp->resp == 226) {
|
||||
ftp->data = data_close(ftp, data);
|
||||
php_stream_close(tmpstream);
|
||||
return ecalloc(1, sizeof(char**));
|
||||
return ecalloc(1, sizeof(char*));
|
||||
}
|
||||
|
||||
/* pull data buffer into tmpfile */
|
||||
@@ -1666,11 +1666,11 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
}
|
||||
}
|
||||
|
||||
ftp->data = data = data_close(ftp, data);
|
||||
ftp->data = data_close(ftp, data);
|
||||
|
||||
php_stream_rewind(tmpstream);
|
||||
|
||||
ret = safe_emalloc((lines + 1), sizeof(char**), size * sizeof(char*));
|
||||
ret = safe_emalloc((lines + 1), sizeof(char*), size);
|
||||
|
||||
entry = ret;
|
||||
text = (char*) (ret + lines + 1);
|
||||
|
||||
@@ -16,7 +16,7 @@ ftp_login($ftp, 'user', 'pass');
|
||||
if (!$ftp) die("Couldn't connect to the server");
|
||||
ftp_set_option($ftp, FTP_AUTOSEEK, false);
|
||||
|
||||
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
|
||||
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic1.txt";
|
||||
$handle = fopen($local_file, 'w');
|
||||
|
||||
var_dump(ftp_fget($ftp, $handle, 'fget.txt', FTP_ASCII, FTP_AUTORESUME));
|
||||
@@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file));
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
|
||||
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic1.txt");
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
|
||||
@@ -15,7 +15,7 @@ $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";
|
||||
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic2.txt";
|
||||
file_put_contents($local_file, 'ASCIIFoo');
|
||||
$handle = fopen($local_file, 'a');
|
||||
|
||||
@@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file));
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
|
||||
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic2.txt");
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
|
||||
@@ -15,7 +15,7 @@ $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";
|
||||
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic3.txt";
|
||||
file_put_contents($local_file, 'ASCIIFoo');
|
||||
$handle = fopen($local_file, 'a');
|
||||
|
||||
@@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file));
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
|
||||
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic3.txt");
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
|
||||
@@ -16,7 +16,7 @@ ftp_login($ftp, 'user', 'pass');
|
||||
if (!$ftp) die("Couldn't connect to the server");
|
||||
ftp_set_option($ftp, FTP_AUTOSEEK, false);
|
||||
|
||||
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
|
||||
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic1.txt";
|
||||
$handle = fopen($local_file, 'w');
|
||||
|
||||
var_dump(ftp_nb_fget($ftp, $handle, 'fget.txt', FTP_ASCII, FTP_AUTORESUME));
|
||||
@@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file));
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
|
||||
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic1.txt");
|
||||
?>
|
||||
--EXPECT--
|
||||
int(2)
|
||||
|
||||
@@ -15,7 +15,7 @@ $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";
|
||||
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic2.txt";
|
||||
file_put_contents($local_file, 'ASCIIFoo');
|
||||
$handle = fopen($local_file, 'a');
|
||||
|
||||
@@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file));
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
|
||||
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic2.txt");
|
||||
?>
|
||||
--EXPECT--
|
||||
int(2)
|
||||
|
||||
@@ -15,7 +15,7 @@ $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";
|
||||
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic3.txt";
|
||||
file_put_contents($local_file, 'ASCIIFoo');
|
||||
$handle = fopen($local_file, 'a');
|
||||
|
||||
@@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file));
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
|
||||
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic3.txt");
|
||||
?>
|
||||
--EXPECT--
|
||||
int(2)
|
||||
|
||||
@@ -18,7 +18,7 @@ $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";
|
||||
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_get_large.txt";
|
||||
touch($local_file);
|
||||
ftp_nb_get($ftp, $local_file, 'fget_large.txt', FTP_BINARY, 5368709119);
|
||||
$fp = fopen($local_file, 'r');
|
||||
@@ -29,7 +29,7 @@ fclose($fp);
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
|
||||
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_get_large.txt");
|
||||
?>
|
||||
--EXPECT--
|
||||
string(1) "X"
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@
|
||||
|
||||
PHPAPI extern const char php_sig_gif[3];
|
||||
PHPAPI extern const char php_sig_jpg[3];
|
||||
PHPAPI extern const char php_sig_png[3];
|
||||
PHPAPI extern const char php_sig_png[8];
|
||||
|
||||
extern zend_module_entry gd_module_entry;
|
||||
#define phpext_gd_ptr &gd_module_entry
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/* {{{ */
|
||||
static void collator_ctor(INTERNAL_FUNCTION_PARAMETERS)
|
||||
{
|
||||
char* locale;
|
||||
const char* locale;
|
||||
int locale_len = 0;
|
||||
zval* object;
|
||||
Collator_object* co;
|
||||
|
||||
@@ -62,7 +62,7 @@ static void internal_parse_to_timestamp(IntlDateFormatter_object *dfo, char* tex
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_value, UCalendar parsed_calendar, long calendar_field, char* key_name TSRMLS_DC)
|
||||
static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_value, const UCalendar *parsed_calendar, long calendar_field, char* key_name TSRMLS_DC)
|
||||
{
|
||||
long calendar_field_val = ucal_get( parsed_calendar, calendar_field, &INTL_DATA_ERROR_CODE(dfo));
|
||||
INTL_METHOD_CHECK_STATUS( dfo, "Date parsing - localtime failed : could not get a field from calendar" );
|
||||
@@ -83,7 +83,7 @@ static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_va
|
||||
*/
|
||||
static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* text_to_parse, int32_t text_len, int32_t *parse_pos, zval *return_value TSRMLS_DC)
|
||||
{
|
||||
UCalendar* parsed_calendar = NULL;
|
||||
UCalendar *parsed_calendar = NULL;
|
||||
UChar* text_utf16 = NULL;
|
||||
int32_t text_utf16_len = 0;
|
||||
long isInDST = 0;
|
||||
@@ -92,7 +92,7 @@ static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* tex
|
||||
intl_convert_utf8_to_utf16(&text_utf16, &text_utf16_len, text_to_parse, text_len, &INTL_DATA_ERROR_CODE(dfo));
|
||||
INTL_METHOD_CHECK_STATUS(dfo, "Error converting timezone to UTF-16" );
|
||||
|
||||
parsed_calendar = udat_getCalendar(DATE_FORMAT_OBJECT(dfo));
|
||||
parsed_calendar = (UCalendar *)udat_getCalendar(DATE_FORMAT_OBJECT(dfo));
|
||||
udat_parseCalendar( DATE_FORMAT_OBJECT(dfo), parsed_calendar, text_utf16, text_utf16_len, parse_pos, &INTL_DATA_ERROR_CODE(dfo));
|
||||
|
||||
if (text_utf16) {
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/* {{{ */
|
||||
static void numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
|
||||
{
|
||||
char* locale;
|
||||
const char* locale;
|
||||
char* pattern = NULL;
|
||||
int locale_len = 0, pattern_len = 0;
|
||||
long style;
|
||||
|
||||
@@ -121,12 +121,15 @@ static int16_t findOffset(const char* const* list, const char* key)
|
||||
}
|
||||
/*}}}*/
|
||||
|
||||
static char* getPreferredTag(char* gf_tag)
|
||||
static char* getPreferredTag(const char* gf_tag)
|
||||
{
|
||||
char* result = NULL;
|
||||
int grOffset = 0;
|
||||
|
||||
grOffset = findOffset( LOC_GRANDFATHERED ,gf_tag);
|
||||
if(grOffset < 0) {
|
||||
return NULL;
|
||||
}
|
||||
if( grOffset < LOC_PREFERRED_GRANDFATHERED_LEN ){
|
||||
/* return preferred tag */
|
||||
result = estrdup( LOC_PREFERRED_GRANDFATHERED[grOffset] );
|
||||
@@ -172,7 +175,7 @@ static int getStrrtokenPos(char* str, int savedPos)
|
||||
* returns -1 if no singleton
|
||||
* strtok equivalent search for singleton
|
||||
*/
|
||||
static int getSingletonPos(char* str)
|
||||
static int getSingletonPos(const char* str)
|
||||
{
|
||||
int result =-1;
|
||||
int i=0;
|
||||
@@ -248,7 +251,7 @@ PHP_NAMED_FUNCTION(zif_locale_set_default)
|
||||
* common code shared by get_primary_language,get_script or get_region or get_variant
|
||||
* result = 0 if error, 1 if successful , -1 if no value
|
||||
*/
|
||||
static char* get_icu_value_internal( char* loc_name , char* tag_name, int* result , int fromParseLocale)
|
||||
static char* get_icu_value_internal( const char* loc_name , char* tag_name, int* result , int fromParseLocale)
|
||||
{
|
||||
char* tag_value = NULL;
|
||||
int32_t tag_value_len = 512;
|
||||
@@ -278,7 +281,7 @@ static char* get_icu_value_internal( char* loc_name , char* tag_name, int* resul
|
||||
/* Handle singletons */
|
||||
if( strcmp(tag_name , LOC_LANG_TAG)==0 ){
|
||||
if( strlen(loc_name)>1 && (isIDPrefix(loc_name) ==1 ) ){
|
||||
return loc_name;
|
||||
return (char *)loc_name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,7 +370,7 @@ static char* get_icu_value_internal( char* loc_name , char* tag_name, int* resul
|
||||
static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS)
|
||||
{
|
||||
|
||||
char* loc_name = NULL;
|
||||
const char* loc_name = NULL;
|
||||
int loc_name_len = 0;
|
||||
|
||||
char* tag_value = NULL;
|
||||
@@ -462,10 +465,10 @@ PHP_FUNCTION(locale_get_primary_language )
|
||||
}}} */
|
||||
static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS)
|
||||
{
|
||||
char* loc_name = NULL;
|
||||
const char* loc_name = NULL;
|
||||
int loc_name_len = 0;
|
||||
|
||||
char* disp_loc_name = NULL;
|
||||
const char* disp_loc_name = NULL;
|
||||
int disp_loc_name_len = 0;
|
||||
int free_loc_name = 0;
|
||||
|
||||
@@ -558,7 +561,7 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME
|
||||
efree( mod_loc_name );
|
||||
}
|
||||
if (free_loc_name) {
|
||||
efree(disp_loc_name);
|
||||
efree((void *)disp_loc_name);
|
||||
disp_loc_name = NULL;
|
||||
}
|
||||
RETURN_FALSE;
|
||||
@@ -569,7 +572,7 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME
|
||||
efree( mod_loc_name );
|
||||
}
|
||||
if (free_loc_name) {
|
||||
efree(disp_loc_name);
|
||||
efree((void *)disp_loc_name);
|
||||
disp_loc_name = NULL;
|
||||
}
|
||||
/* Convert display locale name from UTF-16 to UTF-8. */
|
||||
@@ -663,10 +666,10 @@ PHP_FUNCTION( locale_get_keywords )
|
||||
UEnumeration* e = NULL;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
const char* kw_key = NULL;
|
||||
const char* kw_key = NULL;
|
||||
int32_t kw_key_len = 0;
|
||||
|
||||
char* loc_name = NULL;
|
||||
const char* loc_name = NULL;
|
||||
int loc_name_len = 0;
|
||||
|
||||
/*
|
||||
@@ -713,7 +716,7 @@ PHP_FUNCTION( locale_get_keywords )
|
||||
kw_value = erealloc( kw_value , kw_value_len+1);
|
||||
}
|
||||
if (U_FAILURE(status)) {
|
||||
intl_error_set( NULL, FAILURE, "locale_get_keywords: Error encountered while getting the keyword value for the keyword", 0 TSRMLS_CC );
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "locale_get_keywords: Error encountered while getting the keyword value for the keyword", 0 TSRMLS_CC );
|
||||
if( kw_value){
|
||||
efree( kw_value );
|
||||
}
|
||||
@@ -971,12 +974,12 @@ PHP_FUNCTION(locale_compose)
|
||||
* e.g. for locale='en_US-x-prv1-prv2-prv3'
|
||||
* returns a pointer to the string 'prv1-prv2-prv3'
|
||||
*/
|
||||
static char* get_private_subtags(char* loc_name)
|
||||
static char* get_private_subtags(const char* loc_name)
|
||||
{
|
||||
char* result =NULL;
|
||||
int singletonPos = 0;
|
||||
int len =0;
|
||||
char* mod_loc_name =NULL;
|
||||
const char* mod_loc_name =NULL;
|
||||
|
||||
if( loc_name && (len = strlen(loc_name)>0 ) ){
|
||||
mod_loc_name = loc_name ;
|
||||
@@ -1016,7 +1019,7 @@ static char* get_private_subtags(char* loc_name)
|
||||
|
||||
/* {{{ code used by locale_parse
|
||||
*/
|
||||
static int add_array_entry(char* loc_name, zval* hash_arr, char* key_name TSRMLS_DC)
|
||||
static int add_array_entry(const char* loc_name, zval* hash_arr, char* key_name TSRMLS_DC)
|
||||
{
|
||||
char* key_value = NULL;
|
||||
char* cur_key_name = NULL;
|
||||
@@ -1081,7 +1084,7 @@ static int add_array_entry(char* loc_name, zval* hash_arr, char* key_name TSRMLS
|
||||
*/
|
||||
PHP_FUNCTION(locale_parse)
|
||||
{
|
||||
char* loc_name = NULL;
|
||||
const char* loc_name = NULL;
|
||||
int loc_name_len = 0;
|
||||
int grOffset = 0;
|
||||
|
||||
@@ -1125,8 +1128,8 @@ PHP_FUNCTION(locale_parse)
|
||||
*/
|
||||
PHP_FUNCTION(locale_get_all_variants)
|
||||
{
|
||||
char* loc_name = NULL;
|
||||
int loc_name_len = 0;
|
||||
const char* loc_name = NULL;
|
||||
int loc_name_len = 0;
|
||||
|
||||
int result = 0;
|
||||
char* token = NULL;
|
||||
@@ -1179,10 +1182,10 @@ PHP_FUNCTION(locale_get_all_variants)
|
||||
/*{{{
|
||||
* Converts to lower case and also replaces all hyphens with the underscore
|
||||
*/
|
||||
static int strToMatch(char* str ,char *retstr)
|
||||
static int strToMatch(const char* str ,char *retstr)
|
||||
{
|
||||
char* anchor = NULL;
|
||||
char* anchor1 = NULL;
|
||||
const char* anchor1 = NULL;
|
||||
int result = 0;
|
||||
int len = 0;
|
||||
|
||||
@@ -1222,7 +1225,7 @@ PHP_FUNCTION(locale_filter_matches)
|
||||
{
|
||||
char* lang_tag = NULL;
|
||||
int lang_tag_len = 0;
|
||||
char* loc_range = NULL;
|
||||
const char* loc_range = NULL;
|
||||
int loc_range_len = 0;
|
||||
|
||||
int result = 0;
|
||||
@@ -1398,7 +1401,7 @@ static void array_cleanup( char* arr[] , int arr_size)
|
||||
* returns the lookup result to lookup_loc_range_src_php
|
||||
* internal function
|
||||
*/
|
||||
static char* lookup_loc_range(char* loc_range, HashTable* hash_arr, int canonicalize TSRMLS_DC)
|
||||
static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int canonicalize TSRMLS_DC)
|
||||
{
|
||||
int i = 0;
|
||||
int cur_arr_len = 0;
|
||||
@@ -1520,7 +1523,7 @@ PHP_FUNCTION(locale_lookup)
|
||||
{
|
||||
char* fallback_loc = NULL;
|
||||
int fallback_loc_len = 0;
|
||||
char* loc_range = NULL;
|
||||
const char* loc_range = NULL;
|
||||
int loc_range_len = 0;
|
||||
|
||||
zval* arr = NULL;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
/* {{{ */
|
||||
static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
|
||||
{
|
||||
char* locale;
|
||||
const char* locale;
|
||||
char* pattern;
|
||||
int locale_len = 0, pattern_len = 0;
|
||||
UChar* spattern = NULL;
|
||||
|
||||
@@ -103,7 +103,7 @@ PHP_FUNCTION( msgfmt_format_message )
|
||||
int spattern_len = 0;
|
||||
char *pattern = NULL;
|
||||
int pattern_len = 0;
|
||||
char *slocale = NULL;
|
||||
const char *slocale = NULL;
|
||||
int slocale_len = 0;
|
||||
MessageFormatter_object mf = {0};
|
||||
MessageFormatter_object *mfo = &mf;
|
||||
|
||||
@@ -209,6 +209,9 @@ static HashTable *umsg_parse_format(MessageFormatter_object *mfo,
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
intl_errors_set(&err, U_INVALID_FORMAT_ERROR, "Invalid part type encountered", 0 TSRMLS_CC);
|
||||
continue;
|
||||
}
|
||||
|
||||
UMessagePatternArgType argType = p.getArgType();
|
||||
|
||||
@@ -93,7 +93,7 @@ PHP_FUNCTION( msgfmt_parse_message )
|
||||
int spattern_len = 0;
|
||||
char *pattern = NULL;
|
||||
int pattern_len = 0;
|
||||
char *slocale = NULL;
|
||||
const char *slocale = NULL;
|
||||
int slocale_len = 0;
|
||||
char *source = NULL;
|
||||
int src_len = 0;
|
||||
|
||||
+22
-8
@@ -695,21 +695,35 @@ PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len,
|
||||
double d;
|
||||
int type, overflow_info;
|
||||
long p;
|
||||
char *trim = str;
|
||||
int trim_len = str_len;
|
||||
|
||||
/* Increment trimmed string pointer to strip leading whitespace */
|
||||
/* JSON RFC says to consider as whitespace: space, tab, LF or CR */
|
||||
while (trim_len && (*trim == ' ' || *trim == '\t' || *trim == '\n' || *trim == '\r')) {
|
||||
trim++;
|
||||
trim_len--;
|
||||
}
|
||||
|
||||
/* Decrement trimmed string length to strip trailing whitespace */
|
||||
while (trim_len && (trim[trim_len - 1] == ' ' || trim[trim_len - 1] == '\t' || trim[trim_len - 1] == '\n' || trim[trim_len - 1] == '\r')) {
|
||||
trim_len--;
|
||||
}
|
||||
|
||||
RETVAL_NULL();
|
||||
if (str_len == 4) {
|
||||
if (!strcasecmp(str, "null")) {
|
||||
if (trim_len == 4) {
|
||||
if (!strncasecmp(trim, "null", trim_len)) {
|
||||
/* We need to explicitly clear the error because its an actual NULL and not an error */
|
||||
jp->error_code = PHP_JSON_ERROR_NONE;
|
||||
RETVAL_NULL();
|
||||
} else if (!strcasecmp(str, "true")) {
|
||||
} else if (!strncasecmp(trim, "true", trim_len)) {
|
||||
RETVAL_BOOL(1);
|
||||
}
|
||||
} else if (str_len == 5 && !strcasecmp(str, "false")) {
|
||||
} else if (trim_len == 5 && !strncasecmp(trim, "false", trim_len)) {
|
||||
RETVAL_BOOL(0);
|
||||
}
|
||||
|
||||
if ((type = is_numeric_string_ex(str, str_len, &p, &d, 0, &overflow_info)) != 0) {
|
||||
if ((type = is_numeric_string_ex(trim, trim_len, &p, &d, 0, &overflow_info)) != 0) {
|
||||
if (type == IS_LONG) {
|
||||
RETVAL_LONG(p);
|
||||
} else if (type == IS_DOUBLE) {
|
||||
@@ -722,10 +736,10 @@ PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len,
|
||||
int i;
|
||||
zend_bool is_float = 0;
|
||||
|
||||
for (i = (str[0] == '-' ? 1 : 0); i < str_len; i++) {
|
||||
for (i = (trim[0] == '-' ? 1 : 0); i < trim_len; i++) {
|
||||
/* Not using isdigit() because it's locale specific,
|
||||
* but we expect JSON input to always be UTF-8. */
|
||||
if (str[i] < '0' || str[i] > '9') {
|
||||
if (trim[i] < '0' || trim[i] > '9') {
|
||||
is_float = 1;
|
||||
break;
|
||||
}
|
||||
@@ -734,7 +748,7 @@ PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len,
|
||||
if (is_float) {
|
||||
RETVAL_DOUBLE(d);
|
||||
} else {
|
||||
RETVAL_STRINGL(str, str_len, 1);
|
||||
RETVAL_STRINGL(trim, trim_len, 1);
|
||||
}
|
||||
} else {
|
||||
RETVAL_DOUBLE(d);
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
--TEST--
|
||||
Whitespace part of bug #64874 ("json_decode handles whitespace and case-sensitivity incorrectly")
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("json")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
function decode($json) {
|
||||
var_dump(json_decode($json));
|
||||
var_dump(json_last_error() !== 0);
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
// Leading whitespace should be ignored
|
||||
decode(" true");
|
||||
decode("\ttrue");
|
||||
decode("\ntrue");
|
||||
decode("\rtrue");
|
||||
|
||||
// So should trailing whitespace
|
||||
decode("true ");
|
||||
decode("true\t");
|
||||
decode("true\n");
|
||||
decode("true\r");
|
||||
|
||||
// And so should the combination of both
|
||||
decode(" true ");
|
||||
decode(" true\t");
|
||||
decode(" true\n");
|
||||
decode(" true\r");
|
||||
decode("\ttrue ");
|
||||
decode("\ttrue\t");
|
||||
decode("\ttrue\n");
|
||||
decode("\ttrue\r");
|
||||
decode("\ntrue ");
|
||||
decode("\ntrue\t");
|
||||
decode("\ntrue\n");
|
||||
decode("\ntrue\r");
|
||||
decode("\rtrue ");
|
||||
decode("\rtrue\t");
|
||||
decode("\rtrue\n");
|
||||
decode("\rtrue\r");
|
||||
|
||||
echo "Done\n";
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
Done
|
||||
@@ -142,7 +142,7 @@ const struct mbfl_convert_vtbl vtbl_wchar_2022jp_kddi = {
|
||||
int
|
||||
mbfl_filt_conv_2022jp_mobile_wchar(int c, mbfl_convert_filter *filter)
|
||||
{
|
||||
int c1, s, w, snd;
|
||||
int c1, s, w, snd = 0;
|
||||
|
||||
retry:
|
||||
switch (filter->status & 0xf) {
|
||||
|
||||
@@ -134,7 +134,7 @@ int
|
||||
mbfl_filt_conv_jis2004_wchar(int c, mbfl_convert_filter *filter)
|
||||
{
|
||||
int k;
|
||||
int c1, c2, s, s1, s2, w = 0, w1;
|
||||
int c1, c2, s, s1 = 0, s2 = 0, w = 0, w1;
|
||||
|
||||
retry:
|
||||
switch (filter->status & 0xf) {
|
||||
|
||||
@@ -605,7 +605,7 @@ mbfilter_unicode2sjis_emoji_sb(int c, int *s1, mbfl_convert_filter *filter)
|
||||
int
|
||||
mbfl_filt_conv_sjis_mobile_wchar(int c, mbfl_convert_filter *filter)
|
||||
{
|
||||
int c1, s, s1, s2, w;
|
||||
int c1, s, s1 = 0, s2 = 0, w;
|
||||
int snd = 0;
|
||||
|
||||
retry:
|
||||
|
||||
@@ -985,7 +985,7 @@ mbfl_strpos(
|
||||
{
|
||||
int result;
|
||||
mbfl_string _haystack_u8, _needle_u8;
|
||||
const mbfl_string *haystack_u8, *needle_u8;
|
||||
const mbfl_string *haystack_u8, *needle_u8 = NULL;
|
||||
const unsigned char *u8_tbl;
|
||||
|
||||
if (haystack == NULL || haystack->val == NULL || needle == NULL || needle->val == NULL) {
|
||||
|
||||
@@ -385,7 +385,7 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval ***args, unsigned int argc,
|
||||
/* Changed to my_bool in MySQL 5.1. See MySQL Bug #16144 */
|
||||
my_bool tmp;
|
||||
#else
|
||||
uint tmp = 0;
|
||||
ulong tmp = 0;
|
||||
#endif
|
||||
stmt->result.buf[ofs].type = IS_STRING;
|
||||
/*
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Bug #66043 (Segfault calling bind_param() on mysqli)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once("connect.inc");
|
||||
if ($IS_MYSQLND) {
|
||||
die("skip libmysql only test");
|
||||
}
|
||||
require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require 'connect.inc';
|
||||
$db = new mysqli($host, $user, $passwd, 'mysql');
|
||||
|
||||
$stmt = $db->stmt_init();
|
||||
$stmt->prepare("SELECT User FROM user WHERE password=\"\"");
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($testArg);
|
||||
echo "Okey";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Okey
|
||||
@@ -0,0 +1,101 @@
|
||||
--TEST--
|
||||
Bug #66124 (mysqli under mysqlnd loses precision when bind_param with 'i')
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('connect.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$table_drop = "DROP TABLE IF EXISTS `bug66124`";
|
||||
$table_create = "CREATE TABLE `bug66124` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8";
|
||||
|
||||
$table_insert = "INSERT INTO `bug66124` SET `id`=?";
|
||||
$table_select = "SELECT * FROM `bug66124`";
|
||||
$table_delete = "DELETE FROM `bug66124`";
|
||||
$id = '1311200011005001566';
|
||||
|
||||
|
||||
require_once('connect.inc');
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||
printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
|
||||
$host, $user, $db, $port, $socket);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$link->query($table_drop);
|
||||
$link->query($table_create);
|
||||
|
||||
$stmt = $link->prepare($table_insert);
|
||||
if (!$stmt) {
|
||||
printf("Can't prepare\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo "Using 'i':\n";
|
||||
$stmt->bind_param('i', $id);
|
||||
|
||||
if ($stmt->execute()){
|
||||
echo "insert id:{$id}=>{$stmt->insert_id}\n";
|
||||
} else {
|
||||
printf("Can't execute\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
$result = $link->query($table_select);
|
||||
|
||||
if ($result){
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
echo "fetch id:{$row['id']}\n";
|
||||
}
|
||||
} else {
|
||||
printf("Can't select\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$stmt->close();
|
||||
|
||||
$link->query($table_drop);
|
||||
$link->query($table_create);
|
||||
|
||||
|
||||
$stmt = $link->prepare($table_insert);
|
||||
$stmt->bind_param('s', $id);
|
||||
|
||||
echo "Using 's':\n";
|
||||
|
||||
if ($stmt->execute()){
|
||||
echo "insert id:{$id}\n";
|
||||
} else{
|
||||
printf("Can't execute\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$result = $link->query($table_select);
|
||||
|
||||
if ($result){
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
echo "fetch id:{$row['id']}\n";
|
||||
}
|
||||
} else {
|
||||
printf("Can't select\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$link->close();
|
||||
?>
|
||||
done
|
||||
--EXPECTF--
|
||||
Using 'i':
|
||||
insert id:1311200011005001566=>1311200011005001566
|
||||
fetch id:1311200011005001566
|
||||
Using 's':
|
||||
insert id:1311200011005001566
|
||||
fetch id:1311200011005001566
|
||||
done
|
||||
@@ -257,6 +257,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, simple_command_handle_response)(MYSQLND_CONN_D
|
||||
conn->persistent);
|
||||
|
||||
if (!ignore_upsert_status) {
|
||||
memset(conn->upsert_status, 0, sizeof(*conn->upsert_status));
|
||||
conn->upsert_status->warning_count = ok_response->warning_count;
|
||||
conn->upsert_status->server_status = ok_response->server_status;
|
||||
conn->upsert_status->affected_rows = ok_response->affected_rows;
|
||||
@@ -319,6 +320,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, simple_command_send_request)(MYSQLND_CONN_DATA
|
||||
|
||||
DBG_ENTER("mysqlnd_conn_data::simple_command_send_request");
|
||||
DBG_INF_FMT("command=%s silent=%u", mysqlnd_command_to_text[command], silent);
|
||||
DBG_INF_FMT("conn->server_status=%u", conn->upsert_status->server_status);
|
||||
|
||||
switch (CONN_GET_STATE(conn)) {
|
||||
case CONN_READY:
|
||||
@@ -333,10 +335,6 @@ MYSQLND_METHOD(mysqlnd_conn_data, simple_command_send_request)(MYSQLND_CONN_DATA
|
||||
DBG_RETURN(FAIL);
|
||||
}
|
||||
|
||||
/* clean UPSERT info */
|
||||
if (!ignore_upsert_status) {
|
||||
memset(conn->upsert_status, 0, sizeof(*conn->upsert_status));
|
||||
}
|
||||
SET_ERROR_AFF_ROWS(conn);
|
||||
SET_EMPTY_ERROR(*conn->error_info);
|
||||
|
||||
@@ -557,7 +555,7 @@ mysqlnd_run_authentication(
|
||||
|
||||
if (!auth_plugin) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The server requested authentication method unknown to the client [%s]", requested_protocol);
|
||||
SET_CLIENT_ERROR(*conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, "The server requested authentication method umknown to the client");
|
||||
SET_CLIENT_ERROR(*conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, "The server requested authentication method unknown to the client");
|
||||
goto end;
|
||||
}
|
||||
DBG_INF("plugin found");
|
||||
@@ -811,6 +809,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect_handshake)(MYSQLND_CONN_DATA * conn,
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
memset(conn->upsert_status, 0, sizeof(*conn->upsert_status));
|
||||
conn->upsert_status->warning_count = 0;
|
||||
conn->upsert_status->server_status = greet_packet->server_status;
|
||||
conn->upsert_status->affected_rows = 0;
|
||||
@@ -1183,6 +1182,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, send_query)(MYSQLND_CONN_DATA * conn, const ch
|
||||
enum_func_status ret = FAIL;
|
||||
DBG_ENTER("mysqlnd_conn_data::send_query");
|
||||
DBG_INF_FMT("conn=%llu query=%s", conn->thread_id, query);
|
||||
DBG_INF_FMT("conn->server_status=%u", conn->upsert_status->server_status);
|
||||
|
||||
if (PASS == conn->m->local_tx_start(conn, this_func TSRMLS_CC)) {
|
||||
ret = conn->m->simple_command(conn, COM_QUERY, (zend_uchar *) query, query_len,
|
||||
@@ -1193,6 +1193,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, send_query)(MYSQLND_CONN_DATA * conn, const ch
|
||||
}
|
||||
conn->m->local_tx_end(conn, this_func, ret TSRMLS_CC);
|
||||
}
|
||||
DBG_INF_FMT("conn->server_status=%u", conn->upsert_status->server_status);
|
||||
DBG_RETURN(ret);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1208,6 +1209,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, reap_query)(MYSQLND_CONN_DATA * conn TSRMLS_DC
|
||||
DBG_ENTER("mysqlnd_conn_data::reap_query");
|
||||
DBG_INF_FMT("conn=%llu", conn->thread_id);
|
||||
|
||||
DBG_INF_FMT("conn->server_status=%u", conn->upsert_status->server_status);
|
||||
if (PASS == conn->m->local_tx_start(conn, this_func TSRMLS_CC)) {
|
||||
if (state <= CONN_READY || state == CONN_QUIT_SENT) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Connection not opened, clear or has been closed");
|
||||
@@ -1218,6 +1220,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, reap_query)(MYSQLND_CONN_DATA * conn TSRMLS_DC
|
||||
|
||||
conn->m->local_tx_end(conn, this_func, ret TSRMLS_CC);
|
||||
}
|
||||
DBG_INF_FMT("conn->server_status=%u", conn->upsert_status->server_status);
|
||||
DBG_RETURN(ret);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1603,6 +1606,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, escape_string)(MYSQLND_CONN_DATA * const conn,
|
||||
DBG_INF_FMT("conn=%llu", conn->thread_id);
|
||||
|
||||
if (PASS == conn->m->local_tx_start(conn, this_func TSRMLS_CC)) {
|
||||
DBG_INF_FMT("server_status=%u", conn->upsert_status->server_status);
|
||||
if (conn->upsert_status->server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES) {
|
||||
ret = mysqlnd_cset_escape_quotes(conn->charset, newstr, escapestr, escapestr_len TSRMLS_CC);
|
||||
} else {
|
||||
@@ -2247,7 +2251,6 @@ MYSQLND_METHOD(mysqlnd_conn_data, change_user)(MYSQLND_CONN_DATA * const conn,
|
||||
}
|
||||
if (!db) {
|
||||
db = "";
|
||||
|
||||
}
|
||||
|
||||
/* XXX: passwords that have \0 inside work during auth, but in this case won't work with change user */
|
||||
|
||||
@@ -486,6 +486,7 @@ mysqlnd_stmt_execute_parse_response(MYSQLND_STMT * const s TSRMLS_DC)
|
||||
ret = mysqlnd_query_read_result_set_header(stmt->conn, s TSRMLS_CC);
|
||||
if (ret == FAIL) {
|
||||
COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info);
|
||||
memset(stmt->upsert_status, 0, sizeof(*stmt->upsert_status));
|
||||
stmt->upsert_status->affected_rows = conn->upsert_status->affected_rows;
|
||||
if (CONN_GET_STATE(conn) == CONN_QUIT_SENT) {
|
||||
/* close the statement here, the connection has been closed */
|
||||
@@ -905,6 +906,7 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES *result, void *param, unsigned int
|
||||
DBG_INF("EOF");
|
||||
/* Mark the connection as usable again */
|
||||
result->unbuf->eof_reached = TRUE;
|
||||
memset(result->conn->upsert_status, 0, sizeof(*result->conn->upsert_status));
|
||||
result->conn->upsert_status->warning_count = row_packet->warning_count;
|
||||
result->conn->upsert_status->server_status = row_packet->server_status;
|
||||
/*
|
||||
@@ -1014,6 +1016,7 @@ mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES *result, void *param, unsigned int fla
|
||||
|
||||
row_packet->skip_extraction = stmt->result_bind? FALSE:TRUE;
|
||||
|
||||
memset(stmt->upsert_status, 0, sizeof(*stmt->upsert_status));
|
||||
if (PASS == (ret = PACKET_READ(row_packet, result->conn)) && !row_packet->eof) {
|
||||
unsigned int i, field_count = result->field_count;
|
||||
|
||||
|
||||
@@ -569,9 +569,8 @@ mysqlnd_stmt_execute_store_params(MYSQLND_STMT * s, zend_uchar **buf, zend_uchar
|
||||
occur, and force resend for the next execution.
|
||||
*/
|
||||
for (i = 0; i < stmt->param_count; i++) {
|
||||
if (Z_TYPE_P(stmt->param_bind[i].zv) != IS_NULL &&
|
||||
(stmt->param_bind[i].type == MYSQL_TYPE_LONG || stmt->param_bind[i].type == MYSQL_TYPE_LONGLONG))
|
||||
{
|
||||
short current_type = stmt->param_bind[i].type;
|
||||
if (Z_TYPE_P(stmt->param_bind[i].zv) != IS_NULL && (current_type == MYSQL_TYPE_LONG || current_type == MYSQL_TYPE_LONGLONG)) {
|
||||
/* always copy the var, because we do many conversions */
|
||||
if (Z_TYPE_P(stmt->param_bind[i].zv) != IS_LONG &&
|
||||
PASS != mysqlnd_stmt_copy_it(&copies, stmt->param_bind[i].zv, stmt->param_count, i TSRMLS_CC))
|
||||
@@ -585,10 +584,31 @@ mysqlnd_stmt_execute_store_params(MYSQLND_STMT * s, zend_uchar **buf, zend_uchar
|
||||
*/
|
||||
if (Z_TYPE_P(stmt->param_bind[i].zv) != IS_LONG) {
|
||||
zval *tmp_data = (copies && copies[i])? copies[i]: stmt->param_bind[i].zv;
|
||||
convert_to_double_ex(&tmp_data);
|
||||
if (Z_DVAL_P(tmp_data) > LONG_MAX || Z_DVAL_P(tmp_data) < LONG_MIN) {
|
||||
/*
|
||||
Because converting to double and back to long can lead
|
||||
to losing precision we need second variable. Conversion to double is to see if
|
||||
value is too big for a long. As said, precision could be lost.
|
||||
*/
|
||||
zval *tmp_data_copy;
|
||||
MAKE_STD_ZVAL(tmp_data_copy);
|
||||
*tmp_data_copy = *tmp_data;
|
||||
Z_SET_REFCOUNT_P(tmp_data_copy, 1);
|
||||
zval_copy_ctor(tmp_data_copy);
|
||||
convert_to_double_ex(&tmp_data_copy);
|
||||
|
||||
/*
|
||||
if it doesn't fit in a long send it as a string.
|
||||
Check bug #52891 : Wrong data inserted with mysqli/mysqlnd when using bind_param, value > LONG_MAX
|
||||
We do transformation here, which will be used later when sending types. The code later relies on this.
|
||||
*/
|
||||
if (Z_DVAL_P(tmp_data_copy) > LONG_MAX || Z_DVAL_P(tmp_data_copy) < LONG_MIN) {
|
||||
stmt->send_types_to_server = resend_types_next_time = 1;
|
||||
convert_to_string_ex(&tmp_data);
|
||||
} else {
|
||||
convert_to_long_ex(&tmp_data);
|
||||
}
|
||||
|
||||
zval_ptr_dtor(&tmp_data_copy);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -631,10 +651,11 @@ mysqlnd_stmt_execute_store_params(MYSQLND_STMT * s, zend_uchar **buf, zend_uchar
|
||||
*/
|
||||
if (Z_TYPE_P(stmt->param_bind[i].zv) != IS_LONG) {
|
||||
zval *tmp_data = (copies && copies[i])? copies[i]: stmt->param_bind[i].zv;
|
||||
|
||||
convert_to_double_ex(&tmp_data);
|
||||
if (Z_DVAL_P(tmp_data) > LONG_MAX || Z_DVAL_P(tmp_data) < LONG_MIN) {
|
||||
convert_to_string_ex(&tmp_data);
|
||||
/*
|
||||
In case of IS_LONG we do nothing, it is ok, in case of string, we just need to set current_type.
|
||||
The actual transformation has been performed several dozens line above.
|
||||
*/
|
||||
if (Z_TYPE_P(tmp_data) == IS_STRING) {
|
||||
current_type = MYSQL_TYPE_VAR_STRING;
|
||||
/*
|
||||
don't change stmt->param_bind[i].type to MYSQL_TYPE_VAR_STRING
|
||||
@@ -642,8 +663,6 @@ mysqlnd_stmt_execute_store_params(MYSQLND_STMT * s, zend_uchar **buf, zend_uchar
|
||||
if the type is however not long, then we will do a goto in the next switch.
|
||||
We want to preserve the original bind type given by the user. Thus, we do these hacks.
|
||||
*/
|
||||
} else {
|
||||
convert_to_long_ex(&tmp_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -415,6 +415,7 @@ mysqlnd_query_read_result_set_header(MYSQLND_CONN_DATA * conn, MYSQLND_STMT * s
|
||||
DBG_INF("UPSERT");
|
||||
conn->last_query_type = QUERY_UPSERT;
|
||||
conn->field_count = rset_header->field_count;
|
||||
memset(conn->upsert_status, 0, sizeof(*conn->upsert_status));
|
||||
conn->upsert_status->warning_count = rset_header->warning_count;
|
||||
conn->upsert_status->server_status = rset_header->server_status;
|
||||
conn->upsert_status->affected_rows = rset_header->affected_rows;
|
||||
@@ -702,6 +703,7 @@ mysqlnd_fetch_row_unbuffered_c(MYSQLND_RES * result TSRMLS_DC)
|
||||
/* Mark the connection as usable again */
|
||||
DBG_INF_FMT("warnings=%u server_status=%u", row_packet->warning_count, row_packet->server_status);
|
||||
result->unbuf->eof_reached = TRUE;
|
||||
memset(result->conn->upsert_status, 0, sizeof(*result->conn->upsert_status));
|
||||
result->conn->upsert_status->warning_count = row_packet->warning_count;
|
||||
result->conn->upsert_status->server_status = row_packet->server_status;
|
||||
/*
|
||||
@@ -828,6 +830,7 @@ mysqlnd_fetch_row_unbuffered(MYSQLND_RES * result, void *param, unsigned int fla
|
||||
/* Mark the connection as usable again */
|
||||
DBG_INF_FMT("warnings=%u server_status=%u", row_packet->warning_count, row_packet->server_status);
|
||||
result->unbuf->eof_reached = TRUE;
|
||||
memset(result->conn->upsert_status, 0, sizeof(*result->conn->upsert_status));
|
||||
result->conn->upsert_status->warning_count = row_packet->warning_count;
|
||||
result->conn->upsert_status->server_status = row_packet->server_status;
|
||||
/*
|
||||
@@ -1175,6 +1178,7 @@ MYSQLND_METHOD(mysqlnd_res, store_result_fetch_data)(MYSQLND_CONN_DATA * const c
|
||||
|
||||
/* Finally clean */
|
||||
if (row_packet->eof) {
|
||||
memset(conn->upsert_status, 0, sizeof(*conn->upsert_status));
|
||||
conn->upsert_status->warning_count = row_packet->warning_count;
|
||||
conn->upsert_status->server_status = row_packet->server_status;
|
||||
}
|
||||
|
||||
@@ -827,6 +827,7 @@ php_mysqlnd_ok_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC)
|
||||
packet->error, sizeof(packet->error),
|
||||
&packet->error_no, packet->sqlstate
|
||||
TSRMLS_CC);
|
||||
DBG_INF_FMT("conn->server_status=%u", conn->upsert_status->server_status);
|
||||
DBG_RETURN(PASS);
|
||||
}
|
||||
/* Everything was fine! */
|
||||
@@ -1069,6 +1070,7 @@ php_mysqlnd_rset_header_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC)
|
||||
packet->error_info.error, sizeof(packet->error_info.error),
|
||||
&packet->error_info.error_no, packet->error_info.sqlstate
|
||||
TSRMLS_CC);
|
||||
DBG_INF_FMT("conn->server_status=%u", conn->upsert_status->server_status);
|
||||
DBG_RETURN(PASS);
|
||||
}
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ typedef struct odbc_connection {
|
||||
} odbc_connection;
|
||||
|
||||
typedef struct odbc_result_value {
|
||||
char name[32];
|
||||
char name[256];
|
||||
char *value;
|
||||
SQLLEN vallen;
|
||||
SQLLEN coltype;
|
||||
|
||||
@@ -643,8 +643,11 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
|
||||
opline->opcode != ZEND_FREE
|
||||
) {
|
||||
zend_op *src = VAR_SOURCE(opline->op1);
|
||||
zval c = ZEND_OP1_LITERAL(src);
|
||||
VAR_UNSET(opline->op1);
|
||||
COPY_NODE(opline->op1, src->op1);
|
||||
zval_copy_ctor(&c);
|
||||
update_op1_const(op_array, opline, &c TSRMLS_CC);
|
||||
literal_dtor(&ZEND_OP1_LITERAL(src));
|
||||
MAKE_NOP(src);
|
||||
}
|
||||
|
||||
@@ -654,51 +657,12 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
|
||||
VAR_SOURCE(opline->op2)->opcode == ZEND_QM_ASSIGN &&
|
||||
ZEND_OP1_TYPE(VAR_SOURCE(opline->op2)) == IS_CONST) {
|
||||
zend_op *src = VAR_SOURCE(opline->op2);
|
||||
zval c = ZEND_OP1_LITERAL(src);
|
||||
VAR_UNSET(opline->op2);
|
||||
COPY_NODE(opline->op2, src->op1);
|
||||
zval_copy_ctor(&c);
|
||||
update_op2_const(op_array, opline, &c TSRMLS_CC);
|
||||
literal_dtor(&ZEND_OP1_LITERAL(src));
|
||||
MAKE_NOP(src);
|
||||
|
||||
#if ZEND_EXTENSION_API_NO >= PHP_5_4_X_API_NO
|
||||
/* numeric string constants used as array indeces have to be
|
||||
converted to long at compile time */
|
||||
if (opline->opcode == ZEND_ADD_ARRAY_ELEMENT ||
|
||||
opline->opcode == ZEND_INIT_ARRAY ||
|
||||
opline->opcode == ZEND_UNSET_DIM ||
|
||||
opline->opcode == ZEND_ISSET_ISEMPTY_DIM_OBJ ||
|
||||
opline->opcode == ZEND_FETCH_DIM_R ||
|
||||
opline->opcode == ZEND_FETCH_DIM_W ||
|
||||
opline->opcode == ZEND_FETCH_DIM_RW ||
|
||||
opline->opcode == ZEND_FETCH_DIM_IS ||
|
||||
opline->opcode == ZEND_FETCH_DIM_FUNC_ARG ||
|
||||
opline->opcode == ZEND_FETCH_DIM_UNSET ||
|
||||
opline->opcode == ZEND_FETCH_DIM_TMP_VAR ||
|
||||
(opline->opcode == ZEND_OP_DATA &&
|
||||
((opline-1)->opcode == ZEND_ASSIGN_DIM ||
|
||||
((opline-1)->extended_value == ZEND_ASSIGN_DIM &&
|
||||
((opline-1)->opcode == ZEND_ASSIGN_ADD ||
|
||||
(opline-1)->opcode == ZEND_ASSIGN_SUB ||
|
||||
(opline-1)->opcode == ZEND_ASSIGN_MUL ||
|
||||
(opline-1)->opcode == ZEND_ASSIGN_DIV ||
|
||||
(opline-1)->opcode == ZEND_ASSIGN_MOD ||
|
||||
(opline-1)->opcode == ZEND_ASSIGN_SL ||
|
||||
(opline-1)->opcode == ZEND_ASSIGN_SR ||
|
||||
(opline-1)->opcode == ZEND_ASSIGN_CONCAT ||
|
||||
(opline-1)->opcode == ZEND_ASSIGN_BW_OR ||
|
||||
(opline-1)->opcode == ZEND_ASSIGN_BW_AND ||
|
||||
(opline-1)->opcode == ZEND_ASSIGN_BW_XOR))))) {
|
||||
|
||||
if (Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) {
|
||||
ulong index;
|
||||
int numeric = 0;
|
||||
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline))+1, index, numeric = 1);
|
||||
if (numeric) {
|
||||
zval_dtor(&ZEND_OP2_LITERAL(opline));
|
||||
ZVAL_LONG(&ZEND_OP2_LITERAL(opline), index);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* T = PRINT(X), F(T) => ECHO(X), F(1) */
|
||||
@@ -1070,10 +1034,9 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
|
||||
|
||||
literal_dtor(&ZEND_OP1_LITERAL(opline));
|
||||
literal_dtor(&ZEND_OP2_LITERAL(opline));
|
||||
ZEND_OP1_LITERAL(opline) = result;
|
||||
SET_UNUSED(opline->op2);
|
||||
|
||||
opline->opcode = ZEND_QM_ASSIGN;
|
||||
SET_UNUSED(opline->op2);
|
||||
update_op1_const(op_array, opline, &result TSRMLS_CC);
|
||||
}
|
||||
EG(error_reporting) = er;
|
||||
} else if ((opline->opcode == ZEND_BOOL ||
|
||||
@@ -1097,8 +1060,8 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
|
||||
}
|
||||
PZ_SET_REFCOUNT_P(&result, 1);
|
||||
PZ_UNSET_ISREF_P(&result);
|
||||
ZEND_OP1_LITERAL(opline) = result;
|
||||
opline->opcode = ZEND_QM_ASSIGN;
|
||||
update_op1_const(op_array, opline, &result TSRMLS_CC);
|
||||
} else if ((opline->opcode == ZEND_RETURN || opline->opcode == ZEND_EXIT) &&
|
||||
ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
|
||||
VAR_SOURCE(opline->op1) &&
|
||||
|
||||
@@ -219,15 +219,11 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
|
||||
EG(in_execution) = 1;
|
||||
EG(active_op_array) = op_array;
|
||||
if (zend_get_constant("__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1, &offset TSRMLS_CC)) {
|
||||
zend_uint tv = ZEND_RESULT(opline).var;
|
||||
|
||||
literal_dtor(&ZEND_OP2_LITERAL(opline));
|
||||
ZEND_OP1_TYPE(opline) = IS_CONST;
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
|
||||
opline->op1.constant = zend_optimizer_add_literal(op_array, &offset TSRMLS_CC);
|
||||
#else
|
||||
ZEND_OP1_LITERAL(opline) = offset;
|
||||
#endif
|
||||
SET_UNUSED(opline->op2);
|
||||
opline->opcode = ZEND_QM_ASSIGN;
|
||||
MAKE_NOP(opline);
|
||||
replace_tmp_by_const(op_array, opline, tv, &offset TSRMLS_CC);
|
||||
}
|
||||
EG(active_op_array) = orig_op_array;
|
||||
EG(in_execution) = orig_in_execution;
|
||||
@@ -238,20 +234,15 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
|
||||
ZEND_OP2_TYPE(opline) == IS_CONST &&
|
||||
ZEND_OP2_LITERAL(opline).type == IS_STRING) {
|
||||
/* substitute persistent constants */
|
||||
zend_uint tv = ZEND_RESULT(opline).var;
|
||||
zval c;
|
||||
|
||||
if (!zend_get_persistent_constant(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), &c, 1 TSRMLS_CC)) {
|
||||
break;
|
||||
}
|
||||
literal_dtor(&ZEND_OP2_LITERAL(opline));
|
||||
ZEND_OP1_TYPE(opline) = IS_CONST;
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
|
||||
opline->op1.constant = zend_optimizer_add_literal(op_array, &c TSRMLS_CC);
|
||||
#else
|
||||
ZEND_OP1_LITERAL(opline) = c;
|
||||
#endif
|
||||
SET_UNUSED(opline->op2);
|
||||
opline->opcode = ZEND_QM_ASSIGN;
|
||||
MAKE_NOP(opline);
|
||||
replace_tmp_by_const(op_array, opline, tv, &c TSRMLS_CC);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "php.h"
|
||||
#include "Optimizer/zend_optimizer.h"
|
||||
#include "Optimizer/zend_optimizer_internal.h"
|
||||
#include "zend_API.h"
|
||||
@@ -110,6 +111,167 @@ int zend_optimizer_add_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC
|
||||
|
||||
#endif
|
||||
|
||||
static void update_op1_const(zend_op_array *op_array,
|
||||
zend_op *opline,
|
||||
zval *val TSRMLS_DC)
|
||||
{
|
||||
if (opline->opcode == ZEND_FREE) {
|
||||
MAKE_NOP(opline);
|
||||
zval_dtor(val);
|
||||
} else {
|
||||
ZEND_OP1_TYPE(opline) = IS_CONST;
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
|
||||
if (Z_TYPE_P(val) == IS_STRING) {
|
||||
switch (opline->opcode) {
|
||||
case ZEND_INIT_STATIC_METHOD_CALL:
|
||||
case ZEND_CATCH:
|
||||
case ZEND_FETCH_CONSTANT:
|
||||
opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1);
|
||||
op_array->literals[opline->op1.constant].cache_slot = op_array->last_cache_slot++;
|
||||
zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
op_array->literals[opline->op1.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op1.constant+1].constant), Z_STRLEN(op_array->literals[opline->op1.constant+1].constant) + 1);
|
||||
break;
|
||||
case ZEND_DO_FCALL:
|
||||
zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1);
|
||||
op_array->literals[opline->op1.constant].cache_slot = op_array->last_cache_slot++;
|
||||
break;
|
||||
default:
|
||||
opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
}
|
||||
#else
|
||||
ZEND_OP1_LITERAL(opline) = *val;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static void update_op2_const(zend_op_array *op_array,
|
||||
zend_op *opline,
|
||||
zval *val TSRMLS_DC)
|
||||
{
|
||||
ZEND_OP2_TYPE(opline) = IS_CONST;
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
|
||||
opline->op2.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
if (Z_TYPE_P(val) == IS_STRING) {
|
||||
Z_HASH_P(&ZEND_OP2_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)) + 1);
|
||||
switch (opline->opcode) {
|
||||
case ZEND_FETCH_R:
|
||||
case ZEND_FETCH_W:
|
||||
case ZEND_FETCH_RW:
|
||||
case ZEND_FETCH_IS:
|
||||
case ZEND_FETCH_UNSET:
|
||||
case ZEND_FETCH_FUNC_ARG:
|
||||
case ZEND_FETCH_CLASS:
|
||||
case ZEND_INIT_FCALL_BY_NAME:
|
||||
/*case ZEND_INIT_NS_FCALL_BY_NAME:*/
|
||||
case ZEND_UNSET_VAR:
|
||||
case ZEND_ISSET_ISEMPTY_VAR:
|
||||
case ZEND_ADD_INTERFACE:
|
||||
case ZEND_ADD_TRAIT:
|
||||
op_array->literals[opline->op2.constant].cache_slot = op_array->last_cache_slot++;
|
||||
zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
op_array->literals[opline->op2.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op2.constant+1].constant), Z_STRLEN(op_array->literals[opline->op2.constant+1].constant) + 1);
|
||||
break;
|
||||
case ZEND_INIT_METHOD_CALL:
|
||||
case ZEND_INIT_STATIC_METHOD_CALL:
|
||||
zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
op_array->literals[opline->op2.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op2.constant+1].constant), Z_STRLEN(op_array->literals[opline->op2.constant+1].constant) + 1);
|
||||
/* break missing intentionally */
|
||||
/*case ZEND_FETCH_CONSTANT:*/
|
||||
case ZEND_ASSIGN_OBJ:
|
||||
case ZEND_FETCH_OBJ_R:
|
||||
case ZEND_FETCH_OBJ_W:
|
||||
case ZEND_FETCH_OBJ_RW:
|
||||
case ZEND_FETCH_OBJ_IS:
|
||||
case ZEND_FETCH_OBJ_UNSET:
|
||||
case ZEND_FETCH_OBJ_FUNC_ARG:
|
||||
case ZEND_UNSET_OBJ:
|
||||
case ZEND_PRE_INC_OBJ:
|
||||
case ZEND_PRE_DEC_OBJ:
|
||||
case ZEND_POST_INC_OBJ:
|
||||
case ZEND_POST_DEC_OBJ:
|
||||
case ZEND_ISSET_ISEMPTY_PROP_OBJ:
|
||||
op_array->literals[opline->op2.constant].cache_slot = op_array->last_cache_slot;
|
||||
op_array->last_cache_slot += 2;
|
||||
break;
|
||||
case ZEND_ASSIGN_ADD:
|
||||
case ZEND_ASSIGN_SUB:
|
||||
case ZEND_ASSIGN_MUL:
|
||||
case ZEND_ASSIGN_DIV:
|
||||
case ZEND_ASSIGN_MOD:
|
||||
case ZEND_ASSIGN_SL:
|
||||
case ZEND_ASSIGN_SR:
|
||||
case ZEND_ASSIGN_CONCAT:
|
||||
case ZEND_ASSIGN_BW_OR:
|
||||
case ZEND_ASSIGN_BW_AND:
|
||||
case ZEND_ASSIGN_BW_XOR:
|
||||
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
|
||||
op_array->literals[opline->op2.constant].cache_slot = op_array->last_cache_slot;
|
||||
op_array->last_cache_slot += 2;
|
||||
}
|
||||
break;
|
||||
#if ZEND_EXTENSION_API_NO >= PHP_5_4_X_API_NO
|
||||
case ZEND_OP_DATA:
|
||||
if ((opline-1)->opcode == ZEND_ASSIGN_DIM ||
|
||||
((opline-1)->extended_value == ZEND_ASSIGN_DIM &&
|
||||
((opline-1)->opcode == ZEND_ASSIGN_ADD ||
|
||||
(opline-1)->opcode == ZEND_ASSIGN_SUB ||
|
||||
(opline-1)->opcode == ZEND_ASSIGN_MUL ||
|
||||
(opline-1)->opcode == ZEND_ASSIGN_DIV ||
|
||||
(opline-1)->opcode == ZEND_ASSIGN_MOD ||
|
||||
(opline-1)->opcode == ZEND_ASSIGN_SL ||
|
||||
(opline-1)->opcode == ZEND_ASSIGN_SR ||
|
||||
(opline-1)->opcode == ZEND_ASSIGN_CONCAT ||
|
||||
(opline-1)->opcode == ZEND_ASSIGN_BW_OR ||
|
||||
(opline-1)->opcode == ZEND_ASSIGN_BW_AND ||
|
||||
(opline-1)->opcode == ZEND_ASSIGN_BW_XOR))) {
|
||||
goto check_numeric;
|
||||
}
|
||||
break;
|
||||
case ZEND_ISSET_ISEMPTY_DIM_OBJ:
|
||||
case ZEND_ADD_ARRAY_ELEMENT:
|
||||
case ZEND_INIT_ARRAY:
|
||||
case ZEND_UNSET_DIM:
|
||||
case ZEND_FETCH_DIM_R:
|
||||
case ZEND_FETCH_DIM_W:
|
||||
case ZEND_FETCH_DIM_RW:
|
||||
case ZEND_FETCH_DIM_IS:
|
||||
case ZEND_FETCH_DIM_FUNC_ARG:
|
||||
case ZEND_FETCH_DIM_UNSET:
|
||||
case ZEND_FETCH_DIM_TMP_VAR:
|
||||
check_numeric:
|
||||
{
|
||||
ulong index;
|
||||
int numeric = 0;
|
||||
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(val), Z_STRLEN_P(val)+1, index, numeric = 1);
|
||||
if (numeric) {
|
||||
zval_dtor(val);
|
||||
ZVAL_LONG(val, index);
|
||||
op_array->literals[opline->op2.constant].constant = *val;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
ZEND_OP2_LITERAL(opline) = *val;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void replace_tmp_by_const(zend_op_array *op_array,
|
||||
zend_op *opline,
|
||||
zend_uint var,
|
||||
@@ -122,42 +284,7 @@ static void replace_tmp_by_const(zend_op_array *op_array,
|
||||
if (ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
|
||||
ZEND_OP1(opline).var == var) {
|
||||
|
||||
if (opline->opcode == ZEND_FREE) {
|
||||
MAKE_NOP(opline);
|
||||
zval_dtor(val);
|
||||
} else {
|
||||
ZEND_OP1_TYPE(opline) = IS_CONST;
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
|
||||
if (Z_TYPE_P(val) == IS_STRING) {
|
||||
switch (opline->opcode) {
|
||||
case ZEND_INIT_STATIC_METHOD_CALL:
|
||||
case ZEND_CATCH:
|
||||
case ZEND_FETCH_CONSTANT:
|
||||
opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1);
|
||||
op_array->literals[opline->op1.constant].cache_slot = op_array->last_cache_slot++;
|
||||
zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
op_array->literals[opline->op1.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op1.constant+1].constant), Z_STRLEN(op_array->literals[opline->op1.constant+1].constant) + 1);
|
||||
break;
|
||||
case ZEND_DO_FCALL:
|
||||
zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1);
|
||||
op_array->literals[opline->op1.constant].cache_slot = op_array->last_cache_slot++;
|
||||
break;
|
||||
default:
|
||||
opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
}
|
||||
#else
|
||||
ZEND_OP1_LITERAL(opline) = *val;
|
||||
#endif
|
||||
}
|
||||
update_op1_const(op_array, opline, val TSRMLS_CC);
|
||||
/* TMP_VAR my be used only once */
|
||||
break;
|
||||
}
|
||||
@@ -165,76 +292,8 @@ static void replace_tmp_by_const(zend_op_array *op_array,
|
||||
if (ZEND_OP2_TYPE(opline) == IS_TMP_VAR &&
|
||||
ZEND_OP2(opline).var == var) {
|
||||
|
||||
ZEND_OP2_TYPE(opline) = IS_CONST;
|
||||
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
|
||||
opline->op2.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
if (Z_TYPE_P(val) == IS_STRING) {
|
||||
Z_HASH_P(&ZEND_OP2_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)) + 1);
|
||||
switch (opline->opcode) {
|
||||
case ZEND_FETCH_R:
|
||||
case ZEND_FETCH_W:
|
||||
case ZEND_FETCH_RW:
|
||||
case ZEND_FETCH_IS:
|
||||
case ZEND_FETCH_UNSET:
|
||||
case ZEND_FETCH_FUNC_ARG:
|
||||
case ZEND_FETCH_CLASS:
|
||||
case ZEND_INIT_FCALL_BY_NAME:
|
||||
/*case ZEND_INIT_NS_FCALL_BY_NAME:*/
|
||||
case ZEND_UNSET_VAR:
|
||||
case ZEND_ISSET_ISEMPTY_VAR:
|
||||
case ZEND_ADD_INTERFACE:
|
||||
case ZEND_ADD_TRAIT:
|
||||
op_array->literals[opline->op2.constant].cache_slot = op_array->last_cache_slot++;
|
||||
zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
op_array->literals[opline->op2.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op2.constant+1].constant), Z_STRLEN(op_array->literals[opline->op2.constant+1].constant) + 1);
|
||||
break;
|
||||
case ZEND_INIT_METHOD_CALL:
|
||||
case ZEND_INIT_STATIC_METHOD_CALL:
|
||||
zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
op_array->literals[opline->op2.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op2.constant+1].constant), Z_STRLEN(op_array->literals[opline->op2.constant+1].constant) + 1);
|
||||
/* break missing intentionally */
|
||||
/*case ZEND_FETCH_CONSTANT:*/
|
||||
case ZEND_ASSIGN_OBJ:
|
||||
case ZEND_FETCH_OBJ_R:
|
||||
case ZEND_FETCH_OBJ_W:
|
||||
case ZEND_FETCH_OBJ_RW:
|
||||
case ZEND_FETCH_OBJ_IS:
|
||||
case ZEND_FETCH_OBJ_UNSET:
|
||||
case ZEND_FETCH_OBJ_FUNC_ARG:
|
||||
case ZEND_UNSET_OBJ:
|
||||
case ZEND_PRE_INC_OBJ:
|
||||
case ZEND_PRE_DEC_OBJ:
|
||||
case ZEND_POST_INC_OBJ:
|
||||
case ZEND_POST_DEC_OBJ:
|
||||
case ZEND_ISSET_ISEMPTY_PROP_OBJ:
|
||||
op_array->literals[opline->op2.constant].cache_slot = op_array->last_cache_slot;
|
||||
op_array->last_cache_slot += 2;
|
||||
break;
|
||||
case ZEND_ASSIGN_ADD:
|
||||
case ZEND_ASSIGN_SUB:
|
||||
case ZEND_ASSIGN_MUL:
|
||||
case ZEND_ASSIGN_DIV:
|
||||
case ZEND_ASSIGN_MOD:
|
||||
case ZEND_ASSIGN_SL:
|
||||
case ZEND_ASSIGN_SR:
|
||||
case ZEND_ASSIGN_CONCAT:
|
||||
case ZEND_ASSIGN_BW_OR:
|
||||
case ZEND_ASSIGN_BW_AND:
|
||||
case ZEND_ASSIGN_BW_XOR:
|
||||
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
|
||||
op_array->literals[opline->op2.constant].cache_slot = op_array->last_cache_slot;
|
||||
op_array->last_cache_slot += 2;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
ZEND_OP2_LITERAL(opline) = *val;
|
||||
#endif
|
||||
update_op2_const(op_array, opline, val TSRMLS_CC);
|
||||
/* TMP_VAR my be used only once */
|
||||
break;
|
||||
}
|
||||
opline++;
|
||||
|
||||
+10
-4
@@ -31,8 +31,8 @@ Quick Install
|
||||
|
||||
zend_extension=/...full path.../opcache.so
|
||||
|
||||
NOTE: In case you are going to use Zend OPcache together with Xdebug,
|
||||
be sure that Xdebug is loaded after OPcache. "php -v" must show Xdebug
|
||||
NOTE: In case you are going to use Zend OPcache together with Xdebug or Zend Debugger,
|
||||
be sure that the debugger is loaded after OPcache. "php -v" must show the debugger
|
||||
after OPcache.
|
||||
|
||||
- Restart PHP
|
||||
@@ -80,8 +80,8 @@ opcache.max_accelerated_files (default "2000")
|
||||
The maximum number of keys (scripts) in the OPcache hash table.
|
||||
The number is actually the first one in the following set of prime
|
||||
numbers that is bigger than the one supplied: { 223, 463, 983, 1979, 3907,
|
||||
7963, 16229, 32531, 65407, 130987 }. Only numbers between 200 and 100000
|
||||
are allowed.
|
||||
7963, 16229, 32531, 65407, 130987, 262237, 524521, 1048793 }. Only numbers
|
||||
between 200 and 1000000 are allowed.
|
||||
|
||||
opcache.max_wasted_percentage (default "5")
|
||||
The maximum percentage of "wasted" memory until a restart is scheduled.
|
||||
@@ -103,6 +103,12 @@ opcache.revalidate_freq (default "2")
|
||||
memory storage allocation. ("1" means validate once per second, but only
|
||||
once per request. "0" means always validate)
|
||||
|
||||
opcache.file_update_protection (default "2")
|
||||
Prevents caching files that are less than this number of seconds old.
|
||||
It protects from caching of incompletely updated files. In case all file
|
||||
updates on your site are atomic, you may increase performance setting it
|
||||
to "0".
|
||||
|
||||
opcache.revalidate_path (default "0")
|
||||
Enables or disables file search in include_path optimization
|
||||
If the file search is disabled and a cached file is found that uses
|
||||
|
||||
@@ -1196,6 +1196,8 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
|
||||
/* store script structure in the hash table */
|
||||
bucket = zend_accel_hash_update(&ZCSG(hash), new_persistent_script->full_path, new_persistent_script->full_path_len + 1, 0, new_persistent_script);
|
||||
if (bucket &&
|
||||
/* key may contain non-persistent PHAR aliases (see issues #115 and #149) */
|
||||
memcmp(key, "phar://", sizeof("phar://") - 1) != 0 &&
|
||||
(new_persistent_script->full_path_len != key_length ||
|
||||
memcmp(new_persistent_script->full_path, key, key_length) != 0)) {
|
||||
/* link key to the same persistent script in hash table */
|
||||
@@ -1329,7 +1331,9 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ZCG(accel_directives).validate_timestamps || ZCG(accel_directives).max_file_size > 0) {
|
||||
if (ZCG(accel_directives).validate_timestamps ||
|
||||
ZCG(accel_directives).file_update_protection ||
|
||||
ZCG(accel_directives).max_file_size > 0) {
|
||||
size_t size = 0;
|
||||
|
||||
/* Obtain the file timestamps, *before* actually compiling them,
|
||||
@@ -1345,6 +1349,13 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* check if file is too new (may be it's not written completely yet) */
|
||||
if (ZCG(accel_directives).file_update_protection &&
|
||||
(ZCG(request_time) - ZCG(accel_directives).file_update_protection < timestamp)) {
|
||||
*op_array_p = accelerator_orig_compile_file(file_handle, type TSRMLS_CC);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ZCG(accel_directives).max_file_size > 0 && size > (size_t)ZCG(accel_directives).max_file_size) {
|
||||
ZCSG(blacklist_misses)++;
|
||||
*op_array_p = accelerator_orig_compile_file(file_handle, type TSRMLS_CC);
|
||||
@@ -1651,7 +1662,18 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T
|
||||
#endif
|
||||
void *dummy = (void *) 1;
|
||||
|
||||
zend_hash_quick_add(&EG(included_files), persistent_script->full_path, persistent_script->full_path_len + 1, persistent_script->hash_value, &dummy, sizeof(void *), NULL);
|
||||
if (zend_hash_quick_add(&EG(included_files), persistent_script->full_path, persistent_script->full_path_len + 1, persistent_script->hash_value, &dummy, sizeof(void *), NULL) == SUCCESS) {
|
||||
/* ext/phar has to load phar's metadata into memory */
|
||||
if (strstr(persistent_script->full_path, ".phar") && !strstr(persistent_script->full_path, "://")) {
|
||||
php_stream_statbuf ssb;
|
||||
char *fname = emalloc(sizeof("phar://") + persistent_script->full_path_len);
|
||||
|
||||
memcpy(fname, "phar://", sizeof("phar://") - 1);
|
||||
memcpy(fname + sizeof("phar://") - 1, persistent_script->full_path, persistent_script->full_path_len + 1);
|
||||
php_stream_stat_path(fname, &ssb);
|
||||
efree(fname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
|
||||
@@ -2708,6 +2730,7 @@ void zend_accel_schedule_restart(zend_accel_restart_reason reason TSRMLS_DC)
|
||||
}
|
||||
zend_accel_error(ACCEL_LOG_DEBUG, "Restart Scheduled!");
|
||||
|
||||
SHM_UNPROTECT();
|
||||
ZCSG(restart_pending) = 1;
|
||||
ZCSG(restart_reason) = reason;
|
||||
ZCSG(cache_status_before_restart) = ZCSG(accelerator_enabled);
|
||||
@@ -2718,6 +2741,7 @@ void zend_accel_schedule_restart(zend_accel_restart_reason reason TSRMLS_DC)
|
||||
} else {
|
||||
ZCSG(force_restart_time) = 0;
|
||||
}
|
||||
SHM_PROTECT();
|
||||
}
|
||||
|
||||
/* this is needed because on WIN32 lock is not decreased unless ZCG(counted) is set */
|
||||
|
||||
@@ -229,6 +229,7 @@ typedef struct _zend_accel_directives {
|
||||
zend_bool inherited_hack;
|
||||
zend_bool enable_cli;
|
||||
unsigned long revalidate_freq;
|
||||
unsigned long file_update_protection;
|
||||
char *error_log;
|
||||
#ifdef ZEND_WIN32
|
||||
char *mmap_base;
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #65559 (cache not cleared if changes occur while running)
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.file_update_protection=2
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$file = __DIR__ . "/bug6559.inc.php";
|
||||
file_put_contents($file, '<?php return 1;');
|
||||
$var = include $file;
|
||||
var_dump($var);
|
||||
file_put_contents($file, '<?php return 2;');
|
||||
$var = include $file;
|
||||
var_dump($var);
|
||||
@unlink($file);
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
int(2)
|
||||
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Bug #65915 (Inconsistent results with require return value)
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$tmp = __DIR__ . "/bug65915.inc.php";
|
||||
|
||||
file_put_contents($tmp, '<?php return function(){ return "a";};');
|
||||
$f = require $tmp;
|
||||
var_dump($f());
|
||||
|
||||
opcache_invalidate($tmp, true);
|
||||
|
||||
file_put_contents($tmp, '<?php return function(){ return "b";};');
|
||||
$f = require $tmp;
|
||||
var_dump($f());
|
||||
|
||||
@unlink($tmp);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(1) "a"
|
||||
string(1) "b"
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #66176 (Invalid constant substitution)
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.optimization_level=-1
|
||||
opcache.file_update_protection=0
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
function foo($v) {
|
||||
global $a;
|
||||
return $a[$v];
|
||||
}
|
||||
$a = array(PHP_VERSION => 1);
|
||||
var_dump(foo(PHP_VERSION));
|
||||
--EXPECT--
|
||||
int(1)
|
||||
@@ -0,0 +1,48 @@
|
||||
--TEST--
|
||||
ISSUE #115 (path issue when using phar)
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$stub = '<?php
|
||||
Phar::interceptFileFuncs();
|
||||
require "phar://this/index.php";
|
||||
__HALT_COMPILER(); ?>';
|
||||
$p = new Phar(__DIR__ . '/issue0115_1.phar.php', 0, 'this');
|
||||
$p['index.php'] = '<?php
|
||||
echo "Hello from Index 1.\n";
|
||||
require_once "phar://this/hello.php";
|
||||
';
|
||||
$p['hello.php'] = "Hello World 1!\n";
|
||||
$p->setStub($stub);
|
||||
unset($p);
|
||||
$p = new Phar(__DIR__ . '/issue0115_2.phar.php', 0, 'this');
|
||||
$p['index.php'] = '<?php
|
||||
echo "Hello from Index 2.\n";
|
||||
require_once "phar://this/hello.php";
|
||||
';
|
||||
$p['hello.php'] = "Hello World 2!\n";
|
||||
$p->setStub($stub);
|
||||
unset($p);
|
||||
|
||||
include "php_cli_server.inc";
|
||||
php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1');
|
||||
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0115_1.phar.php');
|
||||
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0115_2.phar.php');
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__ . '/issue0115_1.phar.php');
|
||||
@unlink(__DIR__ . '/issue0115_2.phar.php');
|
||||
?>
|
||||
--EXPECT--
|
||||
Hello from Index 1.
|
||||
Hello World 1!
|
||||
Hello from Index 2.
|
||||
Hello World 2!
|
||||
@@ -0,0 +1,35 @@
|
||||
--TEST--
|
||||
ISSUE #149 (Phar mount points not working this OPcache enabled)
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$stub = "<?php header('Content-Type: text/plain;');
|
||||
Phar::mount('this.file', '". __FILE__ . "');
|
||||
echo 'OK\n';
|
||||
__HALT_COMPILER(); ?>";
|
||||
$p = new Phar(__DIR__ . '/issue0149.phar.php', 0, 'this');
|
||||
$p['index.php'] = ""; # A Phar must have at least one file, hence this dummy
|
||||
$p->setStub($stub);
|
||||
unset($p);
|
||||
|
||||
include "php_cli_server.inc";
|
||||
php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1');
|
||||
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0149.phar.php');
|
||||
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0149.phar.php');
|
||||
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0149.phar.php');
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__ . '/issue0149.phar.php');
|
||||
?>
|
||||
--EXPECT--
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
define ("PHP_CLI_SERVER_HOSTNAME", "localhost");
|
||||
define ("PHP_CLI_SERVER_PORT", 8964);
|
||||
define ("PHP_CLI_SERVER_ADDRESS", PHP_CLI_SERVER_HOSTNAME.":".PHP_CLI_SERVER_PORT);
|
||||
|
||||
function php_cli_server_start($ini = "") {
|
||||
$php_executable = getenv('TEST_PHP_EXECUTABLE');
|
||||
$doc_root = __DIR__;
|
||||
|
||||
$descriptorspec = array(
|
||||
0 => STDIN,
|
||||
1 => STDOUT,
|
||||
2 => STDERR,
|
||||
);
|
||||
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
$cmd = "{$php_executable} -t {$doc_root} $ini -S " . PHP_CLI_SERVER_ADDRESS;
|
||||
$handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array("bypass_shell" => true, "suppress_errors" => true));
|
||||
} else {
|
||||
$cmd = "exec {$php_executable} -t {$doc_root} $ini -S " . PHP_CLI_SERVER_ADDRESS . " 2>/dev/null";
|
||||
$handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root);
|
||||
}
|
||||
|
||||
// note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.'
|
||||
// it might not be listening yet...need to wait until fsockopen() call returns
|
||||
$i = 0;
|
||||
while (($i++ < 30) && !($fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT))) {
|
||||
usleep(10000);
|
||||
}
|
||||
|
||||
if ($fp) {
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
register_shutdown_function(
|
||||
function($handle) {
|
||||
proc_terminate($handle);
|
||||
},
|
||||
$handle
|
||||
);
|
||||
// don't bother sleeping, server is already up
|
||||
// server can take a variable amount of time to be up, so just sleeping a guessed amount of time
|
||||
// does not work. this is why tests sometimes pass and sometimes fail. to get a reliable pass
|
||||
// sleeping doesn't work.
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
#define STRING_NOT_NULL(s) (NULL == (s)?"":s)
|
||||
#define MIN_ACCEL_FILES 200
|
||||
#define MAX_ACCEL_FILES 100000
|
||||
#define MAX_ACCEL_FILES 1000000
|
||||
#define TOKENTOSTR(X) #X
|
||||
|
||||
static void (*orig_file_exists)(INTERNAL_FUNCTION_PARAMETERS) = NULL;
|
||||
@@ -259,7 +259,8 @@ ZEND_INI_BEGIN()
|
||||
STD_PHP_INI_ENTRY("opcache.consistency_checks" , "0" , PHP_INI_ALL , OnUpdateLong, accel_directives.consistency_checks, zend_accel_globals, accel_globals)
|
||||
STD_PHP_INI_ENTRY("opcache.force_restart_timeout" , "180" , PHP_INI_SYSTEM, OnUpdateLong, accel_directives.force_restart_timeout, zend_accel_globals, accel_globals)
|
||||
STD_PHP_INI_ENTRY("opcache.revalidate_freq" , "2" , PHP_INI_ALL , OnUpdateLong, accel_directives.revalidate_freq, zend_accel_globals, accel_globals)
|
||||
STD_PHP_INI_ENTRY("opcache.preferred_memory_model", "" , PHP_INI_SYSTEM, OnUpdateStringUnempty, accel_directives.memory_model, zend_accel_globals, accel_globals)
|
||||
STD_PHP_INI_ENTRY("opcache.file_update_protection", "2" , PHP_INI_ALL , OnUpdateLong, accel_directives.file_update_protection, zend_accel_globals, accel_globals)
|
||||
STD_PHP_INI_ENTRY("opcache.preferred_memory_model", "" , PHP_INI_SYSTEM, OnUpdateStringUnempty, accel_directives.memory_model, zend_accel_globals, accel_globals)
|
||||
STD_PHP_INI_ENTRY("opcache.blacklist_filename" , "" , PHP_INI_SYSTEM, OnUpdateString, accel_directives.user_blacklist_filename, zend_accel_globals, accel_globals)
|
||||
STD_PHP_INI_ENTRY("opcache.max_file_size" , "0" , PHP_INI_SYSTEM, OnUpdateLong, accel_directives.max_file_size, zend_accel_globals, accel_globals)
|
||||
|
||||
|
||||
@@ -835,7 +835,19 @@ static int zend_hash_unique_copy(HashTable *target, HashTable *source, unique_co
|
||||
}
|
||||
} else {
|
||||
if (p->nKeyLength > 0 && p->arKey[0] == 0) {
|
||||
/* Mangled key, ignore and wait for runtime */
|
||||
/* Mangled key */
|
||||
#if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO
|
||||
if (((zend_function*)p->pData)->common.fn_flags & ZEND_ACC_CLOSURE) {
|
||||
/* update closure */
|
||||
if (zend_hash_quick_update(target, p->arKey, p->nKeyLength, p->h, p->pData, size, &t) == SUCCESS) {
|
||||
if (pCopyConstructor) {
|
||||
pCopyConstructor(t);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* ignore and wait for runtime */
|
||||
}
|
||||
#endif
|
||||
} else if (!ignore_dups && zend_hash_quick_find(target, p->arKey, p->nKeyLength, p->h, &t) == SUCCESS) {
|
||||
*fail_data = p->pData;
|
||||
*conflict_data = t;
|
||||
|
||||
+14
-4
@@ -657,18 +657,28 @@ static time_t asn1_time_to_time_t(ASN1_UTCTIME * timestr TSRMLS_DC) /* {{{ */
|
||||
char * thestr;
|
||||
long gmadjust = 0;
|
||||
|
||||
if (timestr->length < 13) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "extension author too lazy to parse %s correctly", timestr->data);
|
||||
if (ASN1_STRING_type(timestr) != V_ASN1_UTCTIME) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "illegal ASN1 data type for timestamp");
|
||||
return (time_t)-1;
|
||||
}
|
||||
|
||||
strbuf = estrdup((char *)timestr->data);
|
||||
if (ASN1_STRING_length(timestr) != strlen(ASN1_STRING_data(timestr))) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "illegal length in timestamp");
|
||||
return (time_t)-1;
|
||||
}
|
||||
|
||||
if (ASN1_STRING_length(timestr) < 13) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to parse time string %s correctly", timestr->data);
|
||||
return (time_t)-1;
|
||||
}
|
||||
|
||||
strbuf = estrdup((char *)ASN1_STRING_data(timestr));
|
||||
|
||||
memset(&thetime, 0, sizeof(thetime));
|
||||
|
||||
/* we work backwards so that we can use atoi more easily */
|
||||
|
||||
thestr = strbuf + timestr->length - 3;
|
||||
thestr = strbuf + ASN1_STRING_length(timestr) - 3;
|
||||
|
||||
thetime.tm_sec = atoi(thestr);
|
||||
*thestr = '\0';
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEpDCCA4ygAwIBAgIJAJzu8r6u6eBcMA0GCSqGSIb3DQEBBQUAMIHDMQswCQYD
|
||||
VQQGEwJERTEcMBoGA1UECAwTTm9yZHJoZWluLVdlc3RmYWxlbjEQMA4GA1UEBwwH
|
||||
S8ODwrZsbjEUMBIGA1UECgwLU2VrdGlvbkVpbnMxHzAdBgNVBAsMFk1hbGljaW91
|
||||
cyBDZXJ0IFNlY3Rpb24xITAfBgNVBAMMGG1hbGljaW91cy5zZWt0aW9uZWlucy5k
|
||||
ZTEqMCgGCSqGSIb3DQEJARYbc3RlZmFuLmVzc2VyQHNla3Rpb25laW5zLmRlMHUY
|
||||
ZDE5NzAwMTAxMDAwMDAwWgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAXDTE0MTEyODExMzkzNVowgcMxCzAJBgNVBAYTAkRFMRwwGgYDVQQIDBNO
|
||||
b3JkcmhlaW4tV2VzdGZhbGVuMRAwDgYDVQQHDAdLw4PCtmxuMRQwEgYDVQQKDAtT
|
||||
ZWt0aW9uRWluczEfMB0GA1UECwwWTWFsaWNpb3VzIENlcnQgU2VjdGlvbjEhMB8G
|
||||
A1UEAwwYbWFsaWNpb3VzLnNla3Rpb25laW5zLmRlMSowKAYJKoZIhvcNAQkBFhtz
|
||||
dGVmYW4uZXNzZXJAc2VrdGlvbmVpbnMuZGUwggEiMA0GCSqGSIb3DQEBAQUAA4IB
|
||||
DwAwggEKAoIBAQDDAf3hl7JY0XcFniyEJpSSDqn0OqBr6QP65usJPRt/8PaDoqBu
|
||||
wEYT/Na+6fsgPjC0uK9DZgWg2tHWWoanSblAMoz5PH6Z+S4SHRZ7e2dDIjPjdhjh
|
||||
0mLg2UMO5yp0V797Ggs9lNt6JRfH81MN2obXWs4NtztLMuD6egqpr8dDbr34aOs8
|
||||
pkdui5UawTZksy5pLPHq5cMhFGm06v65CLo0V2Pd9+KAokPrPcN5KLKebz7mLpk6
|
||||
SMeEXOKP4idEqxyQ7O7fBuHMedsQhu+prY3si3BUyKfQtP5CZnX2bp0wKHxX12DX
|
||||
1nfFIt9DbGvHTcyOuN+nZLPBm3vWxntyIIvVAgMBAAGjQjBAMAkGA1UdEwQCMAAw
|
||||
EQYJYIZIAYb4QgEBBAQDAgeAMAsGA1UdDwQEAwIFoDATBgNVHSUEDDAKBggrBgEF
|
||||
BQcDAjANBgkqhkiG9w0BAQUFAAOCAQEAG0fZYYCTbdj1XYc+1SnoaPR+vI8C8CaD
|
||||
8+0UYhdnyU4gga0BAcDrY9e94eEAu6ZqycF6FjLqXXdAboppWocr6T6GD1x33Ckl
|
||||
VArzG/KxQohGD2JeqkhIMlDomxHO7ka39+Oa8i2vWLVyjU8AZvWMAruHa4EENyG7
|
||||
lW2AagaFKFCr9TnXTfrdxGVEbv7KVQ6bdhg5p5SjpWH1+Mq03uR3ZXPBYdyV8319
|
||||
o0lVj1KFI2DCL/liWisJRoof+1cR35Ctd0wYBcpB6TZslMcOPl76dwKwJgeJo2Qg
|
||||
Zsfmc2vC1/qOlNuNq/0TzzkVGv8ETT3CgaU+UXe4XOVvkccebJn2dg==
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
CVE-2013-6420
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$crt = substr(__FILE__, 0, -4).'.crt';
|
||||
$info = openssl_x509_parse("file://$crt");
|
||||
var_dump($info['issuer']['emailAddress'], $info["validFrom_time_t"]);
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
%s openssl_x509_parse(): illegal ASN1 data type for timestamp in %s/cve-2013-6420.php on line 3
|
||||
string(27) "stefan.esser@sektioneins.de"
|
||||
int(-1)
|
||||
Done
|
||||
+2
-2
@@ -460,7 +460,7 @@ static void pdo_stmt_construct(pdo_stmt_t *stmt, zval *object, zend_class_entry
|
||||
if (dbstmt_ce->constructor) {
|
||||
zend_fcall_info fci;
|
||||
zend_fcall_info_cache fcc;
|
||||
zval *retval;
|
||||
zval *retval = NULL;
|
||||
|
||||
fci.size = sizeof(zend_fcall_info);
|
||||
fci.function_table = &dbstmt_ce->function_table;
|
||||
@@ -495,7 +495,7 @@ static void pdo_stmt_construct(pdo_stmt_t *stmt, zval *object, zend_class_entry
|
||||
zval_dtor(object);
|
||||
ZVAL_NULL(object);
|
||||
object = NULL; /* marks failure */
|
||||
} else {
|
||||
} else if (retval) {
|
||||
zval_ptr_dtor(&retval);
|
||||
}
|
||||
|
||||
|
||||
+13
-10
@@ -586,7 +586,9 @@ safe:
|
||||
}
|
||||
plc->freeq = 1;
|
||||
} else {
|
||||
switch (Z_TYPE_P(param->parameter)) {
|
||||
zval tmp_param = *param->parameter;
|
||||
zval_copy_ctor(&tmp_param);
|
||||
switch (Z_TYPE(tmp_param)) {
|
||||
case IS_NULL:
|
||||
plc->quoted = "NULL";
|
||||
plc->qlen = sizeof("NULL")-1;
|
||||
@@ -594,20 +596,20 @@ safe:
|
||||
break;
|
||||
|
||||
case IS_BOOL:
|
||||
convert_to_long(param->parameter);
|
||||
|
||||
convert_to_long(&tmp_param);
|
||||
/* fall through */
|
||||
case IS_LONG:
|
||||
case IS_DOUBLE:
|
||||
convert_to_string(param->parameter);
|
||||
plc->qlen = Z_STRLEN_P(param->parameter);
|
||||
plc->quoted = Z_STRVAL_P(param->parameter);
|
||||
plc->freeq = 0;
|
||||
convert_to_string(&tmp_param);
|
||||
plc->qlen = Z_STRLEN(tmp_param);
|
||||
plc->quoted = estrdup(Z_STRVAL(tmp_param));
|
||||
plc->freeq = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
convert_to_string(param->parameter);
|
||||
if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter),
|
||||
Z_STRLEN_P(param->parameter), &plc->quoted, &plc->qlen,
|
||||
convert_to_string(&tmp_param);
|
||||
if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL(tmp_param),
|
||||
Z_STRLEN(tmp_param), &plc->quoted, &plc->qlen,
|
||||
param->param_type TSRMLS_CC)) {
|
||||
/* bork */
|
||||
ret = -1;
|
||||
@@ -616,6 +618,7 @@ safe:
|
||||
}
|
||||
plc->freeq = 1;
|
||||
}
|
||||
zval_dtor(&tmp_param);
|
||||
}
|
||||
} else {
|
||||
plc->quoted = Z_STRVAL_P(param->parameter);
|
||||
|
||||
+13
-10
@@ -228,7 +228,9 @@ safe:
|
||||
}
|
||||
plc->freeq = 1;
|
||||
} else {
|
||||
switch (Z_TYPE_P(param->parameter)) {
|
||||
zval tmp_param = *param->parameter;
|
||||
zval_copy_ctor(&tmp_param);
|
||||
switch (Z_TYPE(tmp_param)) {
|
||||
case IS_NULL:
|
||||
plc->quoted = "NULL";
|
||||
plc->qlen = sizeof("NULL")-1;
|
||||
@@ -236,20 +238,20 @@ safe:
|
||||
break;
|
||||
|
||||
case IS_BOOL:
|
||||
convert_to_long(param->parameter);
|
||||
|
||||
convert_to_long(&tmp_param);
|
||||
/* fall through */
|
||||
case IS_LONG:
|
||||
case IS_DOUBLE:
|
||||
convert_to_string(param->parameter);
|
||||
plc->qlen = Z_STRLEN_P(param->parameter);
|
||||
plc->quoted = Z_STRVAL_P(param->parameter);
|
||||
plc->freeq = 0;
|
||||
convert_to_string(&tmp_param);
|
||||
plc->qlen = Z_STRLEN(tmp_param);
|
||||
plc->quoted = estrdup(Z_STRVAL(tmp_param));
|
||||
plc->freeq = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
convert_to_string(param->parameter);
|
||||
if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter),
|
||||
Z_STRLEN_P(param->parameter), &plc->quoted, &plc->qlen,
|
||||
convert_to_string(&tmp_param);
|
||||
if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL(tmp_param),
|
||||
Z_STRLEN(tmp_param), &plc->quoted, &plc->qlen,
|
||||
param->param_type TSRMLS_CC)) {
|
||||
/* bork */
|
||||
ret = -1;
|
||||
@@ -258,6 +260,7 @@ safe:
|
||||
}
|
||||
plc->freeq = 1;
|
||||
}
|
||||
zval_dtor(&tmp_param);
|
||||
}
|
||||
} else {
|
||||
plc->quoted = Z_STRVAL_P(param->parameter);
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
--TEST--
|
||||
Bug #65946 (pdo_sql_parser.c permanently converts values bound to strings)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('pdo')) die('skip');
|
||||
$dir = getenv('REDIR_TEST_DIR');
|
||||
if (false == $dir) die('skip no driver');
|
||||
require_once $dir . 'pdo_test.inc';
|
||||
PDOTest::skip();
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/');
|
||||
require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
|
||||
$db = PDOTest::factory();
|
||||
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
|
||||
$db->exec('CREATE TABLE test(id int)');
|
||||
$db->exec('INSERT INTO test VALUES(1)');
|
||||
$stmt = $db->prepare('SELECT * FROM test LIMIT :limit');
|
||||
$stmt->bindValue('limit', 1, PDO::PARAM_INT);
|
||||
if(!($res = $stmt->execute())) var_dump($stmt->errorInfo());
|
||||
if(!($res = $stmt->execute())) var_dump($stmt->errorInfo());
|
||||
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
["id"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Bug #66141 (mysqlnd quote function is wrong with NO_BACKSLASH_ESCAPES after failed query)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
||||
MySQLPDOTest::skip();
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
include __DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc';
|
||||
$db = MySQLPDOTest::factory();
|
||||
|
||||
$input = 'Something\', 1 as one, 2 as two FROM dual; -- f';
|
||||
|
||||
$quotedInput0 = $db->quote($input);
|
||||
|
||||
$db->query('set session sql_mode="NO_BACKSLASH_ESCAPES"');
|
||||
|
||||
// injection text from some user input
|
||||
|
||||
$quotedInput1 = $db->quote($input);
|
||||
|
||||
$db->query('something that throws an exception');
|
||||
|
||||
$quotedInput2 = $db->quote($input);
|
||||
|
||||
var_dump($quotedInput0);
|
||||
var_dump($quotedInput1);
|
||||
var_dump($quotedInput2);
|
||||
?>
|
||||
done
|
||||
--EXPECTF--
|
||||
Warning: PDO::query(): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'something that throws an exception' at line %d in %s on line %d
|
||||
string(50) "'Something\', 1 as one, 2 as two FROM dual; -- f'"
|
||||
string(50) "'Something'', 1 as one, 2 as two FROM dual; -- f'"
|
||||
string(50) "'Something'', 1 as one, 2 as two FROM dual; -- f'"
|
||||
done
|
||||
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Bug #66033 (Segmentation Fault when constructor of PDO statement throws an exception)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('pdo_sqlite')) print 'skip not loaded';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
class DBStatement extends PDOStatement {
|
||||
public $dbh;
|
||||
protected function __construct($dbh) {
|
||||
$this->dbh = $dbh;
|
||||
throw new Exception("Blah");
|
||||
}
|
||||
}
|
||||
|
||||
$pdo = new PDO('sqlite::memory:', null, null);
|
||||
$pdo->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('DBStatement',
|
||||
array($pdo)));
|
||||
$pdo->exec("CREATE TABLE IF NOT EXISTS messages (
|
||||
id INTEGER PRIMARY KEY,
|
||||
title TEXT,
|
||||
message TEXT,
|
||||
time INTEGER)");
|
||||
|
||||
try {
|
||||
$pdoStatement = $pdo->query("select * from messages");
|
||||
} catch (Exception $e) {
|
||||
var_dump($e->getMessage());
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(4) "Blah"
|
||||
+1
-1
@@ -2639,7 +2639,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type,
|
||||
Bucket *p;
|
||||
|
||||
fci.param_count = 0;
|
||||
fci.params = safe_emalloc(sizeof(zval*), ht->nNumOfElements, 0);
|
||||
fci.params = safe_emalloc(sizeof(zval***), ht->nNumOfElements, 0);
|
||||
p = ht->pListHead;
|
||||
while (p != NULL) {
|
||||
fci.params[fci.param_count++] = (zval**)p->pData;
|
||||
|
||||
@@ -28,5 +28,7 @@ if test "$PHP_PHAR" != "no"; then
|
||||
PHP_ADD_EXTENSION_DEP(phar, spl, true)
|
||||
PHP_ADD_MAKEFILE_FRAGMENT
|
||||
|
||||
PHP_INSTALL_HEADERS([ext/phar], [php_phar.h])
|
||||
|
||||
PHP_OUTPUT(ext/phar/phar.1 ext/phar/phar.phar.1)
|
||||
fi
|
||||
@@ -168,11 +168,7 @@ static int phar_compare_dir_name(const void *a, const void *b TSRMLS_DC) /* {{{
|
||||
|
||||
f = *((Bucket **) a);
|
||||
s = *((Bucket **) b);
|
||||
#if (PHP_MAJOR_VERSION < 6)
|
||||
result = zend_binary_strcmp(f->arKey, f->nKeyLength, s->arKey, s->nKeyLength);
|
||||
#else
|
||||
result = zend_binary_strcmp(f->key.arKey.s, f->nKeyLength, s->key.arKey.s, s->nKeyLength);
|
||||
#endif
|
||||
|
||||
if (result < 0) {
|
||||
return -1;
|
||||
|
||||
+1
-93
@@ -27,9 +27,7 @@
|
||||
static void destroy_phar_data(void *pDest);
|
||||
|
||||
ZEND_DECLARE_MODULE_GLOBALS(phar)
|
||||
#if PHP_VERSION_ID >= 50300
|
||||
char *(*phar_save_resolve_path)(const char *filename, int filename_len TSRMLS_DC);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* set's phar->is_writeable based on the current INI value
|
||||
@@ -3321,31 +3319,18 @@ static size_t phar_zend_stream_reader(void *handle, char *buf, size_t len TSRMLS
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if PHP_VERSION_ID >= 50300
|
||||
static size_t phar_zend_stream_fsizer(void *handle TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return ((phar_archive_data*)handle)->halt_offset + 32;
|
||||
} /* }}} */
|
||||
|
||||
#else /* PHP_VERSION_ID */
|
||||
|
||||
static long phar_stream_fteller_for_zend(void *handle TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return (long)php_stream_tell(phar_get_pharfp((phar_archive_data*)handle TSRMLS_CC));
|
||||
}
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
zend_op_array *(*phar_orig_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC);
|
||||
#if PHP_VERSION_ID >= 50300
|
||||
#define phar_orig_zend_open zend_stream_open_function
|
||||
|
||||
static char *phar_resolve_path(const char *filename, int filename_len TSRMLS_DC)
|
||||
{
|
||||
return phar_find_in_include_path((char *) filename, filename_len, NULL TSRMLS_CC);
|
||||
}
|
||||
#else
|
||||
int (*phar_orig_zend_open)(const char *filename, zend_file_handle *handle TSRMLS_DC);
|
||||
#endif
|
||||
|
||||
static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
@@ -3378,7 +3363,6 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type
|
||||
}
|
||||
} else if (phar->flags & PHAR_FILE_COMPRESSION_MASK) {
|
||||
/* compressed phar */
|
||||
#if PHP_VERSION_ID >= 50300
|
||||
file_handle->type = ZEND_HANDLE_STREAM;
|
||||
/* we do our own reading directly from the phar, don't change the next line */
|
||||
file_handle->handle.stream.handle = phar;
|
||||
@@ -3390,18 +3374,6 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type
|
||||
php_stream_rewind(PHAR_GLOBALS->cached_fp[phar->phar_pos].fp) :
|
||||
php_stream_rewind(phar->fp);
|
||||
memset(&file_handle->handle.stream.mmap, 0, sizeof(file_handle->handle.stream.mmap));
|
||||
#else /* PHP_VERSION_ID */
|
||||
file_handle->type = ZEND_HANDLE_STREAM;
|
||||
/* we do our own reading directly from the phar, don't change the next line */
|
||||
file_handle->handle.stream.handle = phar;
|
||||
file_handle->handle.stream.reader = phar_zend_stream_reader;
|
||||
file_handle->handle.stream.closer = NULL; /* don't close - let phar handle this one */
|
||||
file_handle->handle.stream.fteller = phar_stream_fteller_for_zend;
|
||||
file_handle->handle.stream.interactive = 0;
|
||||
phar->is_persistent ?
|
||||
php_stream_rewind(PHAR_GLOBALS->cached_fp[phar->phar_pos].fp) :
|
||||
php_stream_rewind(phar->fp);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3426,60 +3398,6 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if PHP_VERSION_ID < 50300
|
||||
int phar_zend_open(const char *filename, zend_file_handle *handle TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
char *arch, *entry;
|
||||
int arch_len, entry_len;
|
||||
|
||||
/* this code is obsoleted in php 5.3 */
|
||||
entry = (char *) filename;
|
||||
if (!IS_ABSOLUTE_PATH(entry, strlen(entry)) && !strstr(entry, "://")) {
|
||||
phar_archive_data **pphar = NULL;
|
||||
char *fname;
|
||||
int fname_len;
|
||||
|
||||
fname = (char*)zend_get_executed_filename(TSRMLS_C);
|
||||
fname_len = strlen(fname);
|
||||
|
||||
if (fname_len > 7 && !strncasecmp(fname, "phar://", 7)) {
|
||||
if (SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 1, 0 TSRMLS_CC)) {
|
||||
zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), arch, arch_len, (void **) &pphar);
|
||||
if (!pphar && PHAR_G(manifest_cached)) {
|
||||
zend_hash_find(&cached_phars, arch, arch_len, (void **) &pphar);
|
||||
}
|
||||
efree(arch);
|
||||
efree(entry);
|
||||
}
|
||||
}
|
||||
|
||||
/* retrieving an include within the current directory, so use this if possible */
|
||||
if (!(entry = phar_find_in_include_path((char *) filename, strlen(filename), NULL TSRMLS_CC))) {
|
||||
/* this file is not in the phar, use the original path */
|
||||
goto skip_phar;
|
||||
}
|
||||
|
||||
if (SUCCESS == phar_orig_zend_open(entry, handle TSRMLS_CC)) {
|
||||
if (!handle->opened_path) {
|
||||
handle->opened_path = entry;
|
||||
}
|
||||
if (entry != filename) {
|
||||
handle->free_filename = 1;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
if (entry != filename) {
|
||||
efree(entry);
|
||||
}
|
||||
|
||||
return FAILURE;
|
||||
}
|
||||
skip_phar:
|
||||
return phar_orig_zend_open(filename, handle TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
#endif
|
||||
typedef zend_op_array* (zend_compile_t)(zend_file_handle*, int TSRMLS_DC);
|
||||
typedef zend_compile_t* (compile_hook)(zend_compile_t *ptr);
|
||||
|
||||
@@ -3556,13 +3474,8 @@ PHP_MINIT_FUNCTION(phar) /* {{{ */
|
||||
phar_orig_compile_file = zend_compile_file;
|
||||
zend_compile_file = phar_compile_file;
|
||||
|
||||
#if PHP_VERSION_ID >= 50300
|
||||
phar_save_resolve_path = zend_resolve_path;
|
||||
zend_resolve_path = phar_resolve_path;
|
||||
#else
|
||||
phar_orig_zend_open = zend_stream_open_function;
|
||||
zend_stream_open_function = phar_zend_open;
|
||||
#endif
|
||||
|
||||
phar_object_init(TSRMLS_C);
|
||||
|
||||
@@ -3583,11 +3496,6 @@ PHP_MSHUTDOWN_FUNCTION(phar) /* {{{ */
|
||||
zend_compile_file = phar_orig_compile_file;
|
||||
}
|
||||
|
||||
#if PHP_VERSION_ID < 50300
|
||||
if (zend_stream_open_function == phar_zend_open) {
|
||||
zend_stream_open_function = phar_orig_zend_open;
|
||||
}
|
||||
#endif
|
||||
if (PHAR_G(manifest_cached)) {
|
||||
zend_hash_destroy(&(cached_phars));
|
||||
zend_hash_destroy(&(cached_alias));
|
||||
|
||||
@@ -516,76 +516,17 @@ union _phar_entry_object {
|
||||
#endif
|
||||
|
||||
#ifndef PHAR_MAIN
|
||||
# if PHP_VERSION_ID >= 50300
|
||||
extern char *(*phar_save_resolve_path)(const char *filename, int filename_len TSRMLS_DC);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if PHP_VERSION_ID < 50209
|
||||
static inline size_t phar_stream_copy_to_stream(php_stream *src, php_stream *dest, size_t maxlen, size_t *len STREAMS_DC TSRMLS_DC)
|
||||
{
|
||||
size_t ret = php_stream_copy_to_stream(src, dest, maxlen);
|
||||
if (len) {
|
||||
*len = ret;
|
||||
}
|
||||
if (ret) {
|
||||
return SUCCESS;
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
#else
|
||||
# define phar_stream_copy_to_stream(src, dest, maxlen, len) _php_stream_copy_to_stream_ex((src), (dest), (maxlen), (len) STREAMS_CC TSRMLS_CC)
|
||||
|
||||
#endif
|
||||
|
||||
#if PHP_VERSION_ID >= 60000
|
||||
typedef zstr phar_zstr;
|
||||
#define PHAR_STR(a, b) \
|
||||
spprintf(&b, 0, "%s", a.s);
|
||||
#define PHAR_ZSTR(a, b) \
|
||||
b = ZSTR(a);
|
||||
#define PHAR_STR_FREE(a) \
|
||||
efree(a);
|
||||
static inline int phar_make_unicode(zstr *c_var, char *arKey, uint nKeyLength TSRMLS_DC)
|
||||
{
|
||||
int c_var_len;
|
||||
UConverter *conv = ZEND_U_CONVERTER(UG(runtime_encoding_conv));
|
||||
|
||||
c_var->u = NULL;
|
||||
if (zend_string_to_unicode(conv, &c_var->u, &c_var_len, arKey, nKeyLength TSRMLS_CC) == FAILURE) {
|
||||
|
||||
if (c_var->u) {
|
||||
efree(c_var->u);
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
return c_var_len;
|
||||
}
|
||||
static inline int phar_find_key(HashTable *_SERVER, char *key, int len, void **stuff TSRMLS_DC)
|
||||
{
|
||||
if (SUCCESS == zend_hash_find(_SERVER, key, len, stuff)) {
|
||||
return 1;
|
||||
} else {
|
||||
int s = len;
|
||||
zstr var;
|
||||
s = phar_make_unicode(&var, key, len TSRMLS_CC);
|
||||
if (SUCCESS == zend_u_hash_find(_SERVER, IS_UNICODE, var, s, stuff)) {
|
||||
efree(var.u);
|
||||
return 1;
|
||||
}
|
||||
efree(var.u);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#else
|
||||
typedef char *phar_zstr;
|
||||
#define PHAR_STR(a, b) \
|
||||
b = a;
|
||||
#define PHAR_ZSTR(a, b) \
|
||||
b = a;
|
||||
#define PHAR_STR_FREE(a)
|
||||
#endif
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
|
||||
|
||||
+1
-77
@@ -685,11 +685,7 @@ PHP_METHOD(Phar, webPhar)
|
||||
ZVAL_STRINGL(params, entry, entry_len, 1);
|
||||
zp[0] = ¶ms;
|
||||
|
||||
#if PHP_VERSION_ID < 50300
|
||||
if (FAILURE == zend_fcall_info_init(rewrite, &fci, &fcc TSRMLS_CC)) {
|
||||
#else
|
||||
if (FAILURE == zend_fcall_info_init(rewrite, 0, &fci, &fcc, NULL, NULL TSRMLS_CC)) {
|
||||
#endif
|
||||
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar error: invalid rewrite callback");
|
||||
|
||||
if (free_pathinfo) {
|
||||
@@ -701,11 +697,7 @@ PHP_METHOD(Phar, webPhar)
|
||||
|
||||
fci.param_count = 1;
|
||||
fci.params = zp;
|
||||
#if PHP_VERSION_ID < 50300
|
||||
++(params->refcount);
|
||||
#else
|
||||
Z_ADDREF_P(params);
|
||||
#endif
|
||||
fci.retval_ptr_ptr = &retval_ptr;
|
||||
|
||||
if (FAILURE == zend_call_function(&fci, &fcc TSRMLS_CC)) {
|
||||
@@ -729,11 +721,6 @@ PHP_METHOD(Phar, webPhar)
|
||||
}
|
||||
|
||||
switch (Z_TYPE_P(retval_ptr)) {
|
||||
#if PHP_VERSION_ID >= 60000
|
||||
case IS_UNICODE:
|
||||
zval_unicode_to_string(retval_ptr TSRMLS_CC);
|
||||
/* break intentionally omitted */
|
||||
#endif
|
||||
case IS_STRING:
|
||||
efree(entry);
|
||||
|
||||
@@ -1155,11 +1142,7 @@ PHP_METHOD(Phar, __construct)
|
||||
#else
|
||||
char *fname, *alias = NULL, *error, *arch = NULL, *entry = NULL, *save_fname;
|
||||
int fname_len, alias_len = 0, arch_len, entry_len, is_data;
|
||||
#if PHP_VERSION_ID < 50300
|
||||
long flags = 0;
|
||||
#else
|
||||
long flags = SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS;
|
||||
#endif
|
||||
long format = 0;
|
||||
phar_archive_object *phar_obj;
|
||||
phar_archive_data *phar_data;
|
||||
@@ -1459,11 +1442,6 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{
|
||||
}
|
||||
|
||||
switch (Z_TYPE_PP(value)) {
|
||||
#if PHP_VERSION_ID >= 60000
|
||||
case IS_UNICODE:
|
||||
zval_unicode_to_string(*(value) TSRMLS_CC);
|
||||
/* break intentionally omitted */
|
||||
#endif
|
||||
case IS_STRING:
|
||||
break;
|
||||
case IS_RESOURCE:
|
||||
@@ -1514,13 +1492,7 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{
|
||||
|
||||
switch (intern->type) {
|
||||
case SPL_FS_DIR:
|
||||
#if PHP_VERSION_ID >= 60000
|
||||
test = spl_filesystem_object_get_path(intern, NULL, NULL TSRMLS_CC).s;
|
||||
#elif PHP_VERSION_ID >= 50300
|
||||
test = spl_filesystem_object_get_path(intern, NULL TSRMLS_CC);
|
||||
#else
|
||||
test = intern->path;
|
||||
#endif
|
||||
fname_len = spprintf(&fname, 0, "%s%c%s", test, DEFAULT_SLASH, intern->u.dir.entry.d_name);
|
||||
php_stat(fname, fname_len, FS_IS_DIR, &dummy TSRMLS_CC);
|
||||
|
||||
@@ -1545,25 +1517,7 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{
|
||||
goto phar_spl_fileinfo;
|
||||
case SPL_FS_INFO:
|
||||
case SPL_FS_FILE:
|
||||
#if PHP_VERSION_ID >= 60000
|
||||
if (intern->file_name_type == IS_UNICODE) {
|
||||
zval zv;
|
||||
|
||||
INIT_ZVAL(zv);
|
||||
Z_UNIVAL(zv) = intern->file_name;
|
||||
Z_UNILEN(zv) = intern->file_name_len;
|
||||
Z_TYPE(zv) = IS_UNICODE;
|
||||
|
||||
zval_copy_ctor(&zv);
|
||||
zval_unicode_to_string(&zv TSRMLS_CC);
|
||||
fname = expand_filepath(Z_STRVAL(zv), NULL TSRMLS_CC);
|
||||
ezfree(Z_UNIVAL(zv));
|
||||
} else {
|
||||
fname = expand_filepath(intern->file_name.s, NULL TSRMLS_CC);
|
||||
}
|
||||
#else
|
||||
fname = expand_filepath(intern->file_name, NULL TSRMLS_CC);
|
||||
#endif
|
||||
if (!fname) {
|
||||
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Could not resolve file path");
|
||||
return ZEND_HASH_APPLY_STOP;
|
||||
@@ -1816,11 +1770,7 @@ PHP_METHOD(Phar, buildFromDirectory)
|
||||
INIT_PZVAL(&arg);
|
||||
ZVAL_STRINGL(&arg, dir, dir_len, 0);
|
||||
INIT_PZVAL(&arg2);
|
||||
#if PHP_VERSION_ID < 50300
|
||||
ZVAL_LONG(&arg2, 0);
|
||||
#else
|
||||
ZVAL_LONG(&arg2, SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS);
|
||||
#endif
|
||||
|
||||
zend_call_method_with_2_params(&iter, spl_ce_RecursiveDirectoryIterator,
|
||||
&spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg, &arg2);
|
||||
@@ -2313,11 +2263,7 @@ static zval *phar_convert_to_other(phar_archive_data *source, int convert, char
|
||||
ALLOC_ZVAL(phar->metadata);
|
||||
*phar->metadata = *t;
|
||||
zval_copy_ctor(phar->metadata);
|
||||
#if PHP_VERSION_ID < 50300
|
||||
phar->metadata->refcount = 1;
|
||||
#else
|
||||
Z_SET_REFCOUNT_P(phar->metadata, 1);
|
||||
#endif
|
||||
|
||||
phar->metadata_len = 0;
|
||||
}
|
||||
@@ -2365,11 +2311,7 @@ no_copy:
|
||||
ALLOC_ZVAL(newentry.metadata);
|
||||
*newentry.metadata = *t;
|
||||
zval_copy_ctor(newentry.metadata);
|
||||
#if PHP_VERSION_ID < 50300
|
||||
newentry.metadata->refcount = 1;
|
||||
#else
|
||||
Z_SET_REFCOUNT_P(newentry.metadata, 1);
|
||||
#endif
|
||||
|
||||
newentry.metadata_str.c = NULL;
|
||||
newentry.metadata_str.len = 0;
|
||||
@@ -3552,11 +3494,7 @@ PHP_METHOD(Phar, copy)
|
||||
ALLOC_ZVAL(newentry.metadata);
|
||||
*newentry.metadata = *t;
|
||||
zval_copy_ctor(newentry.metadata);
|
||||
#if PHP_VERSION_ID < 50300
|
||||
newentry.metadata->refcount = 1;
|
||||
#else
|
||||
Z_SET_REFCOUNT_P(newentry.metadata, 1);
|
||||
#endif
|
||||
|
||||
newentry.metadata_str.c = NULL;
|
||||
newentry.metadata_str.len = 0;
|
||||
@@ -4371,11 +4309,6 @@ PHP_METHOD(Phar, extractTo)
|
||||
switch (Z_TYPE_P(zval_files)) {
|
||||
case IS_NULL:
|
||||
goto all_files;
|
||||
#if PHP_VERSION_ID >= 60000
|
||||
case IS_UNICODE:
|
||||
zval_unicode_to_string(zval_files TSRMLS_CC);
|
||||
/* break intentionally omitted */
|
||||
#endif
|
||||
case IS_STRING:
|
||||
filename = Z_STRVAL_P(zval_files);
|
||||
filename_len = Z_STRLEN_P(zval_files);
|
||||
@@ -4389,11 +4322,6 @@ PHP_METHOD(Phar, extractTo)
|
||||
zval **zval_file;
|
||||
if (zend_hash_index_find(Z_ARRVAL_P(zval_files), i, (void **) &zval_file) == SUCCESS) {
|
||||
switch (Z_TYPE_PP(zval_file)) {
|
||||
#if PHP_VERSION_ID >= 60000
|
||||
case IS_UNICODE:
|
||||
zval_unicode_to_string(*(zval_file) TSRMLS_CC);
|
||||
/* break intentionally omitted */
|
||||
#endif
|
||||
case IS_STRING:
|
||||
break;
|
||||
default:
|
||||
@@ -5414,11 +5342,7 @@ zend_function_entry phar_exception_methods[] = {
|
||||
#define REGISTER_PHAR_CLASS_CONST_LONG(class_name, const_name, value) \
|
||||
zend_declare_class_constant_long(class_name, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC);
|
||||
|
||||
#if PHP_VERSION_ID < 50200
|
||||
# define phar_exception_get_default() zend_exception_get_default()
|
||||
#else
|
||||
# define phar_exception_get_default() zend_exception_get_default(TSRMLS_C)
|
||||
#endif
|
||||
#define phar_exception_get_default() zend_exception_get_default(TSRMLS_C)
|
||||
|
||||
void phar_object_init(TSRMLS_D) /* {{{ */
|
||||
{
|
||||
|
||||
+4
-2
@@ -22,7 +22,7 @@
|
||||
#ifndef PHP_PHAR_H
|
||||
#define PHP_PHAR_H
|
||||
|
||||
#define PHP_PHAR_VERSION "2.0.1"
|
||||
#define PHP_PHAR_VERSION "2.0.2"
|
||||
|
||||
#include "ext/standard/basic_functions.h"
|
||||
extern zend_module_entry phar_module_entry;
|
||||
@@ -31,9 +31,11 @@ extern zend_module_entry phar_module_entry;
|
||||
#ifdef PHP_WIN32
|
||||
#define PHP_PHAR_API __declspec(dllexport)
|
||||
#else
|
||||
#define PHP_PHAR_API
|
||||
#define PHP_PHAR_API PHPAPI
|
||||
#endif
|
||||
|
||||
PHP_PHAR_API int phar_resolve_alias(char *alias, int alias_len, char **filename, int *filename_len TSRMLS_DC);
|
||||
|
||||
#endif /* PHP_PHAR_H */
|
||||
|
||||
|
||||
|
||||
@@ -942,11 +942,7 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, char *url_from, char
|
||||
entry->filename_len = new_key_len;
|
||||
|
||||
PHAR_ZSTR(new_str_key, new_key);
|
||||
#if PHP_VERSION_ID < 50300
|
||||
zend_hash_update_current_key_ex(&phar->manifest, key_type, new_key, new_key_len, 0, NULL);
|
||||
#else
|
||||
zend_hash_update_current_key_ex(&phar->manifest, key_type, new_key, new_key_len, 0, HASH_UPDATE_KEY_ANYWAY, NULL);
|
||||
#endif
|
||||
}
|
||||
PHAR_STR_FREE(str_key);
|
||||
}
|
||||
@@ -968,11 +964,7 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, char *url_from, char
|
||||
new_str_key[new_key_len] = 0;
|
||||
|
||||
PHAR_ZSTR(new_str_key, new_key);
|
||||
#if PHP_VERSION_ID < 50300
|
||||
zend_hash_update_current_key_ex(&phar->virtual_dirs, key_type, new_key, new_key_len, 0, NULL);
|
||||
#else
|
||||
zend_hash_update_current_key_ex(&phar->virtual_dirs, key_type, new_key, new_key_len, 0, HASH_UPDATE_KEY_ANYWAY, NULL);
|
||||
#endif
|
||||
efree(new_str_key);
|
||||
}
|
||||
PHAR_STR_FREE(str_key);
|
||||
@@ -996,11 +988,7 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, char *url_from, char
|
||||
new_str_key[new_key_len] = 0;
|
||||
|
||||
PHAR_ZSTR(new_str_key, new_key);
|
||||
#if PHP_VERSION_ID < 50300
|
||||
zend_hash_update_current_key_ex(&phar->mounted_dirs, key_type, new_key, new_key_len, 0, NULL);
|
||||
#else
|
||||
zend_hash_update_current_key_ex(&phar->mounted_dirs, key_type, new_key, new_key_len, 0, HASH_UPDATE_KEY_ANYWAY, NULL);
|
||||
#endif
|
||||
efree(new_str_key);
|
||||
}
|
||||
PHAR_STR_FREE(str_key);
|
||||
|
||||
+20
-297
@@ -41,10 +41,6 @@
|
||||
static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end, char *key, int key_len, char **signature, int *signature_len TSRMLS_DC);
|
||||
#endif
|
||||
|
||||
#if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300
|
||||
extern php_stream_wrapper php_stream_phar_wrapper;
|
||||
#endif
|
||||
|
||||
/* for links to relative location, prepend cwd of the entry */
|
||||
static char *phar_get_link_location(phar_entry_info *entry TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
@@ -256,7 +252,6 @@ int phar_mount_entry(phar_archive_data *phar, char *filename, int filename_len,
|
||||
|
||||
char *phar_find_in_include_path(char *filename, int filename_len, phar_archive_data **pphar TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
#if PHP_VERSION_ID >= 50300
|
||||
char *path, *fname, *arch, *entry, *ret, *test;
|
||||
int arch_len, entry_len, fname_len, ret_len;
|
||||
phar_archive_data *phar;
|
||||
@@ -344,223 +339,6 @@ splitted:
|
||||
}
|
||||
|
||||
return ret;
|
||||
#else /* PHP 5.2 */
|
||||
char resolved_path[MAXPATHLEN];
|
||||
char trypath[MAXPATHLEN];
|
||||
char *ptr, *end, *path = PG(include_path);
|
||||
php_stream_wrapper *wrapper;
|
||||
const char *p;
|
||||
int n = 0;
|
||||
char *fname, *arch, *entry, *ret, *test;
|
||||
int arch_len, entry_len;
|
||||
phar_archive_data *phar = NULL;
|
||||
|
||||
if (!filename) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!zend_is_executing(TSRMLS_C) || !PHAR_G(cwd)) {
|
||||
goto doit;
|
||||
}
|
||||
|
||||
fname = (char*)zend_get_executed_filename(TSRMLS_C);
|
||||
|
||||
if (SUCCESS != phar_split_fname(fname, strlen(fname), &arch, &arch_len, &entry, &entry_len, 1, 0 TSRMLS_CC)) {
|
||||
goto doit;
|
||||
}
|
||||
|
||||
efree(entry);
|
||||
|
||||
if (*filename == '.') {
|
||||
int try_len;
|
||||
|
||||
if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL TSRMLS_CC)) {
|
||||
efree(arch);
|
||||
goto doit;
|
||||
}
|
||||
|
||||
try_len = filename_len;
|
||||
test = phar_fix_filepath(estrndup(filename, filename_len), &try_len, 1 TSRMLS_CC);
|
||||
|
||||
if (*test == '/') {
|
||||
if (zend_hash_exists(&(phar->manifest), test + 1, try_len - 1)) {
|
||||
spprintf(&ret, 0, "phar://%s%s", arch, test);
|
||||
efree(arch);
|
||||
efree(test);
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
if (zend_hash_exists(&(phar->manifest), test, try_len)) {
|
||||
spprintf(&ret, 0, "phar://%s/%s", arch, test);
|
||||
efree(arch);
|
||||
efree(test);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
efree(test);
|
||||
}
|
||||
|
||||
efree(arch);
|
||||
doit:
|
||||
if (*filename == '.' || IS_ABSOLUTE_PATH(filename, filename_len) || !path || !*path) {
|
||||
if (tsrm_realpath(filename, resolved_path TSRMLS_CC)) {
|
||||
return estrdup(resolved_path);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* test for stream wrappers and return */
|
||||
for (p = filename; p - filename < filename_len && (isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'); ++p, ++n);
|
||||
|
||||
if (n < filename_len - 3 && (*p == ':') && (!strncmp("//", p+1, 2) || ( filename_len > 4 && !memcmp("data", filename, 4)))) {
|
||||
/* found stream wrapper, this is an absolute path until stream wrappers implement realpath */
|
||||
return estrndup(filename, filename_len);
|
||||
}
|
||||
|
||||
ptr = (char *) path;
|
||||
while (ptr && *ptr) {
|
||||
int len, is_stream_wrapper = 0, maybe_stream = 1;
|
||||
|
||||
end = strchr(ptr, DEFAULT_DIR_SEPARATOR);
|
||||
#ifndef PHP_WIN32
|
||||
/* search for stream wrapper */
|
||||
if (end - ptr <= 1) {
|
||||
maybe_stream = 0;
|
||||
goto not_stream;
|
||||
}
|
||||
|
||||
for (p = ptr, n = 0; p < end && (isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'); ++p, ++n);
|
||||
|
||||
if (n == end - ptr && *p && !strncmp("//", p+1, 2)) {
|
||||
is_stream_wrapper = 1;
|
||||
/* seek to real end of include_path portion */
|
||||
end = strchr(end + 1, DEFAULT_DIR_SEPARATOR);
|
||||
} else {
|
||||
maybe_stream = 0;
|
||||
}
|
||||
not_stream:
|
||||
#endif
|
||||
if (end) {
|
||||
if ((end-ptr) + 1 + filename_len + 1 >= MAXPATHLEN) {
|
||||
ptr = end + 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
memcpy(trypath, ptr, end-ptr);
|
||||
len = end-ptr;
|
||||
trypath[end-ptr] = '/';
|
||||
memcpy(trypath+(end-ptr)+1, filename, filename_len+1);
|
||||
ptr = end+1;
|
||||
} else {
|
||||
len = strlen(ptr);
|
||||
|
||||
if (len + 1 + filename_len + 1 >= MAXPATHLEN) {
|
||||
break;
|
||||
}
|
||||
|
||||
memcpy(trypath, ptr, len);
|
||||
trypath[len] = '/';
|
||||
memcpy(trypath+len+1, filename, filename_len+1);
|
||||
ptr = NULL;
|
||||
}
|
||||
|
||||
if (!is_stream_wrapper && maybe_stream) {
|
||||
/* search for stream wrapper */
|
||||
for (p = trypath, n = 0; isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'; ++p, ++n);
|
||||
}
|
||||
|
||||
if (is_stream_wrapper || (n < len - 3 && (*p == ':') && (n > 1) && (!strncmp("//", p+1, 2) || !memcmp("data", trypath, 4)))) {
|
||||
char *actual;
|
||||
|
||||
wrapper = php_stream_locate_url_wrapper(trypath, &actual, STREAM_OPEN_FOR_INCLUDE TSRMLS_CC);
|
||||
if (wrapper == &php_plain_files_wrapper) {
|
||||
strlcpy(trypath, actual, sizeof(trypath));
|
||||
} else if (!wrapper) {
|
||||
/* if wrapper is NULL, there was a mal-formed include_path stream wrapper, so skip this ptr */
|
||||
continue;
|
||||
} else {
|
||||
if (wrapper->wops->url_stat) {
|
||||
php_stream_statbuf ssb;
|
||||
|
||||
if (SUCCESS == wrapper->wops->url_stat(wrapper, trypath, 0, &ssb, NULL TSRMLS_CC)) {
|
||||
if (wrapper == &php_stream_phar_wrapper) {
|
||||
char *arch, *entry;
|
||||
int arch_len, entry_len, ret_len;
|
||||
|
||||
ret_len = strlen(trypath);
|
||||
/* found phar:// */
|
||||
|
||||
if (SUCCESS != phar_split_fname(trypath, ret_len, &arch, &arch_len, &entry, &entry_len, 1, 0 TSRMLS_CC)) {
|
||||
return estrndup(trypath, ret_len);
|
||||
}
|
||||
|
||||
zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), arch, arch_len, (void **) &pphar);
|
||||
|
||||
if (!pphar && PHAR_G(manifest_cached)) {
|
||||
zend_hash_find(&cached_phars, arch, arch_len, (void **) &pphar);
|
||||
}
|
||||
|
||||
efree(arch);
|
||||
efree(entry);
|
||||
|
||||
return estrndup(trypath, ret_len);
|
||||
}
|
||||
return estrdup(trypath);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (tsrm_realpath(trypath, resolved_path TSRMLS_CC)) {
|
||||
return estrdup(resolved_path);
|
||||
}
|
||||
} /* end provided path */
|
||||
|
||||
/* check in calling scripts' current working directory as a fall back case */
|
||||
if (zend_is_executing(TSRMLS_C)) {
|
||||
char *exec_fname = (char*)zend_get_executed_filename(TSRMLS_C);
|
||||
int exec_fname_length = strlen(exec_fname);
|
||||
const char *p;
|
||||
int n = 0;
|
||||
|
||||
while ((--exec_fname_length >= 0) && !IS_SLASH(exec_fname[exec_fname_length]));
|
||||
if (exec_fname && exec_fname[0] != '[' &&
|
||||
exec_fname_length > 0 &&
|
||||
exec_fname_length + 1 + filename_len + 1 < MAXPATHLEN) {
|
||||
memcpy(trypath, exec_fname, exec_fname_length + 1);
|
||||
memcpy(trypath+exec_fname_length + 1, filename, filename_len+1);
|
||||
|
||||
/* search for stream wrapper */
|
||||
for (p = trypath; isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'; ++p, ++n);
|
||||
|
||||
if (n < exec_fname_length - 3 && (*p == ':') && (n > 1) && (!strncmp("//", p+1, 2) || !memcmp("data", trypath, 4))) {
|
||||
char *actual;
|
||||
|
||||
wrapper = php_stream_locate_url_wrapper(trypath, &actual, STREAM_OPEN_FOR_INCLUDE TSRMLS_CC);
|
||||
|
||||
if (wrapper == &php_plain_files_wrapper) {
|
||||
/* this should never technically happen, but we'll leave it here for completeness */
|
||||
strlcpy(trypath, actual, sizeof(trypath));
|
||||
} else if (!wrapper) {
|
||||
/* if wrapper is NULL, there was a malformed include_path stream wrapper
|
||||
this also should be impossible */
|
||||
return NULL;
|
||||
} else {
|
||||
return estrdup(trypath);
|
||||
}
|
||||
}
|
||||
|
||||
if (tsrm_realpath(trypath, resolved_path TSRMLS_CC)) {
|
||||
return estrdup(resolved_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
#endif /* PHP 5.2 */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -850,11 +628,6 @@ int phar_open_archive_fp(phar_archive_data *phar TSRMLS_DC) /* {{{ */
|
||||
if (phar_get_pharfp(phar TSRMLS_CC)) {
|
||||
return SUCCESS;
|
||||
}
|
||||
#if PHP_API_VERSION < 20100412
|
||||
if (PG(safe_mode) && (!php_checkuid(phar->fname, NULL, CHECKUID_ALLOW_ONLY_FILE))) {
|
||||
return FAILURE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (php_check_open_basedir(phar->fname TSRMLS_CC)) {
|
||||
return FAILURE;
|
||||
@@ -1031,47 +804,12 @@ int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TS
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if defined(PHP_VERSION_ID) && PHP_VERSION_ID < 50202
|
||||
typedef struct {
|
||||
char *data;
|
||||
size_t fpos;
|
||||
size_t fsize;
|
||||
size_t smax;
|
||||
int mode;
|
||||
php_stream **owner_ptr;
|
||||
} php_stream_memory_data;
|
||||
#endif
|
||||
|
||||
int phar_create_writeable_entry(phar_archive_data *phar, phar_entry_info *entry, char **error TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
if (entry->fp_type == PHAR_MOD) {
|
||||
/* already newly created, truncate */
|
||||
#if PHP_VERSION_ID >= 50202
|
||||
php_stream_truncate_set_size(entry->fp, 0);
|
||||
#else
|
||||
if (php_stream_is(entry->fp, PHP_STREAM_IS_TEMP)) {
|
||||
if (php_stream_is(*(php_stream**)entry->fp->abstract, PHP_STREAM_IS_MEMORY)) {
|
||||
php_stream *inner = *(php_stream**)entry->fp->abstract;
|
||||
php_stream_memory_data *memfp = (php_stream_memory_data*)inner->abstract;
|
||||
memfp->fpos = 0;
|
||||
memfp->fsize = 0;
|
||||
} else if (php_stream_is(*(php_stream**)entry->fp->abstract, PHP_STREAM_IS_STDIO)) {
|
||||
php_stream_truncate_set_size(*(php_stream**)entry->fp->abstract, 0);
|
||||
} else {
|
||||
if (error) {
|
||||
spprintf(error, 0, "phar error: file \"%s\" cannot be opened for writing, no truncate support", phar->fname);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
} else if (php_stream_is(entry->fp, PHP_STREAM_IS_STDIO)) {
|
||||
php_stream_truncate_set_size(entry->fp, 0);
|
||||
} else {
|
||||
if (error) {
|
||||
spprintf(error, 0, "phar error: file \"%s\" cannot be opened for writing, no truncate support", phar->fname);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
#endif
|
||||
|
||||
entry->old_flags = entry->flags;
|
||||
entry->is_modified = 1;
|
||||
phar->is_modified = 1;
|
||||
@@ -1185,6 +923,18 @@ phar_entry_info * phar_open_jit(phar_archive_data *phar, phar_entry_info *entry,
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
PHP_PHAR_API int phar_resolve_alias(char *alias, int alias_len, char **filename, int *filename_len TSRMLS_DC) /* {{{ */ {
|
||||
phar_archive_data **fd_ptr;
|
||||
if (PHAR_GLOBALS->phar_alias_map.arBuckets
|
||||
&& SUCCESS == zend_hash_find(&(PHAR_GLOBALS->phar_alias_map), alias, alias_len, (void**)&fd_ptr)) {
|
||||
*filename = (*fd_ptr)->fname;
|
||||
*filename_len = (*fd_ptr)->fname_len;
|
||||
return SUCCESS;
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
int phar_free_alias(phar_archive_data *phar, char *alias, int alias_len TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
if (phar->refcount || phar->is_persistent) {
|
||||
@@ -1262,8 +1012,10 @@ alias_success:
|
||||
spprintf(error, 0, "alias \"%s\" is already used for archive \"%s\" cannot be overloaded with \"%s\"", alias, (*fd_ptr)->fname, fname);
|
||||
}
|
||||
if (SUCCESS == phar_free_alias(*fd_ptr, alias, alias_len TSRMLS_CC)) {
|
||||
efree(*error);
|
||||
*error = NULL;
|
||||
if (error) {
|
||||
efree(*error);
|
||||
*error = NULL;
|
||||
}
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -1675,11 +1427,7 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end,
|
||||
Z_TYPE_P(zdata) = IS_STRING;
|
||||
Z_STRLEN_P(zdata) = end;
|
||||
|
||||
#if PHP_MAJOR_VERSION > 5
|
||||
if (end != (off_t) php_stream_copy_to_mem(fp, (void **) &(Z_STRVAL_P(zdata)), (size_t) end, 0)) {
|
||||
#else
|
||||
if (end != (off_t) php_stream_copy_to_mem(fp, &(Z_STRVAL_P(zdata)), (size_t) end, 0)) {
|
||||
#endif
|
||||
zval_dtor(zdata);
|
||||
zval_dtor(zsig);
|
||||
zval_dtor(zkey);
|
||||
@@ -1691,11 +1439,7 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end,
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
#if PHP_VERSION_ID < 50300
|
||||
if (FAILURE == zend_fcall_info_init(openssl, &fci, &fcc TSRMLS_CC)) {
|
||||
#else
|
||||
if (FAILURE == zend_fcall_info_init(openssl, 0, &fci, &fcc, NULL, NULL TSRMLS_CC)) {
|
||||
#endif
|
||||
zval_dtor(zdata);
|
||||
zval_dtor(zsig);
|
||||
zval_dtor(zkey);
|
||||
@@ -1709,13 +1453,6 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end,
|
||||
|
||||
fci.param_count = 3;
|
||||
fci.params = zp;
|
||||
#if PHP_VERSION_ID < 50300
|
||||
++(zdata->refcount);
|
||||
if (!is_sign) {
|
||||
++(zsig->refcount);
|
||||
}
|
||||
++(zkey->refcount);
|
||||
#else
|
||||
Z_ADDREF_P(zdata);
|
||||
if (is_sign) {
|
||||
Z_SET_ISREF_P(zsig);
|
||||
@@ -1723,7 +1460,7 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end,
|
||||
Z_ADDREF_P(zsig);
|
||||
}
|
||||
Z_ADDREF_P(zkey);
|
||||
#endif
|
||||
|
||||
fci.retval_ptr_ptr = &retval_ptr;
|
||||
|
||||
if (FAILURE == zend_call_function(&fci, &fcc TSRMLS_CC)) {
|
||||
@@ -1740,21 +1477,15 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end,
|
||||
|
||||
zval_dtor(openssl);
|
||||
efree(openssl);
|
||||
#if PHP_VERSION_ID < 50300
|
||||
--(zdata->refcount);
|
||||
if (!is_sign) {
|
||||
--(zsig->refcount);
|
||||
}
|
||||
--(zkey->refcount);
|
||||
#else
|
||||
Z_DELREF_P(zdata);
|
||||
|
||||
if (is_sign) {
|
||||
Z_UNSET_ISREF_P(zsig);
|
||||
} else {
|
||||
Z_DELREF_P(zsig);
|
||||
}
|
||||
Z_DELREF_P(zkey);
|
||||
#endif
|
||||
|
||||
zval_dtor(zdata);
|
||||
efree(zdata);
|
||||
zval_dtor(zkey);
|
||||
@@ -2280,11 +2011,7 @@ static int phar_update_cached_entry(void *data, void *argument) /* {{{ */
|
||||
ALLOC_ZVAL(entry->metadata);
|
||||
*entry->metadata = *t;
|
||||
zval_copy_ctor(entry->metadata);
|
||||
#if PHP_VERSION_ID < 50300
|
||||
entry->metadata->refcount = 1;
|
||||
#else
|
||||
Z_SET_REFCOUNT_P(entry->metadata, 1);
|
||||
#endif
|
||||
entry->metadata_str.c = NULL;
|
||||
entry->metadata_str.len = 0;
|
||||
}
|
||||
@@ -2328,11 +2055,7 @@ static void phar_copy_cached_phar(phar_archive_data **pphar TSRMLS_DC) /* {{{ */
|
||||
ALLOC_ZVAL(phar->metadata);
|
||||
*phar->metadata = *t;
|
||||
zval_copy_ctor(phar->metadata);
|
||||
#if PHP_VERSION_ID < 50300
|
||||
phar->metadata->refcount = 1;
|
||||
#else
|
||||
Z_SET_REFCOUNT_P(phar->metadata, 1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -578,10 +578,6 @@ foundit:
|
||||
/* construct actual offset to file start - local extra_len can be different from central extra_len */
|
||||
entry.offset = entry.offset_abs =
|
||||
sizeof(local) + entry.header_offset + PHAR_GET_16(local.filename_len) + PHAR_GET_16(local.extra_len);
|
||||
#if PHP_VERSION_ID < 50207
|
||||
/* work around Bug #46147 */
|
||||
fp->writepos = fp->readpos = 0;
|
||||
#endif
|
||||
php_stream_seek(fp, entry.offset, SEEK_SET);
|
||||
/* these next lines should be for php < 5.2.6 after 5.3 filters are fixed */
|
||||
fp->writepos = 0;
|
||||
@@ -605,9 +601,6 @@ foundit:
|
||||
|
||||
if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) {
|
||||
pefree(entry.filename, entry.is_persistent);
|
||||
#if PHP_VERSION_ID < 50207
|
||||
PHAR_ZIP_FAIL("unable to read in alias, truncated (PHP 5.2.7 and newer has a potential fix for this problem)");
|
||||
#endif
|
||||
PHAR_ZIP_FAIL("unable to read in alias, truncated");
|
||||
}
|
||||
|
||||
@@ -626,9 +619,6 @@ foundit:
|
||||
|
||||
if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) {
|
||||
pefree(entry.filename, entry.is_persistent);
|
||||
#if PHP_VERSION_ID < 50207
|
||||
PHAR_ZIP_FAIL("unable to read in alias, truncated (PHP 5.2.7 and newer has a potential fix for this problem)");
|
||||
#endif
|
||||
PHAR_ZIP_FAIL("unable to read in alias, truncated");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
--TEST--
|
||||
posix_getgrnam(): Basic tests
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
|
||||
if (!function_exists('posix_getgrnam')) die('skip posix_getgrnam() not found');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(posix_getgrnam(NULL));
|
||||
var_dump(posix_getgrnam(1));
|
||||
var_dump(posix_getgrnam(''));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -1,23 +0,0 @@
|
||||
--TEST--
|
||||
posix_getgrnam(): Basic tests
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
|
||||
if (!function_exists('posix_getgrnam')) die('skip posix_getgrnam() not found');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo "Basic test of POSIX posix_getgrnam function\n";
|
||||
|
||||
var_dump(posix_getgrnam(NULL));
|
||||
var_dump(posix_getgrnam(1));
|
||||
var_dump(posix_getgrnam(''));
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
Basic test of POSIX posix_getgrnam function
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -1,19 +0,0 @@
|
||||
--TEST--
|
||||
posix_getpwnam(): Basic tests
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
|
||||
if (!function_exists('posix_getpwnam')) die('skip posix_getpwnam() not found');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(posix_getpwnam(1));
|
||||
var_dump(posix_getpwnam(''));
|
||||
var_dump(posix_getpwnam(NULL));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -1,23 +0,0 @@
|
||||
--TEST--
|
||||
posix_getpwnam(): Basic tests
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
|
||||
if (!function_exists('posix_getpwnam')) die('skip posix_getpwnam() not found');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo "Basic test of POSIX posix_getpwnam function\n";
|
||||
|
||||
var_dump(posix_getpwnam(1));
|
||||
var_dump(posix_getpwnam(''));
|
||||
var_dump(posix_getpwnam(NULL));
|
||||
|
||||
?>
|
||||
===DONE====
|
||||
--EXPECT--
|
||||
Basic test of POSIX posix_getpwnam function
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
===DONE====
|
||||
@@ -170,7 +170,10 @@ ZEND_GET_MODULE(readline)
|
||||
|
||||
PHP_MINIT_FUNCTION(readline)
|
||||
{
|
||||
using_history();
|
||||
#if HAVE_LIBREADLINE
|
||||
/* libedit don't need this call which set the tty in cooked mode */
|
||||
using_history();
|
||||
#endif
|
||||
return PHP_MINIT(cli_readline)(INIT_FUNC_ARGS_PASSTHRU);
|
||||
}
|
||||
|
||||
|
||||
+10
-9
@@ -2644,16 +2644,17 @@ static sdlAttributePtr make_persistent_sdl_attribute(sdlAttributePtr attr, HashT
|
||||
|
||||
zend_hash_internal_pointer_reset(pattr->extraAttributes);
|
||||
while (zend_hash_get_current_data(attr->extraAttributes, (void**)&tmp) == SUCCESS) {
|
||||
pextra = malloc(sizeof(sdlExtraAttribute));
|
||||
memset(pextra, 0, sizeof(sdlExtraAttribute));
|
||||
if ((*tmp)->ns) {
|
||||
pextra->ns = strdup((*tmp)->ns);
|
||||
}
|
||||
if ((*tmp)->val) {
|
||||
pextra->val = strdup((*tmp)->val);
|
||||
}
|
||||
if (zend_hash_get_current_key_ex(attr->extraAttributes, &key, &key_len, &index, 0, NULL) == HASH_KEY_IS_STRING) {
|
||||
pextra = malloc(sizeof(sdlExtraAttribute));
|
||||
memset(pextra, 0, sizeof(sdlExtraAttribute));
|
||||
|
||||
if (zend_hash_get_current_key_ex(attr->extraAttributes, &key, &key_len, &index, 0, NULL) == HASH_KEY_IS_STRING) {
|
||||
if ((*tmp)->ns) {
|
||||
pextra->ns = strdup((*tmp)->ns);
|
||||
}
|
||||
if ((*tmp)->val) {
|
||||
pextra->val = strdup((*tmp)->val);
|
||||
}
|
||||
|
||||
zend_hash_add(pattr->extraAttributes, key, key_len, (void*)&pextra, sizeof(sdlExtraAttributePtr), NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -1257,7 +1257,7 @@ void to_zval_read_msghdr(const char *msghdr_c, zval *zv, res_context *ctx)
|
||||
/* CONVERSIONS for if_index */
|
||||
static void from_zval_write_ifindex(const zval *zv, char *uinteger, ser_context *ctx)
|
||||
{
|
||||
unsigned ret;
|
||||
unsigned ret = 0;
|
||||
zval lzval = zval_used_for_init;
|
||||
|
||||
if (Z_TYPE_P(zv) == IS_LONG) {
|
||||
|
||||
@@ -7,16 +7,16 @@ Erwin Poeze <erwin.poeze@gmail.com>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
file_put_contents('testdata.csv', 'eerste;tweede;derde');
|
||||
file_put_contents('SplFileObject_getflags_basic.csv', 'eerste;tweede;derde');
|
||||
|
||||
$fo = new SplFileObject('testdata.csv');
|
||||
$fo = new SplFileObject('SplFileObject_getflags_basic.csv');
|
||||
|
||||
$fo->setFlags(SplFileObject::DROP_NEW_LINE);
|
||||
var_dump($fo->getFlags());
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink('testdata.csv');
|
||||
unlink('SplFileObject_getflags_basic.csv');
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
@@ -7,10 +7,10 @@ Erwin Poeze <erwin.poeze@gmail.com>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
file_put_contents('testdata.csv', 'eerste;tweede;derde');
|
||||
file_put_contents('SplFileObject_getflags_error001.csv', 'eerste;tweede;derde');
|
||||
|
||||
|
||||
$fo = new SplFileObject('testdata.csv');
|
||||
$fo = new SplFileObject('SplFileObject_getflags_error001.csv');
|
||||
$fo->setFlags(SplFileObject::READ_CSV);
|
||||
|
||||
$fo->setFlags(SplFileObject::DROP_NEW_LINE);
|
||||
@@ -20,7 +20,7 @@ var_dump($fo->getFlags());
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink('testdata.csv');
|
||||
unlink('SplFileObject_getflags_error001.csv');
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
Loaded 100 of 205 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user