mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-13 12:10:50 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f94c1df85f | ||
|
|
9a51848409 | ||
|
|
a2cda214d6 | ||
|
|
8d553829cc | ||
|
|
5818f5db62 | ||
|
|
e194927b26 | ||
|
|
2d7461f7bf | ||
|
|
5f64da15bb | ||
|
|
939409d36f | ||
|
|
4c4a354223 | ||
|
|
c7c360ed37 | ||
|
|
4879eb7242 | ||
|
|
43c72ea2cb | ||
|
|
dc5f587e07 | ||
|
|
4465b0f415 | ||
|
|
4310db437a | ||
|
|
725748cd25 | ||
|
|
d841843c2f | ||
|
|
ee8e2373ac | ||
|
|
afcda556be | ||
|
|
2f57d19f76 | ||
|
|
78e8b1511c | ||
|
|
0b89bb83ba | ||
|
|
dff820cea3 | ||
|
|
4f2563329b | ||
|
|
3b78a24ee9 | ||
|
|
0b648a424f | ||
|
|
3571a68ab9 | ||
|
|
edb2799333 | ||
|
|
bf2f80b223 | ||
|
|
372844918a | ||
|
|
f86b2193a4 | ||
|
|
da7c87e2f8 | ||
|
|
7e9daf60c1 | ||
|
|
b9ac5e23fb | ||
|
|
aca474fa14 | ||
|
|
99f0760bfb | ||
|
|
8d1099ac05 | ||
|
|
4bdd9aabdd | ||
|
|
bdac08bcdd | ||
|
|
d2e1a04b10 | ||
|
|
0cbfdc9df5 | ||
|
|
bc44eb6172 | ||
|
|
03797a73b2 | ||
|
|
9586b15229 | ||
|
|
15c139b99a | ||
|
|
f10d194c8c | ||
|
|
af3bd57d33 | ||
|
|
fa08ff9245 | ||
|
|
b85b78db4f | ||
|
|
b16929ca72 | ||
|
|
bba16dde5d | ||
|
|
582f42b8d4 | ||
|
|
9befa8c5f7 | ||
|
|
9266227402 | ||
|
|
627704b38e | ||
|
|
72c9b0e12b | ||
|
|
592df89027 | ||
|
|
3e7d11b632 | ||
|
|
a734acd439 | ||
|
|
5e95b61639 | ||
|
|
0c6e2b5219 | ||
|
|
70f92aa97e | ||
|
|
fe551c089a | ||
|
|
63f42adbb2 | ||
|
|
af85eff5b6 | ||
|
|
53fa6c5b6b | ||
|
|
834daa455b | ||
|
|
7533243f0c | ||
|
|
47d630e7f0 | ||
|
|
f54451cf39 | ||
|
|
8da58e36b4 | ||
|
|
83bacd2fe0 | ||
|
|
57f82819e9 | ||
|
|
4b9fcc01d4 | ||
|
|
30aceaf1a7 | ||
|
|
197095c29e | ||
|
|
f89b7ec389 | ||
|
|
21446cd7b6 | ||
|
|
e665a07ab9 | ||
|
|
f0ba3e265a | ||
|
|
65c1e14cb9 | ||
|
|
1bf996b324 | ||
|
|
5270ee1aef | ||
|
|
d7368c2531 | ||
|
|
daefca44b5 | ||
|
|
c301467f9b | ||
|
|
13b45a36f0 | ||
|
|
210e35a2fa | ||
|
|
49d6472f9f | ||
|
|
cd38d72eee | ||
|
|
08c63e2a56 | ||
|
|
e55c641792 | ||
|
|
b206b0e29d | ||
|
|
ee275e34c8 | ||
|
|
a8b97086d7 | ||
|
|
b38ca3adee | ||
|
|
302ccc195b | ||
|
|
fc5f931663 | ||
|
|
db03216e62 | ||
|
|
30a73658c6 | ||
|
|
32be79dcfa | ||
|
|
4d667eeaf3 | ||
|
|
7fac56e072 | ||
|
|
1d6e9e8fb7 | ||
|
|
f39ff29366 | ||
|
|
bd3e758cf8 | ||
|
|
7ec03b481a | ||
|
|
b165be9ae1 | ||
|
|
f7b7c14594 | ||
|
|
86b2d7b523 | ||
|
|
e0a177d676 | ||
|
|
1e1b7c74fb | ||
|
|
52f35b984c | ||
|
|
dbe8c37476 | ||
|
|
ffab52ad7d | ||
|
|
f463523cda | ||
|
|
546a32e2b3 | ||
|
|
640214701c | ||
|
|
6e87b01e95 | ||
|
|
c8b3bce407 | ||
|
|
bda1cc6946 | ||
|
|
86966a092b | ||
|
|
a90d05a430 | ||
|
|
cb41a7bad1 | ||
|
|
437612f656 | ||
|
|
ce9bdae33f | ||
|
|
3b82c4e520 | ||
|
|
c4fb183b9f | ||
|
|
54fbbded37 | ||
|
|
dbbf1c2a3c | ||
|
|
76c2a9f4f4 | ||
|
|
e02616866f | ||
|
|
43ed561222 | ||
|
|
e9166fec62 | ||
|
|
d3ca974ff5 | ||
|
|
713e9a7eaa | ||
|
|
89d3a356d1 | ||
|
|
6da2a977fc | ||
|
|
2dfabd8b51 | ||
|
|
6424bf659d | ||
|
|
42e1df9b01 | ||
|
|
825ddbb3c6 | ||
|
|
9185cfd539 | ||
|
|
f4120e53c8 | ||
|
|
6d19358ae0 | ||
|
|
20941b71aa | ||
|
|
96f812e411 | ||
|
|
ac0c864c63 | ||
|
|
6aa7466492 | ||
|
|
d382d6f3dc | ||
|
|
9360b6eeee | ||
|
|
aa6dc6c108 | ||
|
|
276bead9c4 | ||
|
|
359bc0ee2f | ||
|
|
a309dda777 | ||
|
|
ac4569621d | ||
|
|
cbe1597b74 | ||
|
|
fae17a00f5 | ||
|
|
b278be894f | ||
|
|
5a7039035c | ||
|
|
eb2360602e | ||
|
|
cdd987b16c | ||
|
|
230804b08d | ||
|
|
335d89ec4d | ||
|
|
5e9e0a2c74 | ||
|
|
88c48a4b95 | ||
|
|
2fefae4771 | ||
|
|
2b10db8e10 | ||
|
|
706aefb781 | ||
|
|
529da0f74c | ||
|
|
77cc6aabb7 | ||
|
|
299d8f339f | ||
|
|
05d1612e16 | ||
|
|
36d05d75c8 | ||
|
|
2b9af967fb | ||
|
|
d07f49118a | ||
|
|
003c2c1005 | ||
|
|
f1d0e50ea8 | ||
|
|
fac08a960b | ||
|
|
1504f7d630 | ||
|
|
56d02d564e | ||
|
|
be2128c805 | ||
|
|
3f42f2f5d1 | ||
|
|
c6d9bf2946 | ||
|
|
032dee4982 | ||
|
|
6279246d2c | ||
|
|
48dc203408 | ||
|
|
7c4b5d9187 | ||
|
|
0407bdf252 | ||
|
|
7bfe9bf951 | ||
|
|
3e6cfeed8f | ||
|
|
7ba1409a1a | ||
|
|
23122ba69c | ||
|
|
59c2477bc3 | ||
|
|
3468f03b6f | ||
|
|
35f32637b0 | ||
|
|
49387b31cf | ||
|
|
ed7ab762de | ||
|
|
ff4cf1a838 | ||
|
|
eab42649ab | ||
|
|
41fccab023 | ||
|
|
008330e5b3 | ||
|
|
b7cd099ae0 | ||
|
|
4185633207 | ||
|
|
ad492ca932 | ||
|
|
481c4715d4 | ||
|
|
4e2c01617f | ||
|
|
c044164a96 | ||
|
|
a68f63156c | ||
|
|
d1dd71454d | ||
|
|
aeb633543b | ||
|
|
7311087cf0 | ||
|
|
1355ea60cc | ||
|
|
5e338836ff | ||
|
|
32314f6b67 | ||
|
|
babeca356b | ||
|
|
1847cf10c1 | ||
|
|
7fbc99e390 | ||
|
|
e4905b38b7 | ||
|
|
4b85f1d46a | ||
|
|
fd28010e20 | ||
|
|
990ecc12fc | ||
|
|
0fe07a0e74 | ||
|
|
1ffb7fddc2 | ||
|
|
c74efe1b2e | ||
|
|
b5051ff939 | ||
|
|
e2ba5c7987 | ||
|
|
8e9777a1f1 | ||
|
|
e644aad3f9 | ||
|
|
8ab4e2e90d | ||
|
|
b512adf78d | ||
|
|
2fe5bcbeb5 | ||
|
|
892def5f12 | ||
|
|
8d1d038509 | ||
|
|
6bd5a06894 | ||
|
|
ec002bd837 | ||
|
|
52de149ebc | ||
|
|
2326401fc1 | ||
|
|
7f527897fe | ||
|
|
d4b67896ec | ||
|
|
84605098bc | ||
|
|
ee1ab62763 | ||
|
|
d77ea459bd | ||
|
|
44be7b7f27 | ||
|
|
0335d2ef3e | ||
|
|
a0bb3fd679 | ||
|
|
eca037a51d | ||
|
|
f3230e3522 | ||
|
|
3c328f0984 | ||
|
|
d780c2a673 | ||
|
|
d400b74296 | ||
|
|
08334293f8 |
No files matched your search
+8
-4
@@ -45,15 +45,16 @@ Currently we have the following branches in use::
|
||||
|
||||
master The active development branch.
|
||||
|
||||
PHP-5.6 Is used to release the PHP 5.6.x series. This is a current
|
||||
stable version and is open for bugfixes only.
|
||||
|
||||
PHP-5.5 Is used to release the PHP 5.5.x series. This is a current
|
||||
stable version and is open for bugfixes only.
|
||||
|
||||
PHP-5.4 Is used to release the PHP 5.4.x series. This is a current
|
||||
stable version and is open for bugfixes only.
|
||||
|
||||
PHP-5.3 Is used to release the PHP 5.3.x series. This is currently
|
||||
in extended support and open forsecurity fixes only. Triaged
|
||||
via security@php.net
|
||||
PHP-5.3 This branch is closed.
|
||||
|
||||
PHP-5.2 This branch is closed.
|
||||
|
||||
@@ -61,9 +62,12 @@ Currently we have the following branches in use::
|
||||
|
||||
PHP-4.4 This branch is closed.
|
||||
|
||||
PHP-X.Y.Z These branches are used for the release managers for tagging
|
||||
the releases, hence they are closed to the general public.
|
||||
|
||||
The next few rules are more of a technical nature::
|
||||
|
||||
1. All changes should first go to the lowest branch (i.e. 5.3) and then
|
||||
1. All changes should first go to the lowest branch (i.e. 5.4) and then
|
||||
get merged up to all other branches. If a change is not needed for
|
||||
later branches (i.e. fixes for features which where dropped from later
|
||||
branches) an empty merge should be done.
|
||||
|
||||
@@ -232,6 +232,13 @@ PHP 5.6 UPGRADE NOTES
|
||||
crypto method from the context is used as a fallback if no crypto method is
|
||||
specified at call-time.
|
||||
|
||||
- Reflection:
|
||||
ReflectionClass::newInstanceWithoutConstructor previously didn't allow the
|
||||
instantiation of any internal class which used custom object storage
|
||||
(overriding the default create_object handler), this was changed to only
|
||||
reject the instantiation of such classes if the class is also marked as
|
||||
final.
|
||||
|
||||
- XMLReader:
|
||||
XMLReader::getAttributeNs and XMLReader::getAttributeNo now return NULL if
|
||||
the attribute could not be found, just like XMLReader::getAttribute.
|
||||
@@ -249,12 +256,19 @@ PHP 5.6 UPGRADE NOTES
|
||||
Manipulated serialization strings for objects implementing Serializable by
|
||||
replacing "C:" with "O:" at the start will now produce an error.
|
||||
|
||||
- parse_ini_file():
|
||||
- parse_ini_string():
|
||||
Added scanner mode INI_SCANNER_TYPED to yield typed .ini values.
|
||||
For PHP >= 5.6.1
|
||||
|
||||
========================================
|
||||
6. New Functions
|
||||
========================================
|
||||
|
||||
- GMP:
|
||||
Added gmp_root($a, $nth) and gmp_rootrem($a, $nth) for calculating nth roots.
|
||||
Added gmp_import($data, $word_size = 1, $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN) in PHP 5.6.1.
|
||||
Added gmp_export($gmpnumber, $word_size = 1, $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN) in PHP 5.6.1.
|
||||
|
||||
- Hash
|
||||
Added hash_equals($known_string, $user_string)
|
||||
@@ -362,6 +376,9 @@ PHP 5.6 UPGRADE NOTES
|
||||
- Added LISTEN/NOTIFY support via PDO::pgsqlGetNotify / PDO::pgsqlGetPid()
|
||||
as described in https://bugs.php.net/bug.php?id=42614.
|
||||
|
||||
- DOM:
|
||||
- DOMNode::textContent is now a writeable property. (>= 5.6.1)
|
||||
|
||||
========================================
|
||||
10. New Global Constants
|
||||
========================================
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
$Id$
|
||||
|
||||
UPGRADE NOTES - PHP X.Y
|
||||
PHP 5.6 INTERNALS UPGRADE NOTES
|
||||
|
||||
1. Internal API changes
|
||||
a. Addition of do_operation and compare object handlers
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #67938: Segfault when extending interface method with variadic
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
interface TestInterface {
|
||||
public function foo();
|
||||
public function bar(array $bar);
|
||||
}
|
||||
|
||||
class Test implements TestInterface {
|
||||
public function foo(...$args) {
|
||||
echo __METHOD__, "\n";
|
||||
}
|
||||
public function bar(array $bar, ...$args) {
|
||||
echo __METHOD__, "\n";
|
||||
}
|
||||
}
|
||||
|
||||
$obj = new Test;
|
||||
$obj->foo();
|
||||
$obj->bar([]);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Test::foo
|
||||
Test::bar
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #67985 - Last used array index not copied to new array at assignment
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$a = ['zero', 'one', 'two'];
|
||||
unset($a[2]);
|
||||
$b = $a;
|
||||
$a[] = 'three';
|
||||
$b[] = 'three';
|
||||
|
||||
var_dump($a === $b);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
+14
@@ -822,6 +822,20 @@ void zend_shutdown(TSRMLS_D) /* {{{ */
|
||||
zend_shutdown_timeout_thread();
|
||||
#endif
|
||||
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
|
||||
|
||||
if (EG(active))
|
||||
{
|
||||
/*
|
||||
* The order of destruction is important here.
|
||||
* See bugs #65463 and 66036.
|
||||
*/
|
||||
zend_hash_reverse_apply(GLOBAL_FUNCTION_TABLE, (apply_func_t) zend_cleanup_function_data_full TSRMLS_CC);
|
||||
zend_hash_reverse_apply(GLOBAL_CLASS_TABLE, (apply_func_t) zend_cleanup_user_class_data TSRMLS_CC);
|
||||
zend_cleanup_internal_classes(TSRMLS_C);
|
||||
zend_hash_reverse_apply(GLOBAL_FUNCTION_TABLE, (apply_func_t) clean_non_persistent_function_full TSRMLS_CC);
|
||||
zend_hash_reverse_apply(GLOBAL_CLASS_TABLE, (apply_func_t) clean_non_persistent_class_full TSRMLS_CC);
|
||||
}
|
||||
|
||||
zend_destroy_modules();
|
||||
|
||||
virtual_cwd_deactivate(TSRMLS_C);
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
#ifndef ZEND_H
|
||||
#define ZEND_H
|
||||
|
||||
#define ZEND_VERSION "2.6.0-dev"
|
||||
#define ZEND_VERSION "2.6.0"
|
||||
|
||||
#define ZEND_ENGINE_2
|
||||
|
||||
|
||||
+1
-1
@@ -3258,7 +3258,7 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c
|
||||
* go through all the parameters of the function and not just those present in the
|
||||
* prototype. */
|
||||
num_args = proto->common.num_args;
|
||||
if ((fe->common.fn_flags & ZEND_ACC_VARIADIC)
|
||||
if ((proto->common.fn_flags & ZEND_ACC_VARIADIC)
|
||||
&& fe->common.num_args > proto->common.num_args) {
|
||||
num_args = fe->common.num_args;
|
||||
}
|
||||
|
||||
@@ -686,6 +686,8 @@ ZEND_API void zend_cleanup_internal_class_data(zend_class_entry *ce TSRMLS_DC);
|
||||
ZEND_API void zend_cleanup_internal_classes(TSRMLS_D);
|
||||
ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC);
|
||||
ZEND_API int zend_cleanup_function_data_full(zend_function *function TSRMLS_DC);
|
||||
ZEND_API int clean_non_persistent_function_full(zend_function *function TSRMLS_DC);
|
||||
ZEND_API int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC);
|
||||
|
||||
ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC);
|
||||
ZEND_API void zend_function_dtor(zend_function *function);
|
||||
|
||||
@@ -109,7 +109,7 @@ static int clean_non_persistent_function(zend_function *function TSRMLS_DC) /* {
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int clean_non_persistent_function_full(zend_function *function TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int clean_non_persistent_function_full(zend_function *function TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return (function->type == ZEND_INTERNAL_FUNCTION) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
@@ -121,7 +121,7 @@ static int clean_non_persistent_class(zend_class_entry **ce TSRMLS_DC) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return ((*ce)->type == ZEND_INTERNAL_CLASS) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
|
||||
+1
-1
@@ -283,7 +283,7 @@ struct _zend_ini_scanner_globals {
|
||||
char *filename;
|
||||
int lineno;
|
||||
|
||||
/* Modes are: ZEND_INI_SCANNER_NORMAL, ZEND_INI_SCANNER_RAW */
|
||||
/* Modes are: ZEND_INI_SCANNER_NORMAL, ZEND_INI_SCANNER_RAW, ZEND_INI_SCANNER_TYPED */
|
||||
int scanner_mode;
|
||||
};
|
||||
|
||||
|
||||
@@ -265,6 +265,7 @@ ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, int s
|
||||
%token TC_QUOTED_STRING
|
||||
%token BOOL_TRUE
|
||||
%token BOOL_FALSE
|
||||
%token NULL_NULL
|
||||
%token END_OF_LINE
|
||||
%token '=' ':' ',' '.' '"' '\'' '^' '+' '-' '/' '*' '%' '$' '~' '<' '>' '?' '@' '{' '}'
|
||||
%left '|' '&' '^'
|
||||
@@ -291,7 +292,7 @@ statement:
|
||||
#endif
|
||||
ZEND_INI_PARSER_CB(&$1, &$3, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC);
|
||||
free(Z_STRVAL($1));
|
||||
free(Z_STRVAL($3));
|
||||
zval_internal_dtor(&$3);
|
||||
}
|
||||
| TC_OFFSET option_offset ']' '=' string_or_value {
|
||||
#if DEBUG_CFG_PARSER
|
||||
@@ -300,7 +301,7 @@ statement:
|
||||
ZEND_INI_PARSER_CB(&$1, &$5, &$2, ZEND_INI_PARSER_POP_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC);
|
||||
free(Z_STRVAL($1));
|
||||
free(Z_STRVAL($2));
|
||||
free(Z_STRVAL($5));
|
||||
zval_internal_dtor(&$5);
|
||||
}
|
||||
| TC_LABEL { ZEND_INI_PARSER_CB(&$1, NULL, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC); free(Z_STRVAL($1)); }
|
||||
| END_OF_LINE
|
||||
@@ -315,6 +316,7 @@ string_or_value:
|
||||
expr { $$ = $1; }
|
||||
| BOOL_TRUE { $$ = $1; }
|
||||
| BOOL_FALSE { $$ = $1; }
|
||||
| NULL_NULL { $$ = $1; }
|
||||
| END_OF_LINE { zend_ini_init_string(&$$); }
|
||||
;
|
||||
|
||||
|
||||
+4827
-4663
File diff suppressed because it is too large.
Load diff
@@ -25,6 +25,7 @@
|
||||
/* Scanner modes */
|
||||
#define ZEND_INI_SCANNER_NORMAL 0 /* Normal mode. [DEFAULT] */
|
||||
#define ZEND_INI_SCANNER_RAW 1 /* Raw mode. Option values are not parsed */
|
||||
#define ZEND_INI_SCANNER_TYPED 2 /* Typed mode. */
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
int zend_ini_scanner_get_lineno(TSRMLS_D);
|
||||
|
||||
+56
-5
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include "zend.h"
|
||||
#include "zend_API.h"
|
||||
#include "zend_globals.h"
|
||||
#include <zend_ini_parser.h>
|
||||
#include "zend_ini_scanner.h"
|
||||
@@ -137,9 +138,55 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals;
|
||||
Z_TYPE_P(retval) = IS_STRING; \
|
||||
}
|
||||
|
||||
#define RETURN_TOKEN(type, str, len) { \
|
||||
zend_ini_copy_value(ini_lval, str, len); \
|
||||
return type; \
|
||||
#define RETURN_TOKEN(type, str, len) { \
|
||||
if (SCNG(scanner_mode) == ZEND_INI_SCANNER_TYPED) { \
|
||||
zend_ini_copy_typed_value(ini_lval, type, str, len); \
|
||||
} else { \
|
||||
zend_ini_copy_value(ini_lval, str, len); \
|
||||
} \
|
||||
return type; \
|
||||
}
|
||||
|
||||
static inline int convert_to_number(zval *retval, const char *str, const int str_len)
|
||||
{
|
||||
zend_uchar type;
|
||||
int overflow;
|
||||
long lval;
|
||||
double dval;
|
||||
|
||||
if ((type = is_numeric_string_ex(str, str_len, &lval, &dval, 0, &overflow)) != 0) {
|
||||
if (type == IS_LONG) {
|
||||
ZVAL_LONG(retval, lval);
|
||||
return SUCCESS;
|
||||
} else if (type == IS_DOUBLE && !overflow) {
|
||||
ZVAL_DOUBLE(retval, dval);
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
static void zend_ini_copy_typed_value(zval *retval, const int type, const char *str, int len)
|
||||
{
|
||||
switch (type) {
|
||||
case BOOL_FALSE:
|
||||
case BOOL_TRUE:
|
||||
ZVAL_BOOL(retval, type == BOOL_TRUE);
|
||||
break;
|
||||
|
||||
case NULL_NULL:
|
||||
ZVAL_NULL(retval);
|
||||
break;
|
||||
|
||||
case TC_NUMBER:
|
||||
if (convert_to_number(retval, str, len) == SUCCESS) {
|
||||
break;
|
||||
}
|
||||
/* intentional fall-through */
|
||||
default:
|
||||
zend_ini_copy_value(retval, str, len);
|
||||
}
|
||||
}
|
||||
|
||||
static void _yy_push_state(int new_state TSRMLS_DC)
|
||||
@@ -172,7 +219,7 @@ static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC)
|
||||
static int init_ini_scanner(int scanner_mode, zend_file_handle *fh TSRMLS_DC)
|
||||
{
|
||||
/* Sanity check */
|
||||
if (scanner_mode != ZEND_INI_SCANNER_NORMAL && scanner_mode != ZEND_INI_SCANNER_RAW) {
|
||||
if (scanner_mode != ZEND_INI_SCANNER_NORMAL && scanner_mode != ZEND_INI_SCANNER_RAW && scanner_mode != ZEND_INI_SCANNER_TYPED) {
|
||||
zend_error(E_WARNING, "Invalid scanner mode");
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -422,10 +469,14 @@ SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR})
|
||||
RETURN_TOKEN(BOOL_TRUE, "1", 1);
|
||||
}
|
||||
|
||||
<INITIAL,ST_VALUE>("false"|"off"|"no"|"none"|"null"){TABS_AND_SPACES}* { /* FALSE value (when used outside option value/offset this causes parse error!)*/
|
||||
<INITIAL,ST_VALUE>("false"|"off"|"no"|"none"){TABS_AND_SPACES}* { /* FALSE value (when used outside option value/offset this causes parse error!)*/
|
||||
RETURN_TOKEN(BOOL_FALSE, "", 0);
|
||||
}
|
||||
|
||||
<INITIAL,ST_VALUE>("null"){TABS_AND_SPACES}* {
|
||||
RETURN_TOKEN(NULL_NULL, "", 0);
|
||||
}
|
||||
|
||||
<INITIAL>{LABEL} { /* Get option name */
|
||||
/* Eat leading whitespace */
|
||||
EAT_LEADING_WHITESPACE();
|
||||
|
||||
@@ -138,6 +138,7 @@ ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
ALLOC_HASHTABLE_REL(tmp_ht);
|
||||
zend_hash_init(tmp_ht, zend_hash_num_elements(original_ht), NULL, ZVAL_PTR_DTOR, 0);
|
||||
zend_hash_copy(tmp_ht, original_ht, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
|
||||
tmp_ht->nNextFreeElement = original_ht->nNextFreeElement;
|
||||
zvalue->value.ht = tmp_ht;
|
||||
}
|
||||
break;
|
||||
|
||||
+1
-1
@@ -2800,7 +2800,7 @@ AC_DEFUN([PHP_DETECT_ICC],
|
||||
|
||||
dnl PHP_DETECT_SUNCC
|
||||
dnl Detect if the systems default compiler is suncc.
|
||||
dnl We also set some usefull CFLAGS if the user didn't set any
|
||||
dnl We also set some useful CFLAGS if the user didn't set any
|
||||
AC_DEFUN([PHP_DETECT_SUNCC],[
|
||||
SUNCC="no"
|
||||
AC_MSG_CHECKING([for suncc])
|
||||
|
||||
Vendored
+9
-3
@@ -615,7 +615,7 @@ ia64-*-hpux*)
|
||||
rm -rf conftest*
|
||||
;;
|
||||
|
||||
x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
|
||||
x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
|
||||
s390*-*linux*|sparc*-*linux*)
|
||||
# Find out which ABI we are using.
|
||||
echo 'int i;' > conftest.$ac_ext
|
||||
@@ -629,7 +629,10 @@ s390*-*linux*|sparc*-*linux*)
|
||||
x86_64-*linux*)
|
||||
LD="${LD-ld} -m elf_i386"
|
||||
;;
|
||||
ppc64-*linux*|powerpc64-*linux*)
|
||||
powerpc64le-*linux*)
|
||||
LD="${LD-ld} -m elf32lppclinux"
|
||||
;;
|
||||
powerpc64-*linux*)
|
||||
LD="${LD-ld} -m elf32ppclinux"
|
||||
;;
|
||||
s390x-*linux*)
|
||||
@@ -648,7 +651,10 @@ s390*-*linux*|sparc*-*linux*)
|
||||
x86_64-*linux*)
|
||||
LD="${LD-ld} -m elf_x86_64"
|
||||
;;
|
||||
ppc*-*linux*|powerpc*-*linux*)
|
||||
powerpcle-*linux*)
|
||||
LD="${LD-ld} -m elf64lppc"
|
||||
;;
|
||||
powerpc-*linux*)
|
||||
LD="${LD-ld} -m elf64ppc"
|
||||
;;
|
||||
s390*-*linux*)
|
||||
|
||||
Vendored
+6
@@ -982,6 +982,12 @@ EOF
|
||||
ppc:Linux:*:*)
|
||||
echo powerpc-unknown-linux-gnu
|
||||
exit ;;
|
||||
ppc64le:Linux:*:*)
|
||||
echo powerpc64le-unknown-linux-gnu
|
||||
exit ;;
|
||||
ppcle:Linux:*:*)
|
||||
echo powerpcle-unknown-linux-gnu
|
||||
exit ;;
|
||||
s390:Linux:*:* | s390x:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-ibm-linux
|
||||
exit ;;
|
||||
|
||||
+24
-10
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=6
|
||||
PHP_RELEASE_VERSION=0
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=2
|
||||
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`
|
||||
|
||||
@@ -787,7 +787,12 @@ if test "$PHP_GCOV" = "yes"; then
|
||||
AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
|
||||
fi
|
||||
|
||||
ltp_version_list="1.5 1.6 1.7 1.9 1.10"
|
||||
dnl min: 1.5 (i.e. 105, major * 100 + minor for easier comparison)
|
||||
ltp_version_min="105"
|
||||
dnl non-working versions, e.g. "1.8 1.18";
|
||||
dnl remove "none" when introducing the first incompatible LTP version an
|
||||
dnl separate any following additions by spaces
|
||||
ltp_version_exclude="1.8"
|
||||
|
||||
AC_CHECK_PROG(LTP, lcov, lcov)
|
||||
AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)
|
||||
@@ -797,21 +802,30 @@ if test "$PHP_GCOV" = "yes"; then
|
||||
if test "$LTP"; then
|
||||
AC_CACHE_CHECK([for ltp version], php_cv_ltp_version, [
|
||||
php_cv_ltp_version=invalid
|
||||
ltp_version=`$LTP -v 2>/dev/null | $SED -e 's/^.* //'`
|
||||
for ltp_check_version in $ltp_version_list; do
|
||||
if test "$ltp_version" = "$ltp_check_version"; then
|
||||
php_cv_ltp_version="$ltp_check_version (ok)"
|
||||
ltp_version_vars=`$LTP -v 2>/dev/null | $SED -e 's/^.* //' -e 's/\./ /g' | tr -d a-z`
|
||||
if test -n "$ltp_version_vars"; then
|
||||
set $ltp_version_vars
|
||||
ltp_version="${1}.${2}"
|
||||
ltp_version_num="`expr ${1} \* 100 + ${2}`"
|
||||
if test $ltp_version_num -ge $ltp_version_min; then
|
||||
php_cv_ltp_version="$ltp_version (ok)"
|
||||
for ltp_check_version in $ltp_version_exclude; do
|
||||
if test "$ltp_version" = "$ltp_check_version"; then
|
||||
php_cv_ltp_version=invalid
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
fi
|
||||
])
|
||||
else
|
||||
ltp_msg="To enable code coverage reporting you must have one of the following LTP versions installed: $ltp_version_list"
|
||||
ltp_msg="To enable code coverage reporting you must have LTP installed"
|
||||
AC_MSG_ERROR([$ltp_msg])
|
||||
fi
|
||||
|
||||
case $php_cv_ltp_version in
|
||||
""|invalid[)]
|
||||
ltp_msg="You must have one of the following versions of LTP: $ltp_version_list (found: $ltp_version)."
|
||||
ltp_msg="This LTP version is not supported (found: $ltp_version, min: $ltp_version_min, excluded: $ltp_version_exclude)."
|
||||
AC_MSG_ERROR([$ltp_msg])
|
||||
LTP="exit 0;"
|
||||
;;
|
||||
|
||||
@@ -169,6 +169,11 @@ static int php_curl_option_str(php_curl *ch, long option, const char *str, const
|
||||
{
|
||||
CURLcode error = CURLE_OK;
|
||||
|
||||
if (strlen(str) != len) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Curl option contains invalid characters (\\0)");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x071100
|
||||
if (make_copy) {
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #68089 (NULL byte injection - cURL lib)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include 'skipif.inc';
|
||||
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$url = "file:///etc/passwd\0http://google.com";
|
||||
$ch = curl_init();
|
||||
var_dump(curl_setopt($ch, CURLOPT_URL, $url));
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
Warning: curl_setopt(): Curl option contains invalid characters (\0) in %s/bug68089.php on line 4
|
||||
bool(false)
|
||||
Done
|
||||
+110
-136
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 0.13.5 on Thu Jul 31 14:33:37 2014 */
|
||||
/* Generated by re2c 0.13.5 on Mon Aug 18 18:28:27 2014 */
|
||||
#line 1 "ext/date/lib/parse_date.re"
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
@@ -670,7 +670,7 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, S
|
||||
}
|
||||
}
|
||||
|
||||
const static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffset, int isdst)
|
||||
const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffset, int isdst)
|
||||
{
|
||||
int first_found = 0;
|
||||
const timelib_tz_lookup_table *tp, *first_found_elem = NULL;
|
||||
@@ -698,25 +698,6 @@ const static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffs
|
||||
return first_found_elem;
|
||||
}
|
||||
|
||||
for (tp = timelib_timezone_lookup; tp->name; tp++) {
|
||||
if (tp->full_tz_name && strcasecmp(word, tp->full_tz_name) == 0) {
|
||||
if (!first_found) {
|
||||
first_found = 1;
|
||||
first_found_elem = tp;
|
||||
if (gmtoffset == -1) {
|
||||
return tp;
|
||||
}
|
||||
}
|
||||
if (tp->gmtoffset == gmtoffset) {
|
||||
return tp;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (first_found) {
|
||||
return first_found_elem;
|
||||
}
|
||||
|
||||
|
||||
/* Still didn't find anything, let's find the zone solely based on
|
||||
* offset/isdst then */
|
||||
for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
|
||||
@@ -727,7 +708,7 @@ const static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffs
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found)
|
||||
static long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found)
|
||||
{
|
||||
char *word;
|
||||
char *begin = *ptr, *end;
|
||||
@@ -741,7 +722,7 @@ static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found
|
||||
word = calloc(1, end - begin + 1);
|
||||
memcpy(word, begin, end - begin);
|
||||
|
||||
if ((tp = zone_search(word, -1, 0))) {
|
||||
if ((tp = abbr_search(word, -1, 0))) {
|
||||
value = -tp->gmtoffset / 60;
|
||||
*dst = tp->type;
|
||||
value += tp->type * 60;
|
||||
@@ -785,33 +766,26 @@ long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found
|
||||
retval = timelib_parse_tz_cor(ptr);
|
||||
} else {
|
||||
int found = 0;
|
||||
long offset;
|
||||
long offset = 0;
|
||||
char *tz_abbr;
|
||||
|
||||
t->is_localtime = 1;
|
||||
|
||||
offset = timelib_lookup_zone(ptr, dst, &tz_abbr, &found);
|
||||
/* First, we lookup by abbreviation only */
|
||||
offset = timelib_lookup_abbr(ptr, dst, &tz_abbr, &found);
|
||||
if (found) {
|
||||
t->zone_type = TIMELIB_ZONETYPE_ABBR;
|
||||
timelib_time_tz_abbr_update(t, tz_abbr);
|
||||
}
|
||||
#if 0
|
||||
/* If we found a TimeZone identifier, use it */
|
||||
if (tz_name) {
|
||||
t->tz_info = timelib_parse_tzfile(tz_name);
|
||||
t->zone_type = TIMELIB_ZONETYPE_ID;
|
||||
}
|
||||
#endif
|
||||
/* If we have a TimeZone identifier to start with, use it */
|
||||
if (strstr(tz_abbr, "/") || strcmp(tz_abbr, "UTC") == 0) {
|
||||
|
||||
/* Otherwise, we look if we have a TimeZone identifier */
|
||||
if (!found || strcmp("UTC", tz_abbr) == 0) {
|
||||
if ((res = tz_wrapper(tz_abbr, tzdb)) != NULL) {
|
||||
t->tz_info = res;
|
||||
t->zone_type = TIMELIB_ZONETYPE_ID;
|
||||
found++;
|
||||
}
|
||||
}
|
||||
if (found && t->zone_type != TIMELIB_ZONETYPE_ID) {
|
||||
timelib_time_tz_abbr_update(t, tz_abbr);
|
||||
}
|
||||
free(tz_abbr);
|
||||
*tz_not_found = (found == 0);
|
||||
retval = offset;
|
||||
@@ -840,11 +814,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
|
||||
std:
|
||||
s->tok = cursor;
|
||||
s->len = 0;
|
||||
#line 966 "ext/date/lib/parse_date.re"
|
||||
#line 940 "ext/date/lib/parse_date.re"
|
||||
|
||||
|
||||
|
||||
#line 848 "ext/date/lib/parse_date.c"
|
||||
#line 822 "ext/date/lib/parse_date.c"
|
||||
{
|
||||
YYCTYPE yych;
|
||||
unsigned int yyaccept = 0;
|
||||
@@ -984,7 +958,7 @@ yy2:
|
||||
}
|
||||
yy3:
|
||||
YYDEBUG(3, *YYCURSOR);
|
||||
#line 1646 "ext/date/lib/parse_date.re"
|
||||
#line 1620 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("tzcorrection | tz");
|
||||
@@ -997,7 +971,7 @@ yy3:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIMEZONE;
|
||||
}
|
||||
#line 1001 "ext/date/lib/parse_date.c"
|
||||
#line 975 "ext/date/lib/parse_date.c"
|
||||
yy4:
|
||||
YYDEBUG(4, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -1308,12 +1282,12 @@ yy11:
|
||||
if (yych <= '9') goto yy1385;
|
||||
yy12:
|
||||
YYDEBUG(12, *YYCURSOR);
|
||||
#line 1741 "ext/date/lib/parse_date.re"
|
||||
#line 1715 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
add_error(s, "Unexpected character");
|
||||
goto std;
|
||||
}
|
||||
#line 1317 "ext/date/lib/parse_date.c"
|
||||
#line 1291 "ext/date/lib/parse_date.c"
|
||||
yy13:
|
||||
YYDEBUG(13, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -2370,11 +2344,11 @@ yy48:
|
||||
if (yych <= '9') goto yy54;
|
||||
yy49:
|
||||
YYDEBUG(49, *YYCURSOR);
|
||||
#line 1730 "ext/date/lib/parse_date.re"
|
||||
#line 1704 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
goto std;
|
||||
}
|
||||
#line 2378 "ext/date/lib/parse_date.c"
|
||||
#line 2352 "ext/date/lib/parse_date.c"
|
||||
yy50:
|
||||
YYDEBUG(50, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -2383,12 +2357,12 @@ yy51:
|
||||
YYDEBUG(51, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(52, *YYCURSOR);
|
||||
#line 1735 "ext/date/lib/parse_date.re"
|
||||
#line 1709 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
s->pos = cursor; s->line++;
|
||||
goto std;
|
||||
}
|
||||
#line 2392 "ext/date/lib/parse_date.c"
|
||||
#line 2366 "ext/date/lib/parse_date.c"
|
||||
yy53:
|
||||
YYDEBUG(53, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -2775,7 +2749,7 @@ yy71:
|
||||
if (yych == 's') goto yy73;
|
||||
yy72:
|
||||
YYDEBUG(72, *YYCURSOR);
|
||||
#line 1714 "ext/date/lib/parse_date.re"
|
||||
#line 1688 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_ull i;
|
||||
DEBUG_OUTPUT("relative");
|
||||
@@ -2790,7 +2764,7 @@ yy72:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 2794 "ext/date/lib/parse_date.c"
|
||||
#line 2768 "ext/date/lib/parse_date.c"
|
||||
yy73:
|
||||
YYDEBUG(73, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -3552,7 +3526,7 @@ yy165:
|
||||
}
|
||||
yy166:
|
||||
YYDEBUG(166, *YYCURSOR);
|
||||
#line 1577 "ext/date/lib/parse_date.re"
|
||||
#line 1551 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
const timelib_relunit* relunit;
|
||||
DEBUG_OUTPUT("daytext");
|
||||
@@ -3569,7 +3543,7 @@ yy166:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_WEEKDAY;
|
||||
}
|
||||
#line 3573 "ext/date/lib/parse_date.c"
|
||||
#line 3547 "ext/date/lib/parse_date.c"
|
||||
yy167:
|
||||
YYDEBUG(167, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -4089,7 +4063,7 @@ yy192:
|
||||
}
|
||||
yy193:
|
||||
YYDEBUG(193, *YYCURSOR);
|
||||
#line 1636 "ext/date/lib/parse_date.re"
|
||||
#line 1610 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("monthtext");
|
||||
TIMELIB_INIT;
|
||||
@@ -4098,7 +4072,7 @@ yy193:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_TEXT;
|
||||
}
|
||||
#line 4102 "ext/date/lib/parse_date.c"
|
||||
#line 4076 "ext/date/lib/parse_date.c"
|
||||
yy194:
|
||||
YYDEBUG(194, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
@@ -4149,7 +4123,7 @@ yy197:
|
||||
}
|
||||
yy198:
|
||||
YYDEBUG(198, *YYCURSOR);
|
||||
#line 1382 "ext/date/lib/parse_date.re"
|
||||
#line 1356 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datetextual | datenoyear");
|
||||
@@ -4162,7 +4136,7 @@ yy198:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_TEXT;
|
||||
}
|
||||
#line 4166 "ext/date/lib/parse_date.c"
|
||||
#line 4140 "ext/date/lib/parse_date.c"
|
||||
yy199:
|
||||
YYDEBUG(199, *YYCURSOR);
|
||||
yyaccept = 6;
|
||||
@@ -4431,7 +4405,7 @@ yy221:
|
||||
}
|
||||
yy222:
|
||||
YYDEBUG(222, *YYCURSOR);
|
||||
#line 1684 "ext/date/lib/parse_date.re"
|
||||
#line 1658 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
|
||||
@@ -4460,7 +4434,7 @@ yy222:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_SHORTDATE_WITH_TIME;
|
||||
}
|
||||
#line 4464 "ext/date/lib/parse_date.c"
|
||||
#line 4438 "ext/date/lib/parse_date.c"
|
||||
yy223:
|
||||
YYDEBUG(223, *YYCURSOR);
|
||||
yyaccept = 7;
|
||||
@@ -5158,7 +5132,7 @@ yy277:
|
||||
YYDEBUG(277, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(278, *YYCURSOR);
|
||||
#line 1660 "ext/date/lib/parse_date.re"
|
||||
#line 1634 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
|
||||
TIMELIB_INIT;
|
||||
@@ -5181,7 +5155,7 @@ yy277:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_SHORTDATE_WITH_TIME;
|
||||
}
|
||||
#line 5185 "ext/date/lib/parse_date.c"
|
||||
#line 5159 "ext/date/lib/parse_date.c"
|
||||
yy279:
|
||||
YYDEBUG(279, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -5359,7 +5333,7 @@ yy293:
|
||||
++YYCURSOR;
|
||||
yy294:
|
||||
YYDEBUG(294, *YYCURSOR);
|
||||
#line 1354 "ext/date/lib/parse_date.re"
|
||||
#line 1328 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datenoday");
|
||||
@@ -5372,7 +5346,7 @@ yy294:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_NO_DAY;
|
||||
}
|
||||
#line 5376 "ext/date/lib/parse_date.c"
|
||||
#line 5350 "ext/date/lib/parse_date.c"
|
||||
yy295:
|
||||
YYDEBUG(295, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -6592,7 +6566,7 @@ yy361:
|
||||
if (yych <= '9') goto yy364;
|
||||
yy363:
|
||||
YYDEBUG(363, *YYCURSOR);
|
||||
#line 1498 "ext/date/lib/parse_date.re"
|
||||
#line 1472 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pgtextshort");
|
||||
@@ -6605,7 +6579,7 @@ yy363:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PG_TEXT;
|
||||
}
|
||||
#line 6609 "ext/date/lib/parse_date.c"
|
||||
#line 6583 "ext/date/lib/parse_date.c"
|
||||
yy364:
|
||||
YYDEBUG(364, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -7243,7 +7217,7 @@ yy391:
|
||||
}
|
||||
yy392:
|
||||
YYDEBUG(392, *YYCURSOR);
|
||||
#line 1556 "ext/date/lib/parse_date.re"
|
||||
#line 1530 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("ago");
|
||||
TIMELIB_INIT;
|
||||
@@ -7263,7 +7237,7 @@ yy392:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_AGO;
|
||||
}
|
||||
#line 7267 "ext/date/lib/parse_date.c"
|
||||
#line 7241 "ext/date/lib/parse_date.c"
|
||||
yy393:
|
||||
YYDEBUG(393, *YYCURSOR);
|
||||
yyaccept = 5;
|
||||
@@ -9013,7 +8987,7 @@ yy453:
|
||||
++YYCURSOR;
|
||||
yy454:
|
||||
YYDEBUG(454, *YYCURSOR);
|
||||
#line 1259 "ext/date/lib/parse_date.re"
|
||||
#line 1233 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash");
|
||||
TIMELIB_INIT;
|
||||
@@ -9024,7 +8998,7 @@ yy454:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 9028 "ext/date/lib/parse_date.c"
|
||||
#line 9002 "ext/date/lib/parse_date.c"
|
||||
yy455:
|
||||
YYDEBUG(455, *YYCURSOR);
|
||||
yyaccept = 0;
|
||||
@@ -9584,7 +9558,7 @@ yy474:
|
||||
}
|
||||
yy475:
|
||||
YYDEBUG(475, *YYCURSOR);
|
||||
#line 1396 "ext/date/lib/parse_date.re"
|
||||
#line 1370 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("datenoyearrev");
|
||||
TIMELIB_INIT;
|
||||
@@ -9595,7 +9569,7 @@ yy475:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_TEXT;
|
||||
}
|
||||
#line 9599 "ext/date/lib/parse_date.c"
|
||||
#line 9573 "ext/date/lib/parse_date.c"
|
||||
yy476:
|
||||
YYDEBUG(476, *YYCURSOR);
|
||||
yyaccept = 10;
|
||||
@@ -9736,7 +9710,7 @@ yy487:
|
||||
YYDEBUG(487, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(488, *YYCURSOR);
|
||||
#line 1114 "ext/date/lib/parse_date.re"
|
||||
#line 1088 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
|
||||
TIMELIB_INIT;
|
||||
@@ -9752,7 +9726,7 @@ yy487:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIME12;
|
||||
}
|
||||
#line 9756 "ext/date/lib/parse_date.c"
|
||||
#line 9730 "ext/date/lib/parse_date.c"
|
||||
yy489:
|
||||
YYDEBUG(489, *YYCURSOR);
|
||||
yyaccept = 11;
|
||||
@@ -9765,7 +9739,7 @@ yy489:
|
||||
}
|
||||
yy490:
|
||||
YYDEBUG(490, *YYCURSOR);
|
||||
#line 1151 "ext/date/lib/parse_date.re"
|
||||
#line 1125 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long");
|
||||
@@ -9790,7 +9764,7 @@ yy490:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIME24_WITH_ZONE;
|
||||
}
|
||||
#line 9794 "ext/date/lib/parse_date.c"
|
||||
#line 9768 "ext/date/lib/parse_date.c"
|
||||
yy491:
|
||||
YYDEBUG(491, *YYCURSOR);
|
||||
yyaccept = 11;
|
||||
@@ -10100,7 +10074,7 @@ yy522:
|
||||
YYDEBUG(522, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(523, *YYCURSOR);
|
||||
#line 1131 "ext/date/lib/parse_date.re"
|
||||
#line 1105 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("mssqltime");
|
||||
TIMELIB_INIT;
|
||||
@@ -10119,7 +10093,7 @@ yy522:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIME24_WITH_ZONE;
|
||||
}
|
||||
#line 10123 "ext/date/lib/parse_date.c"
|
||||
#line 10097 "ext/date/lib/parse_date.c"
|
||||
yy524:
|
||||
YYDEBUG(524, *YYCURSOR);
|
||||
yyaccept = 11;
|
||||
@@ -10225,7 +10199,7 @@ yy533:
|
||||
if (yych <= '9') goto yy540;
|
||||
yy534:
|
||||
YYDEBUG(534, *YYCURSOR);
|
||||
#line 1313 "ext/date/lib/parse_date.re"
|
||||
#line 1287 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datefull");
|
||||
@@ -10239,7 +10213,7 @@ yy534:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_FULL;
|
||||
}
|
||||
#line 10243 "ext/date/lib/parse_date.c"
|
||||
#line 10217 "ext/date/lib/parse_date.c"
|
||||
yy535:
|
||||
YYDEBUG(535, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -10976,7 +10950,7 @@ yy604:
|
||||
YYDEBUG(605, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(606, *YYCURSOR);
|
||||
#line 1328 "ext/date/lib/parse_date.re"
|
||||
#line 1302 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("pointed date YYYY");
|
||||
TIMELIB_INIT;
|
||||
@@ -10987,7 +10961,7 @@ yy604:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_FULL_POINTED;
|
||||
}
|
||||
#line 10991 "ext/date/lib/parse_date.c"
|
||||
#line 10965 "ext/date/lib/parse_date.c"
|
||||
yy607:
|
||||
YYDEBUG(607, *YYCURSOR);
|
||||
yyaccept = 11;
|
||||
@@ -11023,7 +10997,7 @@ yy610:
|
||||
if (yych <= '9') goto yy604;
|
||||
yy611:
|
||||
YYDEBUG(611, *YYCURSOR);
|
||||
#line 1340 "ext/date/lib/parse_date.re"
|
||||
#line 1314 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pointed date YY");
|
||||
@@ -11036,7 +11010,7 @@ yy611:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_FULL_POINTED;
|
||||
}
|
||||
#line 11040 "ext/date/lib/parse_date.c"
|
||||
#line 11014 "ext/date/lib/parse_date.c"
|
||||
yy612:
|
||||
YYDEBUG(612, *YYCURSOR);
|
||||
yyaccept = 11;
|
||||
@@ -11677,7 +11651,7 @@ yy655:
|
||||
}
|
||||
yy656:
|
||||
YYDEBUG(656, *YYCURSOR);
|
||||
#line 1299 "ext/date/lib/parse_date.re"
|
||||
#line 1273 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("gnudateshort");
|
||||
@@ -11690,7 +11664,7 @@ yy656:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 11694 "ext/date/lib/parse_date.c"
|
||||
#line 11668 "ext/date/lib/parse_date.c"
|
||||
yy657:
|
||||
YYDEBUG(657, *YYCURSOR);
|
||||
yyaccept = 13;
|
||||
@@ -11796,7 +11770,7 @@ yy665:
|
||||
}
|
||||
yy666:
|
||||
YYDEBUG(666, *YYCURSOR);
|
||||
#line 1243 "ext/date/lib/parse_date.re"
|
||||
#line 1217 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("americanshort | american");
|
||||
@@ -11811,7 +11785,7 @@ yy666:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_AMERICAN;
|
||||
}
|
||||
#line 11815 "ext/date/lib/parse_date.c"
|
||||
#line 11789 "ext/date/lib/parse_date.c"
|
||||
yy667:
|
||||
YYDEBUG(667, *YYCURSOR);
|
||||
yyaccept = 14;
|
||||
@@ -12044,7 +12018,7 @@ yy699:
|
||||
if (yych <= ':') goto yy703;
|
||||
yy700:
|
||||
YYDEBUG(700, *YYCURSOR);
|
||||
#line 1526 "ext/date/lib/parse_date.re"
|
||||
#line 1500 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("clf");
|
||||
@@ -12064,7 +12038,7 @@ yy700:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_CLF;
|
||||
}
|
||||
#line 12068 "ext/date/lib/parse_date.c"
|
||||
#line 12042 "ext/date/lib/parse_date.c"
|
||||
yy701:
|
||||
YYDEBUG(701, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -12616,7 +12590,7 @@ yy762:
|
||||
}
|
||||
yy763:
|
||||
YYDEBUG(763, *YYCURSOR);
|
||||
#line 1271 "ext/date/lib/parse_date.re"
|
||||
#line 1245 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("iso8601date2");
|
||||
@@ -12629,7 +12603,7 @@ yy763:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 12633 "ext/date/lib/parse_date.c"
|
||||
#line 12607 "ext/date/lib/parse_date.c"
|
||||
yy764:
|
||||
YYDEBUG(764, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -12668,7 +12642,7 @@ yy770:
|
||||
YYDEBUG(770, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(771, *YYCURSOR);
|
||||
#line 1512 "ext/date/lib/parse_date.re"
|
||||
#line 1486 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pgtextreverse");
|
||||
@@ -12681,7 +12655,7 @@ yy770:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PG_TEXT;
|
||||
}
|
||||
#line 12685 "ext/date/lib/parse_date.c"
|
||||
#line 12659 "ext/date/lib/parse_date.c"
|
||||
yy772:
|
||||
YYDEBUG(772, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -12819,7 +12793,7 @@ yy782:
|
||||
}
|
||||
yy783:
|
||||
YYDEBUG(783, *YYCURSOR);
|
||||
#line 1547 "ext/date/lib/parse_date.re"
|
||||
#line 1521 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("year4");
|
||||
TIMELIB_INIT;
|
||||
@@ -12827,7 +12801,7 @@ yy783:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_CLF;
|
||||
}
|
||||
#line 12831 "ext/date/lib/parse_date.c"
|
||||
#line 12805 "ext/date/lib/parse_date.c"
|
||||
yy784:
|
||||
YYDEBUG(784, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -12978,7 +12952,7 @@ yy792:
|
||||
}
|
||||
yy793:
|
||||
YYDEBUG(793, *YYCURSOR);
|
||||
#line 1368 "ext/date/lib/parse_date.re"
|
||||
#line 1342 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datenodayrev");
|
||||
@@ -12991,7 +12965,7 @@ yy793:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_NO_DAY;
|
||||
}
|
||||
#line 12995 "ext/date/lib/parse_date.c"
|
||||
#line 12969 "ext/date/lib/parse_date.c"
|
||||
yy794:
|
||||
YYDEBUG(794, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -13206,7 +13180,7 @@ yy813:
|
||||
if (yych <= '7') goto yy816;
|
||||
yy814:
|
||||
YYDEBUG(814, *YYCURSOR);
|
||||
#line 1479 "ext/date/lib/parse_date.re"
|
||||
#line 1453 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll w, d;
|
||||
DEBUG_OUTPUT("isoweek");
|
||||
@@ -13224,7 +13198,7 @@ yy814:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_WEEK;
|
||||
}
|
||||
#line 13228 "ext/date/lib/parse_date.c"
|
||||
#line 13202 "ext/date/lib/parse_date.c"
|
||||
yy815:
|
||||
YYDEBUG(815, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -13234,7 +13208,7 @@ yy816:
|
||||
YYDEBUG(816, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(817, *YYCURSOR);
|
||||
#line 1460 "ext/date/lib/parse_date.re"
|
||||
#line 1434 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll w, d;
|
||||
DEBUG_OUTPUT("isoweekday");
|
||||
@@ -13252,7 +13226,7 @@ yy816:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_WEEK;
|
||||
}
|
||||
#line 13256 "ext/date/lib/parse_date.c"
|
||||
#line 13230 "ext/date/lib/parse_date.c"
|
||||
yy818:
|
||||
YYDEBUG(818, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -13316,7 +13290,7 @@ yy820:
|
||||
}
|
||||
yy821:
|
||||
YYDEBUG(821, *YYCURSOR);
|
||||
#line 1446 "ext/date/lib/parse_date.re"
|
||||
#line 1420 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pgydotd");
|
||||
@@ -13329,7 +13303,7 @@ yy821:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PG_YEARDAY;
|
||||
}
|
||||
#line 13333 "ext/date/lib/parse_date.c"
|
||||
#line 13307 "ext/date/lib/parse_date.c"
|
||||
yy822:
|
||||
YYDEBUG(822, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -13432,7 +13406,7 @@ yy841:
|
||||
++YYCURSOR;
|
||||
yy842:
|
||||
YYDEBUG(842, *YYCURSOR);
|
||||
#line 1420 "ext/date/lib/parse_date.re"
|
||||
#line 1394 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
|
||||
@@ -13457,7 +13431,7 @@ yy842:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_XMLRPC_SOAP;
|
||||
}
|
||||
#line 13461 "ext/date/lib/parse_date.c"
|
||||
#line 13435 "ext/date/lib/parse_date.c"
|
||||
yy843:
|
||||
YYDEBUG(843, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -13719,7 +13693,7 @@ yy847:
|
||||
}
|
||||
yy848:
|
||||
YYDEBUG(848, *YYCURSOR);
|
||||
#line 1408 "ext/date/lib/parse_date.re"
|
||||
#line 1382 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("datenocolon");
|
||||
TIMELIB_INIT;
|
||||
@@ -13730,7 +13704,7 @@ yy848:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_NOCOLON;
|
||||
}
|
||||
#line 13734 "ext/date/lib/parse_date.c"
|
||||
#line 13708 "ext/date/lib/parse_date.c"
|
||||
yy849:
|
||||
YYDEBUG(849, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -14650,7 +14624,7 @@ yy972:
|
||||
if (yych <= '9') goto yy995;
|
||||
yy973:
|
||||
YYDEBUG(973, *YYCURSOR);
|
||||
#line 1285 "ext/date/lib/parse_date.re"
|
||||
#line 1259 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("gnudateshorter");
|
||||
@@ -14663,7 +14637,7 @@ yy973:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 14667 "ext/date/lib/parse_date.c"
|
||||
#line 14641 "ext/date/lib/parse_date.c"
|
||||
yy974:
|
||||
YYDEBUG(974, *YYCURSOR);
|
||||
yyaccept = 22;
|
||||
@@ -15672,7 +15646,7 @@ yy1065:
|
||||
}
|
||||
yy1067:
|
||||
YYDEBUG(1067, *YYCURSOR);
|
||||
#line 1177 "ext/date/lib/parse_date.re"
|
||||
#line 1151 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("gnunocolon");
|
||||
TIMELIB_INIT;
|
||||
@@ -15694,7 +15668,7 @@ yy1067:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_GNU_NOCOLON;
|
||||
}
|
||||
#line 15698 "ext/date/lib/parse_date.c"
|
||||
#line 15672 "ext/date/lib/parse_date.c"
|
||||
yy1068:
|
||||
YYDEBUG(1068, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -15786,7 +15760,7 @@ yy1074:
|
||||
}
|
||||
yy1075:
|
||||
YYDEBUG(1075, *YYCURSOR);
|
||||
#line 1223 "ext/date/lib/parse_date.re"
|
||||
#line 1197 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("iso8601nocolon");
|
||||
@@ -15805,7 +15779,7 @@ yy1075:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_NOCOLON;
|
||||
}
|
||||
#line 15809 "ext/date/lib/parse_date.c"
|
||||
#line 15783 "ext/date/lib/parse_date.c"
|
||||
yy1076:
|
||||
YYDEBUG(1076, *YYCURSOR);
|
||||
yyaccept = 25;
|
||||
@@ -16703,7 +16677,7 @@ yy1116:
|
||||
}
|
||||
yy1117:
|
||||
YYDEBUG(1117, *YYCURSOR);
|
||||
#line 1619 "ext/date/lib/parse_date.re"
|
||||
#line 1593 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll i;
|
||||
int behavior = 0;
|
||||
@@ -16719,7 +16693,7 @@ yy1117:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 16723 "ext/date/lib/parse_date.c"
|
||||
#line 16697 "ext/date/lib/parse_date.c"
|
||||
yy1118:
|
||||
YYDEBUG(1118, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
@@ -16770,7 +16744,7 @@ yy1125:
|
||||
YYDEBUG(1125, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(1126, *YYCURSOR);
|
||||
#line 1092 "ext/date/lib/parse_date.re"
|
||||
#line 1066 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll i;
|
||||
int behavior = 0;
|
||||
@@ -16791,7 +16765,7 @@ yy1125:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_WEEK_DAY_OF_MONTH;
|
||||
}
|
||||
#line 16795 "ext/date/lib/parse_date.c"
|
||||
#line 16769 "ext/date/lib/parse_date.c"
|
||||
yy1127:
|
||||
YYDEBUG(1127, *YYCURSOR);
|
||||
yyaccept = 26;
|
||||
@@ -16899,7 +16873,7 @@ yy1140:
|
||||
}
|
||||
yy1141:
|
||||
YYDEBUG(1141, *YYCURSOR);
|
||||
#line 1595 "ext/date/lib/parse_date.re"
|
||||
#line 1569 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll i;
|
||||
int behavior = 0;
|
||||
@@ -16922,7 +16896,7 @@ yy1141:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 16926 "ext/date/lib/parse_date.c"
|
||||
#line 16900 "ext/date/lib/parse_date.c"
|
||||
yy1142:
|
||||
YYDEBUG(1142, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -19599,7 +19573,7 @@ yy1293:
|
||||
goto yy1297;
|
||||
yy1294:
|
||||
YYDEBUG(1294, *YYCURSOR);
|
||||
#line 1069 "ext/date/lib/parse_date.re"
|
||||
#line 1043 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("backof | frontof");
|
||||
TIMELIB_INIT;
|
||||
@@ -19621,7 +19595,7 @@ yy1294:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_LF_DAY_OF_MONTH;
|
||||
}
|
||||
#line 19625 "ext/date/lib/parse_date.c"
|
||||
#line 19599 "ext/date/lib/parse_date.c"
|
||||
yy1295:
|
||||
YYDEBUG(1295, *YYCURSOR);
|
||||
yyaccept = 28;
|
||||
@@ -19882,14 +19856,14 @@ yy1315:
|
||||
YYDEBUG(1315, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(1316, *YYCURSOR);
|
||||
#line 1052 "ext/date/lib/parse_date.re"
|
||||
#line 1026 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("firstdayof | lastdayof");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_RELATIVE();
|
||||
|
||||
/* skip "last day of" or "first day of" */
|
||||
if (*ptr == 'l') {
|
||||
if (*ptr == 'l' || *ptr == 'L') {
|
||||
s->time->relative.first_last_day_of = 2;
|
||||
} else {
|
||||
s->time->relative.first_last_day_of = 1;
|
||||
@@ -19898,7 +19872,7 @@ yy1315:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_LF_DAY_OF_MONTH;
|
||||
}
|
||||
#line 19902 "ext/date/lib/parse_date.c"
|
||||
#line 19876 "ext/date/lib/parse_date.c"
|
||||
yy1317:
|
||||
YYDEBUG(1317, *YYCURSOR);
|
||||
yyaccept = 0;
|
||||
@@ -21329,7 +21303,7 @@ yy1385:
|
||||
if (yych <= '9') goto yy1385;
|
||||
yy1387:
|
||||
YYDEBUG(1387, *YYCURSOR);
|
||||
#line 1026 "ext/date/lib/parse_date.re"
|
||||
#line 1000 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_ull i;
|
||||
|
||||
@@ -21354,7 +21328,7 @@ yy1387:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 21358 "ext/date/lib/parse_date.c"
|
||||
#line 21332 "ext/date/lib/parse_date.c"
|
||||
yy1388:
|
||||
YYDEBUG(1388, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -21790,7 +21764,7 @@ yy1416:
|
||||
++YYCURSOR;
|
||||
yy1417:
|
||||
YYDEBUG(1417, *YYCURSOR);
|
||||
#line 1014 "ext/date/lib/parse_date.re"
|
||||
#line 988 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("tomorrow");
|
||||
TIMELIB_INIT;
|
||||
@@ -21801,7 +21775,7 @@ yy1417:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 21805 "ext/date/lib/parse_date.c"
|
||||
#line 21779 "ext/date/lib/parse_date.c"
|
||||
yy1418:
|
||||
YYDEBUG(1418, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -21836,7 +21810,7 @@ yy1419:
|
||||
}
|
||||
yy1420:
|
||||
YYDEBUG(1420, *YYCURSOR);
|
||||
#line 1004 "ext/date/lib/parse_date.re"
|
||||
#line 978 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("midnight | today");
|
||||
TIMELIB_INIT;
|
||||
@@ -21845,7 +21819,7 @@ yy1420:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 21849 "ext/date/lib/parse_date.c"
|
||||
#line 21823 "ext/date/lib/parse_date.c"
|
||||
yy1421:
|
||||
YYDEBUG(1421, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -23857,7 +23831,7 @@ yy1499:
|
||||
}
|
||||
yy1500:
|
||||
YYDEBUG(1500, *YYCURSOR);
|
||||
#line 983 "ext/date/lib/parse_date.re"
|
||||
#line 957 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("now");
|
||||
TIMELIB_INIT;
|
||||
@@ -23865,7 +23839,7 @@ yy1500:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 23869 "ext/date/lib/parse_date.c"
|
||||
#line 23843 "ext/date/lib/parse_date.c"
|
||||
yy1501:
|
||||
YYDEBUG(1501, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -24004,7 +23978,7 @@ yy1507:
|
||||
}
|
||||
yy1508:
|
||||
YYDEBUG(1508, *YYCURSOR);
|
||||
#line 992 "ext/date/lib/parse_date.re"
|
||||
#line 966 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("noon");
|
||||
TIMELIB_INIT;
|
||||
@@ -24015,7 +23989,7 @@ yy1508:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 24019 "ext/date/lib/parse_date.c"
|
||||
#line 23993 "ext/date/lib/parse_date.c"
|
||||
yy1509:
|
||||
YYDEBUG(1509, *YYCURSOR);
|
||||
yyaccept = 0;
|
||||
@@ -24548,7 +24522,7 @@ yy1530:
|
||||
++YYCURSOR;
|
||||
yy1531:
|
||||
YYDEBUG(1531, *YYCURSOR);
|
||||
#line 971 "ext/date/lib/parse_date.re"
|
||||
#line 945 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("yesterday");
|
||||
TIMELIB_INIT;
|
||||
@@ -24559,7 +24533,7 @@ yy1531:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 24563 "ext/date/lib/parse_date.c"
|
||||
#line 24537 "ext/date/lib/parse_date.c"
|
||||
yy1532:
|
||||
YYDEBUG(1532, *YYCURSOR);
|
||||
yyaccept = 0;
|
||||
@@ -24732,7 +24706,7 @@ yy1537:
|
||||
goto yy1531;
|
||||
}
|
||||
}
|
||||
#line 1745 "ext/date/lib/parse_date.re"
|
||||
#line 1719 "ext/date/lib/parse_date.re"
|
||||
|
||||
}
|
||||
|
||||
@@ -25223,7 +25197,7 @@ char *timelib_timezone_id_from_abbr(const char *abbr, long gmtoffset, int isdst)
|
||||
{
|
||||
const timelib_tz_lookup_table *tp;
|
||||
|
||||
tp = zone_search(abbr, gmtoffset, isdst);
|
||||
tp = abbr_search(abbr, gmtoffset, isdst);
|
||||
if (tp) {
|
||||
return (tp->full_tz_name);
|
||||
} else {
|
||||
|
||||
+12
-38
@@ -668,7 +668,7 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, S
|
||||
}
|
||||
}
|
||||
|
||||
const static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffset, int isdst)
|
||||
const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffset, int isdst)
|
||||
{
|
||||
int first_found = 0;
|
||||
const timelib_tz_lookup_table *tp, *first_found_elem = NULL;
|
||||
@@ -696,25 +696,6 @@ const static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffs
|
||||
return first_found_elem;
|
||||
}
|
||||
|
||||
for (tp = timelib_timezone_lookup; tp->name; tp++) {
|
||||
if (tp->full_tz_name && strcasecmp(word, tp->full_tz_name) == 0) {
|
||||
if (!first_found) {
|
||||
first_found = 1;
|
||||
first_found_elem = tp;
|
||||
if (gmtoffset == -1) {
|
||||
return tp;
|
||||
}
|
||||
}
|
||||
if (tp->gmtoffset == gmtoffset) {
|
||||
return tp;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (first_found) {
|
||||
return first_found_elem;
|
||||
}
|
||||
|
||||
|
||||
/* Still didn't find anything, let's find the zone solely based on
|
||||
* offset/isdst then */
|
||||
for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
|
||||
@@ -725,7 +706,7 @@ const static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffs
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found)
|
||||
static long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found)
|
||||
{
|
||||
char *word;
|
||||
char *begin = *ptr, *end;
|
||||
@@ -739,7 +720,7 @@ static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found
|
||||
word = calloc(1, end - begin + 1);
|
||||
memcpy(word, begin, end - begin);
|
||||
|
||||
if ((tp = zone_search(word, -1, 0))) {
|
||||
if ((tp = abbr_search(word, -1, 0))) {
|
||||
value = -tp->gmtoffset / 60;
|
||||
*dst = tp->type;
|
||||
value += tp->type * 60;
|
||||
@@ -783,33 +764,26 @@ long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found
|
||||
retval = timelib_parse_tz_cor(ptr);
|
||||
} else {
|
||||
int found = 0;
|
||||
long offset;
|
||||
long offset = 0;
|
||||
char *tz_abbr;
|
||||
|
||||
t->is_localtime = 1;
|
||||
|
||||
offset = timelib_lookup_zone(ptr, dst, &tz_abbr, &found);
|
||||
/* First, we lookup by abbreviation only */
|
||||
offset = timelib_lookup_abbr(ptr, dst, &tz_abbr, &found);
|
||||
if (found) {
|
||||
t->zone_type = TIMELIB_ZONETYPE_ABBR;
|
||||
timelib_time_tz_abbr_update(t, tz_abbr);
|
||||
}
|
||||
#if 0
|
||||
/* If we found a TimeZone identifier, use it */
|
||||
if (tz_name) {
|
||||
t->tz_info = timelib_parse_tzfile(tz_name);
|
||||
t->zone_type = TIMELIB_ZONETYPE_ID;
|
||||
}
|
||||
#endif
|
||||
/* If we have a TimeZone identifier to start with, use it */
|
||||
if (strstr(tz_abbr, "/") || strcmp(tz_abbr, "UTC") == 0) {
|
||||
|
||||
/* Otherwise, we look if we have a TimeZone identifier */
|
||||
if (!found || strcmp("UTC", tz_abbr) == 0) {
|
||||
if ((res = tz_wrapper(tz_abbr, tzdb)) != NULL) {
|
||||
t->tz_info = res;
|
||||
t->zone_type = TIMELIB_ZONETYPE_ID;
|
||||
found++;
|
||||
}
|
||||
}
|
||||
if (found && t->zone_type != TIMELIB_ZONETYPE_ID) {
|
||||
timelib_time_tz_abbr_update(t, tz_abbr);
|
||||
}
|
||||
free(tz_abbr);
|
||||
*tz_not_found = (found == 0);
|
||||
retval = offset;
|
||||
@@ -1055,7 +1029,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
TIMELIB_HAVE_RELATIVE();
|
||||
|
||||
/* skip "last day of" or "first day of" */
|
||||
if (*ptr == 'l') {
|
||||
if (*ptr == 'l' || *ptr == 'L') {
|
||||
s->time->relative.first_last_day_of = 2;
|
||||
} else {
|
||||
s->time->relative.first_last_day_of = 1;
|
||||
@@ -2232,7 +2206,7 @@ char *timelib_timezone_id_from_abbr(const char *abbr, long gmtoffset, int isdst)
|
||||
{
|
||||
const timelib_tz_lookup_table *tp;
|
||||
|
||||
tp = zone_search(abbr, gmtoffset, isdst);
|
||||
tp = abbr_search(abbr, gmtoffset, isdst);
|
||||
if (tp) {
|
||||
return (tp->full_tz_name);
|
||||
} else {
|
||||
|
||||
+652
-667
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,175 @@
|
||||
--TEST--
|
||||
Bug #66986 (Some timezones are no longer valid in PHP 5.5.10)
|
||||
--FILE--
|
||||
<?php
|
||||
$zones = array(
|
||||
"CST6CDT", "Cuba", "Egypt", "Eire", "EST5EDT", "Factory", "GB-Eire",
|
||||
"GMT0", "Greenwich", "Hongkong", "Iceland", "Iran", "Israel", "Jamaica",
|
||||
"Japan", "Kwajalein", "Libya", "MST7MDT", "Navajo", "NZ-CHAT", "Poland",
|
||||
"Portugal", "PST8PDT", "Singapore", "Turkey", "Universal", "W-SU",
|
||||
|
||||
"UTC", "GMT", "GMT+0100", "-0230",
|
||||
);
|
||||
|
||||
foreach ( $zones as $zone )
|
||||
{
|
||||
$d = new DateTimeZone( $zone );
|
||||
print_r($d);
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => CST6CDT
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Cuba
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Egypt
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Eire
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => EST5EDT
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Factory
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => GB-Eire
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => GMT0
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Greenwich
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Hongkong
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Iceland
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Iran
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Israel
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Jamaica
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Japan
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Kwajalein
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Libya
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => MST7MDT
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Navajo
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => NZ-CHAT
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Poland
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Portugal
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => PST8PDT
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Singapore
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Turkey
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Universal
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => W-SU
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => UTC
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 2
|
||||
[timezone] => GMT
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 1
|
||||
[timezone] => +01:00
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 1
|
||||
[timezone] => -02:30
|
||||
)
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #67109 (First uppercase letter breaks date string parsing)
|
||||
--INI--
|
||||
date.timezone=UTC
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(date('d.m.Y',strtotime('last day of april')));
|
||||
var_dump(date('d.m.Y',strtotime('Last day of april')));
|
||||
var_dump(date('d.m.Y',strtotime('lAst Day of April')));
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(10) "30.04.%d"
|
||||
string(10) "30.04.%d"
|
||||
string(10) "30.04.%d"
|
||||
+1
-8
@@ -183,14 +183,7 @@ int dom_attr_value_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
node_list_unlink(attrp->children TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (newval->type != IS_STRING) {
|
||||
if(Z_REFCOUNT_P(newval) > 1) {
|
||||
value_copy = *newval;
|
||||
zval_copy_ctor(&value_copy);
|
||||
newval = &value_copy;
|
||||
}
|
||||
convert_to_string(newval);
|
||||
}
|
||||
convert_to_string_copy(newval, value_copy);
|
||||
|
||||
xmlNodeSetContentLen((xmlNodePtr) attrp, Z_STRVAL_P(newval), Z_STRLEN_P(newval) + 1);
|
||||
|
||||
|
||||
@@ -112,14 +112,7 @@ int dom_characterdata_data_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (newval->type != IS_STRING) {
|
||||
if(Z_REFCOUNT_P(newval) > 1) {
|
||||
value_copy = *newval;
|
||||
zval_copy_ctor(&value_copy);
|
||||
newval = &value_copy;
|
||||
}
|
||||
convert_to_string(newval);
|
||||
}
|
||||
convert_to_string_copy(newval, value_copy);
|
||||
|
||||
xmlNodeSetContentLen(nodep, Z_STRVAL_P(newval), Z_STRLEN_P(newval) + 1);
|
||||
|
||||
|
||||
+11
-72
@@ -361,14 +361,7 @@ int dom_document_encoding_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (newval->type != IS_STRING) {
|
||||
if(Z_REFCOUNT_P(newval) > 1) {
|
||||
value_copy = *newval;
|
||||
zval_copy_ctor(&value_copy);
|
||||
newval = &value_copy;
|
||||
}
|
||||
convert_to_string(newval);
|
||||
}
|
||||
convert_to_string_copy(newval, value_copy);
|
||||
|
||||
handler = xmlFindCharEncodingHandler(Z_STRVAL_P(newval));
|
||||
|
||||
@@ -428,12 +421,7 @@ int dom_document_standalone_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if(Z_REFCOUNT_P(newval) > 1) {
|
||||
value_copy = *newval;
|
||||
zval_copy_ctor(&value_copy);
|
||||
newval = &value_copy;
|
||||
}
|
||||
convert_to_long(newval);
|
||||
convert_to_long_copy(newval, value_copy);
|
||||
|
||||
standalone = Z_LVAL_P(newval);
|
||||
if (standalone > 0) {
|
||||
@@ -500,14 +488,7 @@ int dom_document_version_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
xmlFree((xmlChar *) docp->version );
|
||||
}
|
||||
|
||||
if (newval->type != IS_STRING) {
|
||||
if(Z_REFCOUNT_P(newval) > 1) {
|
||||
value_copy = *newval;
|
||||
zval_copy_ctor(&value_copy);
|
||||
newval = &value_copy;
|
||||
}
|
||||
convert_to_string(newval);
|
||||
}
|
||||
convert_to_string_copy(newval, value_copy);
|
||||
|
||||
docp->version = xmlStrdup((const xmlChar *) Z_STRVAL_P(newval));
|
||||
|
||||
@@ -544,12 +525,7 @@ int dom_document_strict_error_checking_write(dom_object *obj, zval *newval TSRML
|
||||
zval value_copy;
|
||||
dom_doc_propsptr doc_prop;
|
||||
|
||||
if(Z_REFCOUNT_P(newval) > 1) {
|
||||
value_copy = *newval;
|
||||
zval_copy_ctor(&value_copy);
|
||||
newval = &value_copy;
|
||||
}
|
||||
convert_to_boolean(newval);
|
||||
convert_to_boolean_copy(newval, value_copy);
|
||||
|
||||
if (obj->document) {
|
||||
doc_prop = dom_get_doc_props(obj->document);
|
||||
@@ -587,12 +563,7 @@ int dom_document_format_output_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
zval value_copy;
|
||||
dom_doc_propsptr doc_prop;
|
||||
|
||||
if(Z_REFCOUNT_P(newval) > 1) {
|
||||
value_copy = *newval;
|
||||
zval_copy_ctor(&value_copy);
|
||||
newval = &value_copy;
|
||||
}
|
||||
convert_to_boolean(newval);
|
||||
convert_to_boolean_copy(newval, value_copy);
|
||||
|
||||
if (obj->document) {
|
||||
doc_prop = dom_get_doc_props(obj->document);
|
||||
@@ -629,12 +600,7 @@ int dom_document_validate_on_parse_write(dom_object *obj, zval *newval TSRMLS_DC
|
||||
zval value_copy;
|
||||
dom_doc_propsptr doc_prop;
|
||||
|
||||
if(Z_REFCOUNT_P(newval) > 1) {
|
||||
value_copy = *newval;
|
||||
zval_copy_ctor(&value_copy);
|
||||
newval = &value_copy;
|
||||
}
|
||||
convert_to_boolean(newval);
|
||||
convert_to_boolean_copy(newval, value_copy);
|
||||
|
||||
if (obj->document) {
|
||||
doc_prop = dom_get_doc_props(obj->document);
|
||||
@@ -671,12 +637,7 @@ int dom_document_resolve_externals_write(dom_object *obj, zval *newval TSRMLS_DC
|
||||
zval value_copy;
|
||||
dom_doc_propsptr doc_prop;
|
||||
|
||||
if(Z_REFCOUNT_P(newval) > 1) {
|
||||
value_copy = *newval;
|
||||
zval_copy_ctor(&value_copy);
|
||||
newval = &value_copy;
|
||||
}
|
||||
convert_to_boolean(newval);
|
||||
convert_to_boolean_copy(newval, value_copy);
|
||||
|
||||
if (obj->document) {
|
||||
doc_prop = dom_get_doc_props(obj->document);
|
||||
@@ -713,12 +674,7 @@ int dom_document_preserve_whitespace_write(dom_object *obj, zval *newval TSRMLS_
|
||||
zval value_copy;
|
||||
dom_doc_propsptr doc_prop;
|
||||
|
||||
if(Z_REFCOUNT_P(newval) > 1) {
|
||||
value_copy = *newval;
|
||||
zval_copy_ctor(&value_copy);
|
||||
newval = &value_copy;
|
||||
}
|
||||
convert_to_boolean(newval);
|
||||
convert_to_boolean_copy(newval, value_copy);
|
||||
|
||||
if (obj->document) {
|
||||
doc_prop = dom_get_doc_props(obj->document);
|
||||
@@ -755,12 +711,7 @@ int dom_document_recover_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
zval value_copy;
|
||||
dom_doc_propsptr doc_prop;
|
||||
|
||||
if(Z_REFCOUNT_P(newval) > 1) {
|
||||
value_copy = *newval;
|
||||
zval_copy_ctor(&value_copy);
|
||||
newval = &value_copy;
|
||||
}
|
||||
convert_to_boolean(newval);
|
||||
convert_to_boolean_copy(newval, value_copy);
|
||||
|
||||
if (obj->document) {
|
||||
doc_prop = dom_get_doc_props(obj->document);
|
||||
@@ -797,12 +748,7 @@ int dom_document_substitue_entities_write(dom_object *obj, zval *newval TSRMLS_D
|
||||
zval value_copy;
|
||||
dom_doc_propsptr doc_prop;
|
||||
|
||||
if(Z_REFCOUNT_P(newval) > 1) {
|
||||
value_copy = *newval;
|
||||
zval_copy_ctor(&value_copy);
|
||||
newval = &value_copy;
|
||||
}
|
||||
convert_to_boolean(newval);
|
||||
convert_to_boolean_copy(newval, value_copy);
|
||||
|
||||
if (obj->document) {
|
||||
doc_prop = dom_get_doc_props(obj->document);
|
||||
@@ -861,14 +807,7 @@ int dom_document_document_uri_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
xmlFree((xmlChar *) docp->URL);
|
||||
}
|
||||
|
||||
if (newval->type != IS_STRING) {
|
||||
if(Z_REFCOUNT_P(newval) > 1) {
|
||||
value_copy = *newval;
|
||||
zval_copy_ctor(&value_copy);
|
||||
newval = &value_copy;
|
||||
}
|
||||
convert_to_string(newval);
|
||||
}
|
||||
convert_to_string_copy(newval, value_copy);
|
||||
|
||||
docp->URL = xmlStrdup((const xmlChar *) Z_STRVAL_P(newval));
|
||||
|
||||
|
||||
+19
-16
@@ -352,14 +352,7 @@ int dom_node_node_value_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
case XML_COMMENT_NODE:
|
||||
case XML_CDATA_SECTION_NODE:
|
||||
case XML_PI_NODE:
|
||||
if (newval->type != IS_STRING) {
|
||||
if(Z_REFCOUNT_P(newval) > 1) {
|
||||
value_copy = *newval;
|
||||
zval_copy_ctor(&value_copy);
|
||||
newval = &value_copy;
|
||||
}
|
||||
convert_to_string(newval);
|
||||
}
|
||||
convert_to_string_copy(newval, value_copy);
|
||||
xmlNodeSetContentLen(nodep, Z_STRVAL_P(newval), Z_STRLEN_P(newval) + 1);
|
||||
if (newval == &value_copy) {
|
||||
zval_dtor(newval);
|
||||
@@ -794,14 +787,7 @@ int dom_node_prefix_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
nsnode = xmlDocGetRootElement(nodep->doc);
|
||||
}
|
||||
}
|
||||
if (newval->type != IS_STRING) {
|
||||
if(Z_REFCOUNT_P(newval) > 1) {
|
||||
value_copy = *newval;
|
||||
zval_copy_ctor(&value_copy);
|
||||
newval = &value_copy;
|
||||
}
|
||||
convert_to_string(newval);
|
||||
}
|
||||
convert_to_string_copy(newval, value_copy);
|
||||
prefix = Z_STRVAL_P(newval);
|
||||
if (nsnode && nodep->ns != NULL && !xmlStrEqual(nodep->ns->prefix, (xmlChar *)prefix)) {
|
||||
strURI = (char *) nodep->ns->href;
|
||||
@@ -942,6 +928,23 @@ int dom_node_text_content_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
int dom_node_text_content_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
{
|
||||
xmlNode *nodep = dom_object_get_node(obj);
|
||||
zval value_copy;
|
||||
xmlChar *enc_str;
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
convert_to_string_copy(newval, value_copy);
|
||||
enc_str = xmlEncodeEntitiesReentrant(nodep->doc, Z_STRVAL_P(newval));
|
||||
xmlNodeSetContent(nodep, enc_str);
|
||||
xmlFree(enc_str);
|
||||
if (newval == &value_copy) {
|
||||
zval_dtor(newval);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -518,7 +518,7 @@ static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp TSRMLS_DC
|
||||
value = null_value;
|
||||
} else if (Z_TYPE_P(value) == IS_OBJECT) {
|
||||
/* these are zvalues create on demand, with refcount and is_ref
|
||||
* status left in an uninitalized stated */
|
||||
* status left in an uninitialized stated */
|
||||
zval_dtor(value);
|
||||
efree(value);
|
||||
|
||||
|
||||
@@ -146,6 +146,20 @@ entry = zend_register_internal_class_ex(&ce, parent_ce, NULL TSRMLS_CC);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not yet implemented"); \
|
||||
return;
|
||||
|
||||
#define convert_to_copy_master(orig, copy, lower_type, upper_type) \
|
||||
if (Z_TYPE_P(orig) != IS_##upper_type) { \
|
||||
if (Z_REFCOUNT_P(orig) > 1) { \
|
||||
copy = *orig; \
|
||||
zval_copy_ctor(©); \
|
||||
orig = © \
|
||||
} \
|
||||
convert_to_##lower_type(orig); \
|
||||
}
|
||||
|
||||
#define convert_to_string_copy(orig, copy) convert_to_copy_master(orig, copy, string, STRING);
|
||||
#define convert_to_long_copy(orig, copy) convert_to_copy_master(orig, copy, long, LONG);
|
||||
#define convert_to_boolean_copy(orig, copy) convert_to_copy_master(orig, copy, boolean, BOOL);
|
||||
|
||||
#define DOM_NODELIST 0
|
||||
#define DOM_NAMEDNODEMAP 1
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
Testing reading and writing to DOMNode::textContent
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$html = <<<HTML
|
||||
<div id="test"><span>hi there</span></div>
|
||||
HTML;
|
||||
|
||||
$text = '<p>hello world ™</p>';
|
||||
|
||||
$dom = new DOMDocument('1.0', 'UTF-8');
|
||||
$dom->loadHTML($html);
|
||||
|
||||
$node = $dom->getElementById('test');
|
||||
var_dump($node->textContent);
|
||||
$node->textContent = $text;
|
||||
var_dump($node->textContent == $text);
|
||||
|
||||
var_dump($dom->saveHTML($node));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(8) "hi there"
|
||||
bool(true)
|
||||
string(63) "<div id="test"><p>hello world &trade;</p></div>"
|
||||
|
||||
@@ -9,7 +9,7 @@ Test eregi() function : basic functionality - confirm case insensitivity
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test basic funtionality of eregi()
|
||||
* Test basic functionality of eregi()
|
||||
*/
|
||||
|
||||
echo "*** Testing eregi() : basic functionality ***\n";
|
||||
|
||||
+2
-2
@@ -2416,11 +2416,11 @@ static void* exif_ifd_make_value(image_info_data *info_data, int motorola_intel
|
||||
data_ptr += 8;
|
||||
break;
|
||||
case TAG_FMT_SINGLE:
|
||||
memmove(data_ptr, &info_data->value.f, byte_count);
|
||||
memmove(data_ptr, &info_value->f, 4);
|
||||
data_ptr += 4;
|
||||
break;
|
||||
case TAG_FMT_DOUBLE:
|
||||
memmove(data_ptr, &info_data->value.d, byte_count);
|
||||
memmove(data_ptr, &info_value->d, 8);
|
||||
data_ptr += 8;
|
||||
break;
|
||||
}
|
||||
|
||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 368 B |
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #68113 (Heap corruption in exif_thumbnail())
|
||||
--SKIPIF--
|
||||
<?php
|
||||
extension_loaded("exif") or die("skip need exif");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(exif_thumbnail(__DIR__."/bug68113.jpg"));
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
Warning: exif_thumbnail(bug68113.jpg): File structure corrupted in %s/bug68113.php on line 2
|
||||
|
||||
Warning: exif_thumbnail(bug68113.jpg): Invalid JPEG file in %s/bug68113.php on line 2
|
||||
bool(false)
|
||||
Done
|
||||
@@ -823,7 +823,7 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
|
||||
q = (const uint8_t *)(const void *)
|
||||
((const char *)(const void *)p + ofs
|
||||
- 2 * sizeof(uint32_t));
|
||||
if (q > e) {
|
||||
if (q < p || q > e) {
|
||||
DPRINTF(("Ran of the end %p > %p\n", q, e));
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: funcs.c,v 1.67 2014/02/12 23:20:53 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: funcs.c,v 1.68 2014/02/18 11:09:31 kim Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@@ -173,8 +173,7 @@ file_buffer(struct magic_set *ms, php_stream *stream, const char *inname, const
|
||||
const char *code_mime = "binary";
|
||||
const char *type = "application/octet-stream";
|
||||
const char *def = "data";
|
||||
|
||||
|
||||
const char *ftype = NULL;
|
||||
|
||||
if (nb == 0) {
|
||||
def = "empty";
|
||||
@@ -187,7 +186,7 @@ file_buffer(struct magic_set *ms, php_stream *stream, const char *inname, const
|
||||
|
||||
if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) {
|
||||
looks_text = file_encoding(ms, ubuf, nb, &u8buf, &ulen,
|
||||
&code, &code_mime, &type);
|
||||
&code, &code_mime, &ftype);
|
||||
}
|
||||
|
||||
#ifdef __EMX__
|
||||
@@ -272,7 +271,7 @@ file_buffer(struct magic_set *ms, php_stream *stream, const char *inname, const
|
||||
if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) {
|
||||
if (looks_text == 0)
|
||||
if ((m = file_ascmagic_with_encoding( ms, ubuf,
|
||||
nb, u8buf, ulen, code, type, looks_text))
|
||||
nb, u8buf, ulen, code, ftype, looks_text))
|
||||
!= 0) {
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
(void)fprintf(stderr,
|
||||
|
||||
@@ -48,7 +48,7 @@ string(15) "MIFF image data"
|
||||
string(25) "RIFF (little-endian) data"
|
||||
string(28) "text/plain; charset=us-ascii"
|
||||
string(26) "text/plain; charset=ebcdic"
|
||||
string(22) "binary; charset=binary"
|
||||
string(40) "application/octet-stream; charset=binary"
|
||||
string(28) "text/plain; charset=us-ascii"
|
||||
string(28) "text/plain; charset=us-ascii"
|
||||
string(25) "text/plain; charset=utf-8"
|
||||
|
||||
@@ -47,7 +47,7 @@ string(15) "MIFF image data"
|
||||
string(25) "RIFF (little-endian) data"
|
||||
string(28) "text/plain; charset=us-ascii"
|
||||
string(26) "text/plain; charset=ebcdic"
|
||||
string(22) "binary; charset=binary"
|
||||
string(40) "application/octet-stream; charset=binary"
|
||||
string(28) "text/plain; charset=us-ascii"
|
||||
string(28) "text/plain; charset=us-ascii"
|
||||
string(25) "text/plain; charset=utf-8"
|
||||
|
||||
@@ -124,6 +124,11 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} else if (Z_TYPE_P(to_zval) == IS_STRING) {
|
||||
if (CHECK_ZVAL_NULL_PATH(to_zval)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid 2nd parameter, filename must not contain null bytes");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
stream = php_stream_open_wrapper(Z_STRVAL_P(to_zval), "wb", REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL);
|
||||
if (stream == NULL) {
|
||||
RETURN_FALSE;
|
||||
|
||||
+4
-2
@@ -390,9 +390,10 @@ static void *fontFetch (char **error, void *key)
|
||||
fontlist = gdEstrdup(a->fontlist);
|
||||
|
||||
/*
|
||||
* Must use gd_strtok_r else pointer corrupted by strtok in nested loop.
|
||||
* Must use gd_strtok_r becasuse strtok() isn't thread safe
|
||||
*/
|
||||
for (name = gd_strtok_r (fontlist, LISTSEPARATOR, &strtok_ptr); name; name = gd_strtok_r (0, LISTSEPARATOR, &strtok_ptr)) {
|
||||
char *strtok_ptr_path;
|
||||
/* make a fresh copy each time - strtok corrupts it. */
|
||||
path = gdEstrdup (fontsearchpath);
|
||||
|
||||
@@ -408,7 +409,8 @@ static void *fontFetch (char **error, void *key)
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (dir = strtok (path, PATHSEPARATOR); dir; dir = strtok (0, PATHSEPARATOR)) {
|
||||
for (dir = gd_strtok_r (path, PATHSEPARATOR, &strtok_ptr_path); dir;
|
||||
dir = gd_strtok_r (0, PATHSEPARATOR, &strtok_ptr_path)) {
|
||||
if (!strcmp(dir, ".")) {
|
||||
TSRMLS_FETCH();
|
||||
#if HAVE_GETCWD
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
--TEST--
|
||||
Bug #48801 (Problem with imagettfbbox) freetype >= 2.4.10
|
||||
Bug #48801 (Problem with imagettfbbox) freetype >= 2.4.10 and < 2.4.12
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
if(!function_exists('imageftbbox')) die('skip imageftbbox() not available');
|
||||
|
||||
include dirname(__FILE__) . '/func.inc';
|
||||
if(version_compare(get_freetype_version(), '2.4.10') == -1) die('skip for freetype >= 2.4.10');
|
||||
if(version_compare(get_freetype_version(), '2.4.10') < 0) die('skip for freetype >= 2.4.10');
|
||||
if(version_compare(get_freetype_version(), '2.4.12') >= 0) die('skip for freetype < 2.4.12');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
Bug #48801 (Problem with imagettfbbox) freetype >= 2.4.12
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
if(!function_exists('imageftbbox')) die('skip imageftbbox() not available');
|
||||
|
||||
include dirname(__FILE__) . '/func.inc';
|
||||
if(version_compare(get_freetype_version(), '2.4.12') < 0) die('skip for freetype >= 2.4.12');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$cwd = dirname(__FILE__);
|
||||
$font = "$cwd/Tuffy.ttf";
|
||||
$bbox = imageftbbox(50, 0, $font, "image");
|
||||
echo '(' . $bbox[0] . ', ' . $bbox[1] . ")\n";
|
||||
echo '(' . $bbox[2] . ', ' . $bbox[3] . ")\n";
|
||||
echo '(' . $bbox[4] . ', ' . $bbox[5] . ")\n";
|
||||
echo '(' . $bbox[6] . ', ' . $bbox[7] . ")\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
(-1, 15)
|
||||
(155, 15)
|
||||
(155, -48)
|
||||
(-1, -48)
|
||||
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Testing null byte injection in imagegd2
|
||||
--CLEAN--
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--FILE--
|
||||
<?php
|
||||
$image = imagecreate(1,1);// 1px image
|
||||
|
||||
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
if (!file_exists($tempdir) && !is_dir($tempdir)) {
|
||||
mkdir ($tempdir, 0777, true);
|
||||
}
|
||||
|
||||
$userinput = "1\0"; // from post or get data
|
||||
$temp = $tempdir. "/test" . $userinput .".tmp";
|
||||
|
||||
echo "\nimagegd2 TEST\n";
|
||||
imagegd2($image, $temp);
|
||||
var_dump(file_exists($tempdir. "/test1"));
|
||||
var_dump(file_exists($tempdir. "/test1.tmp"));
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
|
||||
--EXPECTF--
|
||||
imagegd2 TEST
|
||||
|
||||
Warning: imagegd2() expects parameter 2 to be a valid path, string given in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Testing null byte injection in imagegd
|
||||
--CLEAN--
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--FILE--
|
||||
<?php
|
||||
$image = imagecreate(1,1);// 1px image
|
||||
|
||||
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
if (!file_exists($tempdir) && !is_dir($tempdir)) {
|
||||
mkdir ($tempdir, 0777, true);
|
||||
}
|
||||
|
||||
$userinput = "1\0"; // from post or get data
|
||||
$temp = $tempdir. "/test" . $userinput .".tmp";
|
||||
|
||||
echo "\nimagegd TEST\n";
|
||||
imagegd($image, $temp);
|
||||
var_dump(file_exists($tempdir. "/test1"));
|
||||
var_dump(file_exists($tempdir. "/test1.tmp"));
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
|
||||
--EXPECTF--
|
||||
imagegd TEST
|
||||
|
||||
Warning: imagegd() expects parameter 2 to be a valid path, string given in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Testing null byte injection in imagegif
|
||||
--CLEAN--
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--SKIPIF--
|
||||
<?php
|
||||
$support = gd_info();
|
||||
if (!isset($support['GIF Create Support']) || $support['GIF Create Support'] === false) {
|
||||
print 'skip gif support not available';
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$image = imagecreate(1,1);// 1px image
|
||||
|
||||
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
if (!file_exists($tempdir) && !is_dir($tempdir)) {
|
||||
mkdir ($tempdir, 0777, true);
|
||||
}
|
||||
|
||||
$userinput = "1\0"; // from post or get data
|
||||
$temp = $tempdir. "/test" . $userinput .".tmp";
|
||||
|
||||
echo "\nimagegif TEST\n";
|
||||
imagegif($image, $temp);
|
||||
var_dump(file_exists($tempdir. "/test1"));
|
||||
var_dump(file_exists($tempdir. "/test1.tmp"));
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
|
||||
--EXPECTF--
|
||||
imagegif TEST
|
||||
|
||||
Warning: imagegif(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Testing null byte injection in imagejpeg
|
||||
--CLEAN--
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--SKIPIF--
|
||||
<?php
|
||||
$support = gd_info();
|
||||
if (!isset($support['JPEG Support']) || $support['JPEG Support'] === false) {
|
||||
print 'skip jpeg support not available';
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$image = imagecreate(1,1);// 1px image
|
||||
|
||||
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
if (!file_exists($tempdir) && !is_dir($tempdir)) {
|
||||
mkdir ($tempdir, 0777, true);
|
||||
}
|
||||
|
||||
$userinput = "1\0"; // from post or get data
|
||||
$temp = $tempdir. "/test" . $userinput .".tmp";
|
||||
|
||||
echo "\nimagejpeg TEST\n";
|
||||
imagejpeg($image, $temp);
|
||||
var_dump(file_exists($tempdir. "/test1"));
|
||||
var_dump(file_exists($tempdir. "/test1.tmp"));
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
|
||||
--EXPECTF--
|
||||
imagejpeg TEST
|
||||
|
||||
Warning: imagejpeg(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Testing null byte injection in imagepng
|
||||
--CLEAN--
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--SKIPIF--
|
||||
<?php
|
||||
$support = gd_info();
|
||||
if (!isset($support['PNG Support']) || $support['PNG Support'] === false) {
|
||||
print 'skip png support not available';
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$image = imagecreate(1,1);// 1px image
|
||||
|
||||
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
if (!file_exists($tempdir) && !is_dir($tempdir)) {
|
||||
mkdir ($tempdir, 0777, true);
|
||||
}
|
||||
|
||||
$userinput = "1\0"; // from post or get data
|
||||
$temp = $tempdir. "/test" . $userinput .".tmp";
|
||||
|
||||
echo "\nimagepng TEST\n";
|
||||
imagepng($image, $temp);
|
||||
var_dump(file_exists($tempdir. "/test1"));
|
||||
var_dump(file_exists($tempdir. "/test1.tmp"));
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
|
||||
--EXPECTF--
|
||||
imagepng TEST
|
||||
|
||||
Warning: imagepng(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Testing null byte injection in imagewbmp
|
||||
--CLEAN--
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--SKIPIF--
|
||||
<?php
|
||||
$support = gd_info();
|
||||
if (!isset($support['WBMP Support']) || $support['WBMP Support'] === false) {
|
||||
print 'skip wbmp support not available';
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$image = imagecreate(1,1);// 1px image
|
||||
|
||||
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
if (!file_exists($tempdir) && !is_dir($tempdir)) {
|
||||
mkdir ($tempdir, 0777, true);
|
||||
}
|
||||
|
||||
$userinput = "1\0"; // from post or get data
|
||||
$temp = $tempdir. "/test" . $userinput .".tmp";
|
||||
|
||||
echo "\nimagewbmp TEST\n";
|
||||
imagewbmp($image, $temp);
|
||||
var_dump(file_exists($tempdir. "/test1"));
|
||||
var_dump(file_exists($tempdir. "/test1.tmp"));
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
|
||||
--EXPECTF--
|
||||
imagewbmp TEST
|
||||
|
||||
Warning: imagewbmp(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Testing null byte injection in imagewebp
|
||||
--CLEAN--
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--SKIPIF--
|
||||
<?php
|
||||
$support = gd_info();
|
||||
if (!isset($support['WEBP Support']) || $support['WEBP Support'] === false) {
|
||||
print 'skip webp support not available';
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$image = imagecreate(1,1);// 1px image
|
||||
|
||||
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
if (!file_exists($tempdir) && !is_dir($tempdir)) {
|
||||
mkdir ($tempdir, 0777, true);
|
||||
}
|
||||
|
||||
$userinput = "1\0"; // from post or get data
|
||||
$temp = $tempdir. "/test" . $userinput .".tmp";
|
||||
|
||||
echo "\nimagewebp TEST\n";
|
||||
imagewebp($image, $temp);
|
||||
var_dump(file_exists($tempdir. "/test1"));
|
||||
var_dump(file_exists($tempdir. "/test1.tmp"));
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
|
||||
--EXPECTF--
|
||||
imagewbmp TEST
|
||||
|
||||
Warning: imagewebp(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #67917: Using GMP objects with overloaded operators can cause memory exhaustion
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$mem1 = memory_get_usage();
|
||||
for ($i = 0; $i < 1000; $i++) {
|
||||
$gmp = gmp_init(42);
|
||||
$gmp <<= 1;
|
||||
}
|
||||
$mem2 = memory_get_usage();
|
||||
|
||||
var_dump($mem2 - $mem1 < 100000);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
+188
-33
@@ -43,6 +43,18 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_init, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, base)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_import, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, data)
|
||||
ZEND_ARG_INFO(0, word_size)
|
||||
ZEND_ARG_INFO(0, options)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_export, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, gmpnumber)
|
||||
ZEND_ARG_INFO(0, word_size)
|
||||
ZEND_ARG_INFO(0, options)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_intval, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, gmpnumber)
|
||||
ZEND_END_ARG_INFO()
|
||||
@@ -117,6 +129,8 @@ static ZEND_GINIT_FUNCTION(gmp);
|
||||
*/
|
||||
const zend_function_entry gmp_functions[] = {
|
||||
ZEND_FE(gmp_init, arginfo_gmp_init)
|
||||
ZEND_FE(gmp_import, arginfo_gmp_import)
|
||||
ZEND_FE(gmp_export, arginfo_gmp_export)
|
||||
ZEND_FE(gmp_intval, arginfo_gmp_intval)
|
||||
ZEND_FE(gmp_strval, arginfo_gmp_strval)
|
||||
ZEND_FE(gmp_add, arginfo_gmp_binary)
|
||||
@@ -204,6 +218,12 @@ typedef struct _gmp_temp {
|
||||
#define GMP_ROUND_PLUSINF 1
|
||||
#define GMP_ROUND_MINUSINF 2
|
||||
|
||||
#define GMP_MSW_FIRST (1 << 0)
|
||||
#define GMP_LSW_FIRST (1 << 1)
|
||||
#define GMP_LITTLE_ENDIAN (1 << 2)
|
||||
#define GMP_BIG_ENDIAN (1 << 3)
|
||||
#define GMP_NATIVE_ENDIAN (1 << 4)
|
||||
|
||||
#define GMP_42_OR_NEWER \
|
||||
((__GNU_MP_VERSION >= 5) || (__GNU_MP_VERSION >= 4 && __GNU_MP_VERSION_MINOR >= 2))
|
||||
|
||||
@@ -297,7 +317,7 @@ static void gmp_strval(zval *result, mpz_t gmpnum, long base);
|
||||
static int convert_to_gmp(mpz_t gmpnumber, zval *val, int base TSRMLS_DC);
|
||||
static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg TSRMLS_DC);
|
||||
|
||||
/*
|
||||
/*
|
||||
* The gmp_*_op functions provide an implementation for several common types
|
||||
* of GMP functions. The gmp_zval_(unary|binary)_*_op functions have to be manually
|
||||
* passed zvals to work on, whereas the gmp_(unary|binary)_*_op macros already
|
||||
@@ -523,7 +543,7 @@ static void shift_operator_helper(gmp_binary_ui_op_t op, zval *return_value, zva
|
||||
gmp_zval_unary_op(result, op1, op TSRMLS_CC); \
|
||||
return SUCCESS;
|
||||
|
||||
static int gmp_do_operation(zend_uchar opcode, zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */
|
||||
static int gmp_do_operation_ex(zend_uchar opcode, zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
switch (opcode) {
|
||||
case ZEND_ADD:
|
||||
@@ -560,6 +580,26 @@ static int gmp_do_operation(zend_uchar opcode, zval *result, zval *op1, zval *op
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int gmp_do_operation(zend_uchar opcode, zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zval op1_copy;
|
||||
int retval;
|
||||
|
||||
if (result == op1) {
|
||||
ZVAL_COPY_VALUE(&op1_copy, op1);
|
||||
op1 = &op1_copy;
|
||||
}
|
||||
|
||||
retval = gmp_do_operation_ex(opcode, result, op1, op2 TSRMLS_CC);
|
||||
|
||||
if (retval == SUCCESS && op1 == &op1_copy) {
|
||||
zval_dtor(op1);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int gmp_compare(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
gmp_cmp(result, op1, op2 TSRMLS_CC);
|
||||
@@ -579,7 +619,7 @@ static int gmp_serialize(zval *object, unsigned char **buffer, zend_uint *buf_le
|
||||
|
||||
PHP_VAR_SERIALIZE_INIT(serialize_data);
|
||||
INIT_PZVAL(zv_ptr);
|
||||
|
||||
|
||||
gmp_strval(zv_ptr, gmpnum, 10);
|
||||
php_var_serialize(&buf, &zv_ptr, &serialize_data TSRMLS_CC);
|
||||
zval_dtor(zv_ptr);
|
||||
@@ -677,6 +717,12 @@ ZEND_MINIT_FUNCTION(gmp)
|
||||
#endif
|
||||
REGISTER_STRING_CONSTANT("GMP_VERSION", (char *)gmp_version, CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
REGISTER_LONG_CONSTANT("GMP_MSW_FIRST", GMP_MSW_FIRST, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GMP_LSW_FIRST", GMP_LSW_FIRST, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GMP_LITTLE_ENDIAN", GMP_LITTLE_ENDIAN, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GMP_BIG_ENDIAN", GMP_BIG_ENDIAN, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GMP_NATIVE_ENDIAN", GMP_NATIVE_ENDIAN, CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
mp_set_memory_functions(gmp_emalloc, gmp_erealloc, gmp_efree);
|
||||
|
||||
return SUCCESS;
|
||||
@@ -714,7 +760,7 @@ ZEND_MODULE_INFO_D(gmp)
|
||||
|
||||
/* {{{ convert_to_gmp
|
||||
* Convert zval to be gmp number */
|
||||
static int convert_to_gmp(mpz_t gmpnumber, zval *val, int base TSRMLS_DC)
|
||||
static int convert_to_gmp(mpz_t gmpnumber, zval *val, int base TSRMLS_DC)
|
||||
{
|
||||
switch (Z_TYPE_P(val)) {
|
||||
case IS_LONG:
|
||||
@@ -727,15 +773,13 @@ static int convert_to_gmp(mpz_t gmpnumber, zval *val, int base TSRMLS_DC)
|
||||
int skip_lead = 0;
|
||||
int ret;
|
||||
|
||||
if (Z_STRLEN_P(val) > 2) {
|
||||
if (numstr[0] == '0') {
|
||||
if (numstr[1] == 'x' || numstr[1] == 'X') {
|
||||
base = 16;
|
||||
skip_lead = 1;
|
||||
} else if (base != 16 && (numstr[1] == 'b' || numstr[1] == 'B')) {
|
||||
base = 2;
|
||||
skip_lead = 1;
|
||||
}
|
||||
if (Z_STRLEN_P(val) > 2 && numstr[0] == '0') {
|
||||
if ((base == 0 || base == 16) && (numstr[1] == 'x' || numstr[1] == 'X')) {
|
||||
base = 16;
|
||||
skip_lead = 1;
|
||||
} else if ((base == 0 || base == 2) && (numstr[1] == 'b' || numstr[1] == 'B')) {
|
||||
base = 2;
|
||||
skip_lead = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -768,8 +812,8 @@ static void gmp_strval(zval *result, mpz_t gmpnum, long base) /* {{{ */
|
||||
|
||||
out_string = emalloc(num_len + 1);
|
||||
mpz_get_str(out_string, base, gmpnum);
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
* From GMP documentation for mpz_sizeinbase():
|
||||
* The returned value will be exact or 1 too big. If base is a power of
|
||||
* 2, the returned value will always be exact.
|
||||
@@ -811,7 +855,7 @@ static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg TSRMLS_DC) /* {
|
||||
|
||||
FREE_GMP_TEMP(temp_a);
|
||||
FREE_GMP_TEMP(temp_b);
|
||||
|
||||
|
||||
RETURN_LONG(res);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -819,14 +863,14 @@ static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg TSRMLS_DC) /* {
|
||||
/* {{{ gmp_zval_binary_ui_op
|
||||
Execute GMP binary operation.
|
||||
*/
|
||||
static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval *b_arg, gmp_binary_op_t gmp_op, gmp_binary_ui_op_t gmp_ui_op, int check_b_zero TSRMLS_DC)
|
||||
static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval *b_arg, gmp_binary_op_t gmp_op, gmp_binary_ui_op_t gmp_ui_op, int check_b_zero TSRMLS_DC)
|
||||
{
|
||||
mpz_ptr gmpnum_a, gmpnum_b, gmpnum_result;
|
||||
int use_ui = 0;
|
||||
gmp_temp_t temp_a, temp_b;
|
||||
|
||||
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
|
||||
|
||||
|
||||
if (gmp_ui_op && Z_TYPE_P(b_arg) == IS_LONG && Z_LVAL_P(b_arg) >= 0) {
|
||||
use_ui = 1;
|
||||
temp_b.is_used = 0;
|
||||
@@ -922,7 +966,7 @@ static inline void _gmp_binary_ui_op(INTERNAL_FUNCTION_PARAMETERS, gmp_binary_op
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &a_arg, &b_arg) == FAILURE){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
gmp_zval_binary_ui_op(return_value, a_arg, b_arg, gmp_op, gmp_ui_op, check_b_zero TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -931,11 +975,11 @@ static inline void _gmp_binary_ui_op(INTERNAL_FUNCTION_PARAMETERS, gmp_binary_op
|
||||
|
||||
/* {{{ gmp_zval_unary_op
|
||||
*/
|
||||
static inline void gmp_zval_unary_op(zval *return_value, zval *a_arg, gmp_unary_op_t gmp_op TSRMLS_DC)
|
||||
static inline void gmp_zval_unary_op(zval *return_value, zval *a_arg, gmp_unary_op_t gmp_op TSRMLS_DC)
|
||||
{
|
||||
mpz_ptr gmpnum_a, gmpnum_result;
|
||||
gmp_temp_t temp_a;
|
||||
|
||||
|
||||
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
|
||||
|
||||
INIT_GMP_RETVAL(gmpnum_result);
|
||||
@@ -980,7 +1024,7 @@ static inline void _gmp_unary_op(INTERNAL_FUNCTION_PARAMETERS, gmp_unary_op_t gm
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &a_arg) == FAILURE){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
gmp_zval_unary_op(return_value, a_arg, gmp_op TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -996,7 +1040,7 @@ static inline void _gmp_unary_opl(INTERNAL_FUNCTION_PARAMETERS, gmp_unary_opl_t
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &a_arg) == FAILURE){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
|
||||
RETVAL_LONG(gmp_op(gmpnum_a));
|
||||
FREE_GMP_TEMP(temp_a);
|
||||
@@ -1050,6 +1094,118 @@ ZEND_FUNCTION(gmp_init)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
int gmp_import_export_validate(long size, long options, int *order, int *endian TSRMLS_DC)
|
||||
{
|
||||
if (size < 1) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,
|
||||
"Word size must be positive, %ld given", size);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
switch (options & (GMP_LSW_FIRST | GMP_MSW_FIRST)) {
|
||||
case GMP_LSW_FIRST:
|
||||
*order = -1;
|
||||
break;
|
||||
case GMP_MSW_FIRST:
|
||||
case 0: /* default */
|
||||
*order = 1;
|
||||
break;
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,
|
||||
"Invalid options: Conflicting word orders");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
switch (options & (GMP_LITTLE_ENDIAN | GMP_BIG_ENDIAN | GMP_NATIVE_ENDIAN)) {
|
||||
case GMP_LITTLE_ENDIAN:
|
||||
*endian = -1;
|
||||
break;
|
||||
case GMP_BIG_ENDIAN:
|
||||
*endian = 1;
|
||||
break;
|
||||
case GMP_NATIVE_ENDIAN:
|
||||
case 0: /* default */
|
||||
*endian = 0;
|
||||
break;
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,
|
||||
"Invalid options: Conflicting word endianness");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* {{{ proto GMP gmp_import(string data [, int word_size = 1, int options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN])
|
||||
Imports a GMP number from a binary string */
|
||||
ZEND_FUNCTION(gmp_import)
|
||||
{
|
||||
char *data;
|
||||
int data_len;
|
||||
long size = 1;
|
||||
long options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN;
|
||||
int order, endian;
|
||||
mpz_ptr gmpnumber;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &data, &data_len, &size, &options) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (gmp_import_export_validate(size, options, &order, &endian TSRMLS_CC) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if ((data_len % size) != 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,
|
||||
"Input length must be a multiple of word size");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
INIT_GMP_RETVAL(gmpnumber);
|
||||
|
||||
mpz_import(gmpnumber, data_len / size, order, size, endian, 0, data);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string gmp_export(GMP gmpnumber [, int word_size = 1, int options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN])
|
||||
Exports a GMP number to a binary string */
|
||||
ZEND_FUNCTION(gmp_export)
|
||||
{
|
||||
zval *gmpnumber_arg;
|
||||
long size = 1;
|
||||
long options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN;
|
||||
int order, endian;
|
||||
mpz_ptr gmpnumber;
|
||||
gmp_temp_t temp_a;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ll", &gmpnumber_arg, &size, &options) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (gmp_import_export_validate(size, options, &order, &endian TSRMLS_CC) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
FETCH_GMP_ZVAL(gmpnumber, gmpnumber_arg, temp_a);
|
||||
|
||||
if (mpz_sgn(gmpnumber) == 0) {
|
||||
RETURN_EMPTY_STRING();
|
||||
} else {
|
||||
size_t bits_per_word = size * 8;
|
||||
size_t count = (mpz_sizeinbase(gmpnumber, 2) + bits_per_word - 1) / bits_per_word;
|
||||
size_t out_len = count * size;
|
||||
|
||||
char *out_string = emalloc(out_len + 1);
|
||||
mpz_export(out_string, NULL, order, size, endian, 0, gmpnumber);
|
||||
out_string[out_len] = '\0';
|
||||
|
||||
RETURN_STRINGL(out_string, out_len, 0);
|
||||
}
|
||||
|
||||
FREE_GMP_TEMP(temp_a);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int gmp_intval(mixed gmpnumber)
|
||||
Gets signed long value of GMP number */
|
||||
ZEND_FUNCTION(gmp_intval)
|
||||
@@ -1059,7 +1215,7 @@ ZEND_FUNCTION(gmp_intval)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &gmpnumber_arg) == FAILURE){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (IS_GMP(gmpnumber_arg)) {
|
||||
RETVAL_LONG(mpz_get_si(GET_GMP_FROM_ZVAL(gmpnumber_arg)));
|
||||
} else {
|
||||
@@ -1206,7 +1362,7 @@ ZEND_FUNCTION(gmp_div_q)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid rounding mode");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1286,7 +1442,7 @@ ZEND_FUNCTION(gmp_pow)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Negative exponent not supported");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
INIT_GMP_RETVAL(gmpnum_result);
|
||||
if (Z_TYPE_P(base_arg) == IS_LONG && Z_LVAL_P(base_arg) >= 0) {
|
||||
mpz_ui_pow_ui(gmpnum_result, Z_LVAL_P(base_arg), exp);
|
||||
@@ -1328,10 +1484,9 @@ ZEND_FUNCTION(gmp_powm)
|
||||
FETCH_GMP_ZVAL_DEP_DEP(gmpnum_mod, mod_arg, temp_mod, temp_exp, temp_base);
|
||||
|
||||
if (!mpz_cmp_ui(gmpnum_mod, 0)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Modulus may not be zero");
|
||||
FREE_GMP_TEMP(temp_base);
|
||||
if (use_ui) {
|
||||
FREE_GMP_TEMP(temp_exp);
|
||||
}
|
||||
FREE_GMP_TEMP(temp_exp);
|
||||
FREE_GMP_TEMP(temp_mod);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -1360,14 +1515,14 @@ ZEND_FUNCTION(gmp_sqrt)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &a_arg) == FAILURE){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
|
||||
|
||||
if (mpz_sgn(gmpnum_a) < 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number has to be greater than or equal to 0");
|
||||
FREE_GMP_TEMP(temp_a);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
INIT_GMP_RETVAL(gmpnum_result);
|
||||
mpz_sqrt(gmpnum_result, gmpnum_a);
|
||||
@@ -1394,7 +1549,7 @@ ZEND_FUNCTION(gmp_sqrtrem)
|
||||
FREE_GMP_TEMP(temp_a);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
array_init(return_value);
|
||||
add_index_zval(return_value, 0, gmp_create(&gmpnum_result1 TSRMLS_CC));
|
||||
add_index_zval(return_value, 1, gmp_create(&gmpnum_result2 TSRMLS_CC));
|
||||
@@ -1474,7 +1629,7 @@ ZEND_FUNCTION(gmp_rootrem)
|
||||
mpz_sub(gmpnum_result2, gmpnum_a, gmpnum_result2);
|
||||
mpz_abs(gmpnum_result2, gmpnum_result2);
|
||||
#endif
|
||||
|
||||
|
||||
FREE_GMP_TEMP(temp_a);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -31,6 +31,8 @@ ZEND_MODULE_DEACTIVATE_D(gmp);
|
||||
ZEND_MODULE_INFO_D(gmp);
|
||||
|
||||
ZEND_FUNCTION(gmp_init);
|
||||
ZEND_FUNCTION(gmp_import);
|
||||
ZEND_FUNCTION(gmp_export);
|
||||
ZEND_FUNCTION(gmp_intval);
|
||||
ZEND_FUNCTION(gmp_strval);
|
||||
ZEND_FUNCTION(gmp_add);
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
--TEST--
|
||||
Check for gmp presence
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gmp")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo "gmp extension is available";
|
||||
/*
|
||||
you can add regression tests for your extension here
|
||||
|
||||
the output of your test code has to be equal to the
|
||||
text in the --EXPECT-- section below for the tests
|
||||
to pass, differences between the output and the
|
||||
expected text are interpreted as failure
|
||||
|
||||
see php5/tests/README for further information on
|
||||
writing regression tests
|
||||
*/
|
||||
?>
|
||||
--EXPECT--
|
||||
gmp extension is available
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #50175: gmp_init() results 0 on given base and number starting with 0x or 0b
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(gmp_init('0bcd', 16));
|
||||
var_dump(gmp_init('0xyz', 36));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(GMP)#%d (1) {
|
||||
["num"]=>
|
||||
string(4) "3021"
|
||||
}
|
||||
object(GMP)#%d (1) {
|
||||
["num"]=>
|
||||
string(5) "44027"
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -10,11 +10,13 @@ var_dump(gmp_div_qr(""));
|
||||
|
||||
var_dump(gmp_div_qr(0,1));
|
||||
var_dump(gmp_div_qr(1,0));
|
||||
var_dump(gmp_div_qr(gmp_init(1), gmp_init(0)));
|
||||
var_dump(gmp_div_qr(12653,23482734));
|
||||
var_dump(gmp_div_qr(12653,23482734, 10));
|
||||
var_dump(gmp_div_qr(1123123,123));
|
||||
var_dump(gmp_div_qr(1123123,123, 1));
|
||||
var_dump(gmp_div_qr(1123123,123, 2));
|
||||
var_dump(gmp_div_qr(gmp_init(1123123), gmp_init(123)));
|
||||
var_dump(gmp_div_qr(1123123,123, GMP_ROUND_ZERO));
|
||||
var_dump(gmp_div_qr(1123123,123, GMP_ROUND_PLUSINF));
|
||||
var_dump(gmp_div_qr(1123123,123, GMP_ROUND_MINUSINF));
|
||||
@@ -45,6 +47,9 @@ array(2) {
|
||||
}
|
||||
}
|
||||
|
||||
Warning: gmp_div_qr(): Zero operand not allowed in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_div_qr(): Zero operand not allowed in %s on line %d
|
||||
bool(false)
|
||||
array(2) {
|
||||
@@ -110,6 +115,18 @@ array(2) {
|
||||
string(2) "10"
|
||||
}
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
object(GMP)#%d (1) {
|
||||
["num"]=>
|
||||
string(4) "9131"
|
||||
}
|
||||
[1]=>
|
||||
object(GMP)#%d (1) {
|
||||
["num"]=>
|
||||
string(2) "10"
|
||||
}
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
object(GMP)#%d (1) {
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,80 @@
|
||||
--TEST--
|
||||
gmp_export() basic tests
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gmp")) echo "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
// Tests taken from GMPs own test suite.
|
||||
|
||||
// format is [output, size, options, expected]
|
||||
$export = [
|
||||
['0',1,GMP_BIG_ENDIAN,''],
|
||||
['0',2,GMP_BIG_ENDIAN,''],
|
||||
['0',3,GMP_BIG_ENDIAN,''],
|
||||
['12345678',1,GMP_BIG_ENDIAN,'12345678'],
|
||||
['12345678',4,GMP_BIG_ENDIAN,'12345678'],
|
||||
['12345678',4,GMP_LSW_FIRST | GMP_BIG_ENDIAN,'12345678'],
|
||||
['12345678',1,GMP_LSW_FIRST | GMP_LITTLE_ENDIAN,'78563412'],
|
||||
['12345678',4,GMP_LITTLE_ENDIAN,'78563412'],
|
||||
['12345678',4,GMP_LSW_FIRST | GMP_LITTLE_ENDIAN,'78563412'],
|
||||
['123456789ABC',2,GMP_BIG_ENDIAN,'123456789abc'],
|
||||
['123456789ABC',2,GMP_LSW_FIRST | GMP_BIG_ENDIAN,'9abc56781234'],
|
||||
['123456789ABC',2,GMP_LITTLE_ENDIAN,'34127856bc9a'],
|
||||
['123456789ABC',2,GMP_LSW_FIRST | GMP_LITTLE_ENDIAN,'bc9a78563412'],
|
||||
['112233445566778899AABBCC',4,GMP_BIG_ENDIAN,'112233445566778899aabbcc'],
|
||||
['112233445566778899AABBCC',4,GMP_LSW_FIRST | GMP_BIG_ENDIAN,'99aabbcc5566778811223344'],
|
||||
['112233445566778899AABBCC',4,GMP_LITTLE_ENDIAN,'4433221188776655ccbbaa99'],
|
||||
['112233445566778899AABBCC',4,GMP_LSW_FIRST | GMP_LITTLE_ENDIAN,'ccbbaa998877665544332211'],
|
||||
['100120023003400450056006700780089009A00AB00BC00C',8,GMP_BIG_ENDIAN,'100120023003400450056006700780089009a00ab00bc00c'],
|
||||
['100120023003400450056006700780089009A00AB00BC00C',8,GMP_LSW_FIRST | GMP_BIG_ENDIAN,'9009a00ab00bc00c50056006700780081001200230034004'],
|
||||
['100120023003400450056006700780089009A00AB00BC00C',8,GMP_LITTLE_ENDIAN,'044003300220011008800770066005500cc00bb00aa00990'],
|
||||
['100120023003400450056006700780089009A00AB00BC00C',8,GMP_LSW_FIRST | GMP_LITTLE_ENDIAN,'0cc00bb00aa0099008800770066005500440033002200110']
|
||||
];
|
||||
|
||||
$passed = true;
|
||||
foreach ($export as $k => $test) {
|
||||
$gmp = gmp_init($test[0], 16);
|
||||
$str = gmp_export($gmp, $test[1], $test[2]);
|
||||
if (is_string($str)) {
|
||||
$result = bin2hex($str);
|
||||
if ($result !== $test[3]) {
|
||||
echo "$k: '$result' !== '{$test[3]}'\n";
|
||||
$passed = false;
|
||||
}
|
||||
} else {
|
||||
$type = gettype($str);
|
||||
echo "$k: $type !== '{$test[3]}'\n";
|
||||
}
|
||||
}
|
||||
|
||||
var_dump($passed);
|
||||
|
||||
// Invalid arguments (zpp failure)
|
||||
var_dump(gmp_export());
|
||||
|
||||
// Invalid word sizes
|
||||
var_dump(gmp_export(123, -1));
|
||||
var_dump(gmp_export(123, 0));
|
||||
|
||||
// Invalid options
|
||||
var_dump(gmp_export(123, 1, GMP_MSW_FIRST | GMP_LSW_FIRST));
|
||||
var_dump(gmp_export(123, 1, GMP_BIG_ENDIAN | GMP_LITTLE_ENDIAN));
|
||||
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
|
||||
Warning: gmp_export() expects at least 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: gmp_export(): Word size must be positive, -1 given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_export(): Word size must be positive, 0 given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_export(): Invalid options: Conflicting word orders in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_export(): Invalid options: Conflicting word endianness in %s on line %d
|
||||
bool(false)
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,91 @@
|
||||
--TEST--
|
||||
gmp_import() basic tests
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gmp")) echo "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
// Tests taken from GMPs own test suite.
|
||||
|
||||
// format is [expected, size, options, input]
|
||||
$import = [
|
||||
['0',1,GMP_BIG_ENDIAN,''],
|
||||
['12345678',1,GMP_BIG_ENDIAN,'12345678'],
|
||||
['12345678',4,GMP_BIG_ENDIAN,'12345678'],
|
||||
['12345678',4,GMP_LSW_FIRST | GMP_BIG_ENDIAN,'12345678'],
|
||||
['12345678',1,GMP_LSW_FIRST | GMP_LITTLE_ENDIAN,'78563412'],
|
||||
['12345678',4,GMP_LITTLE_ENDIAN,'78563412'],
|
||||
['12345678',4,GMP_LSW_FIRST | GMP_LITTLE_ENDIAN,'78563412'],
|
||||
['123456789abc',2,GMP_BIG_ENDIAN,'123456789abc'],
|
||||
['123456789abc',2,GMP_LSW_FIRST | GMP_BIG_ENDIAN,'9abc56781234'],
|
||||
['123456789abc',2,GMP_LITTLE_ENDIAN,'34127856bc9a'],
|
||||
['123456789abc',2,GMP_LSW_FIRST | GMP_LITTLE_ENDIAN,'bc9a78563412'],
|
||||
['112233445566778899aabbcc',4,GMP_BIG_ENDIAN,'112233445566778899aabbcc'],
|
||||
['112233445566778899aabbcc',4,GMP_LSW_FIRST | GMP_BIG_ENDIAN,'99aabbcc5566778811223344'],
|
||||
['112233445566778899aabbcc',4,GMP_LITTLE_ENDIAN,'4433221188776655ccbbaa99'],
|
||||
['112233445566778899aabbcc',4,GMP_LSW_FIRST | GMP_LITTLE_ENDIAN,'ccbbaa998877665544332211'],
|
||||
['100120023003400450056006700780089009a00ab00bc00c',8,GMP_BIG_ENDIAN,'100120023003400450056006700780089009a00ab00bc00c'],
|
||||
['100120023003400450056006700780089009a00ab00bc00c',8,GMP_LSW_FIRST | GMP_BIG_ENDIAN,'9009a00ab00bc00c50056006700780081001200230034004'],
|
||||
['100120023003400450056006700780089009a00ab00bc00c',8,GMP_LITTLE_ENDIAN,'044003300220011008800770066005500cc00bb00aa00990'],
|
||||
['100120023003400450056006700780089009a00ab00bc00c',8,GMP_LSW_FIRST | GMP_LITTLE_ENDIAN,'0cc00bb00aa0099008800770066005500440033002200110']
|
||||
];
|
||||
|
||||
$passed = true;
|
||||
foreach ($import as $k => $test) {
|
||||
$gmp = gmp_import(hex2bin($test[3]), $test[1], $test[2]);
|
||||
if ($gmp instanceof GMP) {
|
||||
$result = gmp_strval($gmp, 16);
|
||||
if ($result !== $test[0]) {
|
||||
echo "$k: '$result' !== '{$test[0]}'\n";
|
||||
$passed = false;
|
||||
}
|
||||
} else {
|
||||
$type = gettype($gmp);
|
||||
echo "$k: $type !== '{$test[0]}'\n";
|
||||
}
|
||||
}
|
||||
|
||||
var_dump($passed);
|
||||
|
||||
// Invalid arguments (zpp failure)
|
||||
var_dump(gmp_import());
|
||||
|
||||
// Invalid word sizes
|
||||
var_dump(gmp_import('a', -1));
|
||||
var_dump(gmp_import('a', 0));
|
||||
|
||||
// Invalid data lengths
|
||||
var_dump(gmp_import('a', 2));
|
||||
var_dump(gmp_import('aa', 3));
|
||||
var_dump(gmp_import(str_repeat('a', 100), 64));
|
||||
|
||||
// Invalid options
|
||||
var_dump(gmp_import('a', 1, GMP_MSW_FIRST | GMP_LSW_FIRST));
|
||||
var_dump(gmp_import('a', 1, GMP_BIG_ENDIAN | GMP_LITTLE_ENDIAN));
|
||||
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
|
||||
Warning: gmp_import() expects at least 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: gmp_import(): Word size must be positive, -1 given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_import(): Word size must be positive, 0 given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_import(): Input length must be a multiple of word size in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_import(): Input length must be a multiple of word size in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_import(): Input length must be a multiple of word size in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_import(): Invalid options: Conflicting word orders in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_import(): Invalid options: Conflicting word endianness in %s on line %d
|
||||
bool(false)
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -19,6 +19,9 @@ var_dump(gmp_strval(gmp_powm($n,$e,1000)));
|
||||
$m = gmp_init(900);
|
||||
var_dump(gmp_strval(gmp_powm($n,$e,$m)));
|
||||
|
||||
var_dump(gmp_powm(5, 11, 0));
|
||||
var_dump(gmp_powm(5, "11", gmp_init(0)));
|
||||
|
||||
var_dump(gmp_powm(array(),$e,$m));
|
||||
var_dump(gmp_powm($n,array(),$m));
|
||||
var_dump(gmp_powm($n,$e,array()));
|
||||
@@ -46,6 +49,12 @@ string(3) "331"
|
||||
string(3) "171"
|
||||
string(3) "371"
|
||||
|
||||
Warning: gmp_powm(): Modulus may not be zero in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_powm(): Modulus may not be zero in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_powm(): Unable to convert variable to GMP - wrong type in %s on line %d
|
||||
bool(false)
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -1,21 +1,11 @@
|
||||
--TEST--
|
||||
gmp_root() and gmp_rootrem() basic tests
|
||||
gmp_rootrem() basic tests
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gmp")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(gmp_root(1000, 3));
|
||||
var_dump(gmp_root(100, 3));
|
||||
var_dump(gmp_root(-100, 3));
|
||||
|
||||
var_dump(gmp_root(1000, 4));
|
||||
var_dump(gmp_root(100, 4));
|
||||
var_dump(gmp_root(-100, 4));
|
||||
|
||||
var_dump(gmp_root(0, 3));
|
||||
var_dump(gmp_root(100, 0));
|
||||
var_dump(gmp_root(100, -3));
|
||||
var_dump(gmp_rootrem());
|
||||
|
||||
var_dump(gmp_rootrem(1000, 3));
|
||||
var_dump(gmp_rootrem(100, 3));
|
||||
@@ -31,39 +21,8 @@ var_dump(gmp_rootrem(100, -3));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(GMP)#%d (1) {
|
||||
["num"]=>
|
||||
string(2) "10"
|
||||
}
|
||||
object(GMP)#%d (1) {
|
||||
["num"]=>
|
||||
string(1) "4"
|
||||
}
|
||||
object(GMP)#%d (1) {
|
||||
["num"]=>
|
||||
string(2) "-4"
|
||||
}
|
||||
object(GMP)#%d (1) {
|
||||
["num"]=>
|
||||
string(1) "5"
|
||||
}
|
||||
object(GMP)#%d (1) {
|
||||
["num"]=>
|
||||
string(1) "3"
|
||||
}
|
||||
|
||||
Warning: gmp_root(): Can't take even root of negative number in %s on line %d
|
||||
bool(false)
|
||||
object(GMP)#%d (1) {
|
||||
["num"]=>
|
||||
string(1) "0"
|
||||
}
|
||||
|
||||
Warning: gmp_root(): The root must be positive in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_root(): The root must be positive in %s on line %d
|
||||
bool(false)
|
||||
Warning: gmp_rootrem() expects exactly 2 parameters, 0 given in %s on line %d
|
||||
NULL
|
||||
array(2) {
|
||||
[0]=>
|
||||
object(GMP)#%d (1) {
|
||||
@@ -0,0 +1,58 @@
|
||||
--TEST--
|
||||
gmp_root() basic tests
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gmp")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(gmp_root());
|
||||
|
||||
var_dump(gmp_root(1000, 3));
|
||||
var_dump(gmp_root(100, 3));
|
||||
var_dump(gmp_root(-100, 3));
|
||||
|
||||
var_dump(gmp_root(1000, 4));
|
||||
var_dump(gmp_root(100, 4));
|
||||
var_dump(gmp_root(-100, 4));
|
||||
|
||||
var_dump(gmp_root(0, 3));
|
||||
var_dump(gmp_root(100, 0));
|
||||
var_dump(gmp_root(100, -3));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: gmp_root() expects exactly 2 parameters, 0 given in %s on line %d
|
||||
NULL
|
||||
object(GMP)#%d (1) {
|
||||
["num"]=>
|
||||
string(2) "10"
|
||||
}
|
||||
object(GMP)#%d (1) {
|
||||
["num"]=>
|
||||
string(1) "4"
|
||||
}
|
||||
object(GMP)#%d (1) {
|
||||
["num"]=>
|
||||
string(2) "-4"
|
||||
}
|
||||
object(GMP)#%d (1) {
|
||||
["num"]=>
|
||||
string(1) "5"
|
||||
}
|
||||
object(GMP)#%d (1) {
|
||||
["num"]=>
|
||||
string(1) "3"
|
||||
}
|
||||
|
||||
Warning: gmp_root(): Can't take even root of negative number in %s on line %d
|
||||
bool(false)
|
||||
object(GMP)#%d (1) {
|
||||
["num"]=>
|
||||
string(1) "0"
|
||||
}
|
||||
|
||||
Warning: gmp_root(): The root must be positive in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_root(): The root must be positive in %s on line %d
|
||||
bool(false)
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -5,6 +5,8 @@ gmp_testbit() basic tests
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(gmp_testbit());
|
||||
|
||||
$n = gmp_init(0);
|
||||
var_dump(gmp_testbit($n, -10));
|
||||
var_dump(gmp_testbit($n, 0));
|
||||
@@ -38,6 +40,9 @@ var_dump(gmp_strval($n));
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: gmp_testbit() expects exactly 2 parameters, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: gmp_testbit(): Index must be greater than or equal to zero in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
File renamed without changes.
Loaded 100 of 157 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user