Compare commits

..
865 changed files with 5866 additions and 48795 deletions

No files matched your search

+1 -175
View File
@@ -1,180 +1,5 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
11 Jun 2009, PHP 5.2.10RC2
- Updated timezone database to version 2009.9 (2009i) (Derick)
- Added "ignore_errors" option to http fopen wrapper. (David Zulke, Sara)
- Fixed bug #48518 (curl crashes when writing into invalid file handle). (Tony)
- Fixed bug #48469 (ldap_get_entries() leaks memory on empty search results).
(Patrick)
- Fixed bug #48456 (CPPFLAGS not restored properly in phpize.m4).
(Jani, spisek at kerio dot com)
- Fixed bug #48448 (Compile failure under IRIX 6.5.30 building cast.c).
(Kalle)
- Fixed bug #48434 (Improve memory_get_usage() accuracy). (Arnaud)
- Fixed bug #48416 (Force a cache limit in ereg() to stop excessive memory usage).
(Scott)
- Fixed bug #48409 (Crash when exception is thrown while passing function
arguments). (Arnaud)
- Fixed bug #48378 (exif_read_data() segfaults on certain corrupted .jpeg
files). (Pierre)
- Fixed bug #48359 (Script hangs on snmprealwalk if OID is not
increasing). (Ilia, simonov at gmail dot com)
- Fixed bug #48273 (snmp*_real_walk() returns SNMP errors as values).
(Ilia, lytboris at gmail dot com)
- Fixed bug #48247 (Crash on errors during startup). (Stas)
- Fixed bug #47836 (array operator [] inconsistency when the array has
PHP_INT_MAX index value). (Matt)
- Fixed bug #47042 (cgi sapi is incorrectly removing SCRIPT_FILENAME).
(Sriram Natarajan, David Soria Parra)
- Fixed bug #46386 (Digest authentication with SOAP module fails against MSSQL
SOAP services). (Ilia, lordelph at gmail dot com)
- Fixed bug #46109 (Memory leak when mysqli::init() is called multiple times).
(Andrey)
- Fixed bug #44827 (define() is missing error checks for class constants).
(Ilia)
- Fixed bug #44214 (Crash using preg_replace_callback() and global variables).
(Nuno, Scott)
- Fixed bug #42143 (The constant NAN is reported as 0 on Windows)
(Kanwaljeet Singla, Venkat Raman Don)
27 May 2009, PHP 5.2.10RC1
- Updated timezone database to version 2009.8 (2009h) (Derick)
- Changed default value of array_unique()'s optional sorting type parameter
back to SORT_STRING to fix backwards compatibility breakage introduced in
PHP 5.2.9. (Moriyoshi)
- Added new CURL options CURLOPT_REDIR_PROTOCOLS, CURLOPT_PROTOCOLS,
and CURLPROTO_* for redirect fixes in CURL 7.19.4. (Yoram Bar Haim, Stas)
- Added support for Sun CC (FR #46595 and FR #46513). (David Soria Parra)
- Fixed memory corruptions while reading properties of zip files. (Ilia)
- Fixed memory leak in ob_get_clean/ob_get_flush. (Christian)
- Fixed segfault on invalid session.save_path. (Hannes)
- Fixed leaks in imap when a mail_criteria is used. (Pierre)
- Fixed bug #48336 (ReflectionProperty::getDeclaringClass() does not work with
redeclared property). (patch by Markus dot Lidel at shadowconnect dot com)
- Fixed bug #48326 (constant MSG_DONTWAIT not defined). (Arnaud)
- Fixed bug #48313 (fgetcsv() does not return null for empty rows). (Ilia)
- Fixed bug #48309 (stream_copy_to_stream() and fpasstru() do not update stream
position of plain files). (Arnaud)
- Fixed bug #48307 (stream_copy_to_stream() copies 0 bytes when $source is a
socket). (Arnaud)
- Fixed bug #48256 (Crash due to double-linking of history.o).
(tstarling at wikimedia dot org)
- Fixed bug #48248 (SIGSEGV when access to private property via &__get).
(Felipe)
- Fixed bug #48240 (DBA Segmentation fault dba_nextkey). (Felipe)
- Fixed bug #48224 (Incorrect shuffle in array_rand). (Etienne)
- Fixed bug #48221 (memory leak when passing invalid xslt parameter). (Felipe)
- Fixed bug #48207 (CURLOPT_(FILE|WRITEHEADER options do not error out when
working with a non-writable stream). (Ilia)
- Fixed bug #48206 (Iterating over an invalid data structure
with RecursiveIteratorIterator leads to a segfault). (Scott)
- Fixed bug #48204 (xmlwriter_open_uri() does not emit warnings on invalid
paths). (Ilia)
- Fixed bug #48203 (Crash when CURLOPT_STDERR is set to regular file). (Jani)
- Fixed bug #48202 (Out of Memory error message when passing invalid file path)
(Pierre)
- Fixed bug #48156 (Added support for lcov v1.7). (Ilia)
- Fixed bug #48131 (Don't try to bind ipv4 addresses to ipv6 ips via
bindto). (Ilia)
- Fixed bug #48132 (configure check for curl ssl support fails with
--disable-rpath). (Jani)
- Fixed bug #48070 (PDO_OCI: Segfault when using persistent connection).
(Pierre, Matteo, jarismar dot php at gmail dot com)
- Fixed bug #48058 (Year formatter goes wrong with out-of-int range). (Derick)
- Fixed bug #48038 (odbc_execute changes variables used to form params array).
(Felipe)
- Fixed bug #47997 (stream_copy_to_stream returns 1 on empty streams). (Arnaud)
- Fixed bug #47991 (SSL streams fail if error stack contains items). (Mikko)
- Fixed bug #47981 (error handler not called regardless). (Hannes)
- Fixed bug #47969 (ezmlm_hash() returns different values depend on OS).
(Ilia)
- Fixed bug #47946 (ImageConvolution overwrites background). (Ilia)
- Fixed bug #47940 (memory leaks in imap_body). (Pierre, Jake Levitt)
- Fixed bug #47937 (system() calls sapi_flush() regardless of output
buffering). (Ilia)
- Fixed bug #47903 ("@" operator does not work with string offsets). (Felipe)
- Fixed bug #47893 (CLI aborts on non blocking stdout). (Arnaud)
- Fixed bug #47849 (Non-deep import loses the namespace). (Rob)
- Fixed bug #47845 (PDO_Firebird omits first row from query). (Lars W)
- Fixed bug #47831 (Compile warning for strnlen() in main/spprintf.c).
(Ilia, rainer dot jung at kippdata dot de)
- Fixed bug #47828 (openssl_x509_parse() segfaults when a UTF-8 conversion
fails). (Scott, Kees Cook, Pierre)
- Fixed bug #47818 (Segfault due to bound callback param). (Felipe)
- Fixed bug #47801 (__call() accessed via parent:: operator is provided
incorrect method name). (Felipe)
- Fixed bug #47769 (Strange extends PDO). (Felipe)
- Fixed bug #47745 (FILTER_VALIDATE_INT doesn't allow minimum integer).
(Dmitry)
- Fixed bug #47721 (Alignment issues in mbstring and sysvshm extension)
(crrodriguez at opensuse dot org, Ilia)
- Fixed bug #47704 (PHP crashes on some "bad" operations with string offsets).
(Dmitry)
- Fixed bug #47695 (build error when xmlrpc and iconv are compiled
against different iconv versions). (Scott)
- Fixed bug #47667 (ZipArchive::OVERWRITE seems to have no effect).
(Mikko, Pierre)
- Fixed bug #47644 (Valid integers are truncated with json_decode()). (Scott)
- Fixed bug #47639 (pg_copy_from() WARNING: nonstandard use of \\ in a string
literal). (Ilia)
- Fixed bug #47616 (curl keeps crashing). (Felipe)
- Fixed bug #47598 (FILTER_VALIDATE_EMAIL is locale aware). (Ilia)
- Fixed bug #47566 (pcntl_wexitstatus() returns signed status).
(patch by james at jamesreno dot com)
- Fixed bug #47564 (unpacking unsigned long 32bit bit endian returns wrong
result). (Ilia)
- Fixed bug #47487 (performance degraded when reading large chunks after fix of
bug #44607). (Arnaud)
- Fixed bug #47468 (enable cli|cgi-only extensions for embed sapi). (Jani)
- Fixed bug #47365 (ip2long() may allow some invalid values on certain 64bit
systems). (Ilia)
- Fixed bug #47435 (FILTER_FLAG_NO_PRIV_RANGE does not work with ipv6
addresses in the filter extension). (Ilia)
- Fixed bug #47430 (Errors after writing to nodeValue parameter of an absent
previousSibling). (Rob)
- Fixed bug #47254 (Wrong Reflection for extends class). (Felipe)
- Fixed bug #46882 (Serialize / Unserialize misbehaviour under OS with
different bit numbers). (Matt)
- Fixed bug #46812 (get_class_vars() does not include visible private variable
looking at subclass). (Arnaud)
- Fixed bug #45997 (safe_mode bypass with exec/system/passthru (windows only)).
(Pierre)
- Fixed bug #45877 (Array key '2147483647' left as string). (Matt)
- Fixed bug #45822 (Near infinite-loops while parsing huge relative offsets).
(Derick, Mike Sullivan)
- Fixed bug #45799 (imagepng() crashes on empty image). (Martin McNickle,
Takeshi Abe)
- Fixed bug #45622 (isset($arrayObject->p) misbehaves with ArrayObject::
ARRAY_AS_PROPS set). (robin_fernandes at uk dot ibm dot com, Arnaud)
- Fixed bug #45614 (ArrayIterator::current(), ::key() can show 1st private
prop of wrapped object). (robin_fernandes at uk dot ibm dot com, Arnaud)
- Fixed bug #45540 (stream_context_create creates bad http request). (Arnaud)
- Fixed bug #45202 (zlib.output_compression can not be set with ini_set()).
(Jani)
- Fixed bug #45191 (error_log ignores date.timezone php.ini val when
setting logging timestamps). (Derick)
- Fixed bug #45092 (header HTTP context option not being used when compiled
using --with-curlwrappers). (Jani)
- Fixed bug #44996 (xmlrpc_decode() ignores time zone on iso8601.datetime).
(Ilia, kawai at apache dot org)
- Fixed bug #43073 (TrueType bounding box is wrong for angle<>0).
(Martin McNickle)
- Fixed bug #42663 (gzinflate() try to allocate all memory with truncated
data). (Arnaud)
- Fixed bug #42414 (some odbc_*() functions incompatible with Oracle ODBC
driver). (jhml at gmx dot net)
- Fixed bug #42362 (HTTP status codes 204 and 304 should not be gzipped).
(Scott, Edward Z. Yang)
- Fixed bug #38805 (PDO truncates text from SQL Server text data type
field). (Steph)
26 Feb 2009, PHP 5.2.9
- Changed __call() to be invoked on private/protected method access, similar to
properties and __get(). (Andrei)
@@ -467,6 +292,7 @@ PHP NEWS
(Kalle, oleg dot grenrus at dynamoid dot com)
- Fixed bug #45405 (snmp extension memory leak).
(Federico Cuello, Rodrigo Campos)
- Fixed bug #45392 (ob_start()/ob_end_clean() and memory_limit). (Arnaud)
- Fixed bug #45382 (timeout bug in stream_socket_enable_crypto). (Ilia)
- Fixed bug #45373 (php crash on query with errors in params). (Felipe)
- Fixed bug #45352 (Segmentation fault because of tick function on second
+4 -5
View File
@@ -32,12 +32,11 @@ sapi/cli/php [-c /path/to/php.ini] run-tests.php [ext/foo/tests/GLOB]
[Which "php" executable "make test" look for]
---------------------------------------------
If you are running the run-tests.php script from the command line (as above)
you must set the TEST_PHP_EXECUTABLE environment variable to explicitly
select the PHP executable that is to be tested, that is, used to run the test scripts.
You must use TEST_PHP_EXECUTABLE environment variable to explicitly
select the php executable to be used to run the tests. That can either
be the CLI or CGI executable.
If you run the tests using make test, the PHP CLI and CGI executables are
automatically set for you. "make test" executes "run-tests.php" script with the CLI binary. Some
"make test" executes "run-tests.php" script with "php" binary. Some
test scripts such as session must be executed by CGI SAPI. Therefore,
you must build PHP with CGI SAPI to perform all tests.
-82
View File
@@ -1,82 +0,0 @@
--TEST--
Bug #39018 (Error control operator '@' fails to suppress "Uninitialized string offset")
--FILE--
<?php
error_reporting(E_ALL);
$a = 'foo';
$a[11111111111];
$a = '';
$a[0];
print $a[0]; // 12
$a[-11111111111111111111111];
print $a[-11111111111111111111111]; // 16
$a[-0];
$x = 'test';
@$x[4];
@$y = $x[4];
@('a' == $x[4]);
$x[4] == 'a'; // 28
@$x[4] == 'a';
(@$x[4]) == 'a';
($x[4]) == 'a'; // 34
(@($x[4])) == 'a';
(($x[4])) == 'a'; // 38
@($x[4]) == 'a';
($x[4]) == 'a'; // 42
@($x[4] == 'a');
($x[4] == 'a'); // 46
$y = 'foobar';
$y[12.2];
print $y[12.2]; // 52
$y[3.5];
print $y[3.5]; // 56
print "\nDone\n";
?>
--EXPECTF--
Notice: Uninitialized string offset: 0 in %s on line 12
Notice: Uninitialized string offset: -%d in %s on line 16
Notice: Uninitialized string offset: 4 in %s on line 28
Notice: Uninitialized string offset: 4 in %s on line 34
Notice: Uninitialized string offset: 4 in %s on line 38
Notice: Uninitialized string offset: 4 in %s on line 42
Notice: Uninitialized string offset: 4 in %s on line 46
Notice: Uninitialized string offset: 12 in %s on line 52
b
Done
-18
View File
@@ -1,18 +0,0 @@
--TEST--
Bug #39018 [2] (Error control operator '@' fails to suppress "Uninitialized string offset")
--FILE--
<?php
error_reporting(E_ALL);
$foo = 'test';
$x = @$foo[6];
print @($foo[100] + $foo[130]);
print "\nDone\n";
?>
--EXPECT--
0
Done
+1 -3
View File
@@ -6,6 +6,4 @@ Bug #39304 (Segmentation fault with list unpacking of string offset)
list($a, $b) = $s[0];
?>
--EXPECTF--
Notice: Uninitialized string offset: 0 in %s on line %d
Fatal error: Cannot use string offset as an array in %sbug39304.php on line %d
Fatal error: Cannot use string offset as an array in %sbug39304.php on line 3
-2
View File
@@ -8,6 +8,4 @@ $foo[3]->bar[1] = "bang";
echo "ok\n";
?>
--EXPECTF--
Notice: Uninitialized string offset: 3 in %s on line %d
Fatal error: Cannot use string offset as an object in %sbug41919.php on line %d
-38
View File
@@ -1,38 +0,0 @@
--TEST--
bug #42143 (The constant NAN is reported as 0 on Windows build)
--CREDITS--
Venkat Raman Don
--FILE--
<?php
echo "Testing NAN:\n";
echo "NAN= ";
var_dump(NAN);
var_dump(tan(-1) == 123);
var_dump(cos(-100) == "PHP String");
var_dump(deg2rad(-5.6) == null);
var_dump(sqrt(-0.1) == false);
var_dump(sqrt(cos(M_PI)) == 0.1);
var_dump(NAN);
var_dump(is_nan(sqrt(-1.005)) == false);
var_dump(is_nan(floor(1)) == true);
var_dump(log10(-1) == log(-1));
var_dump(log10(-1) != log10(-1));
var_dump(is_finite(log10(-1)) == false);
var_dump(NAN == NAN);
?>
--EXPECT--
Testing NAN:
NAN= float(NAN)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
float(NAN)
bool(false)
bool(false)
bool(false)
bool(true)
bool(true)
bool(false)
-23
View File
@@ -1,23 +0,0 @@
--TEST--
Bug #45877 (Array key '2147483647' left as string)
--INI--
precision=20
--FILE--
<?php
$keys = array(PHP_INT_MAX,
(string) PHP_INT_MAX,
(string) (-PHP_INT_MAX - 1),
-PHP_INT_MAX - 1,
(string) (PHP_INT_MAX + 1));
var_dump(array_fill_keys($keys, 1));
?>
--EXPECTF--
array(3) {
[%d7]=>
int(1)
[-%d8]=>
int(1)
["%d8"]=>
int(1)
}
-9
View File
@@ -1,9 +0,0 @@
--TEST--
Bug #47704 (crashes on some "bad" operations with string offsets)
--FILE--
<?php
$s = "abd";
$s[0]->a += 1;
?>
--EXPECTF--
Fatal error: Cannot use string offset as an object in %sbug47704.php on line %d
-31
View File
@@ -1,31 +0,0 @@
--TEST--
Bug #47801 (__call() accessed via parent:: operator is provided incorrect method name)
--FILE--
<?php
class A
{
function __call($name, $args)
{
echo("magic method called: $name\n");
}
}
class B extends A
{
function getFoo()
{
parent::getFoo();
}
}
$a = new A();
$a->getFoo();
$b = new B();
$b->getFoo();
?>
--EXPECT--
magic method called: getFoo
magic method called: getFoo
-16
View File
@@ -1,16 +0,0 @@
--TEST--
Bug #47836 (array operator [] inconsistency when the array has PHP_INT_MAX index value)
--FILE--
<?php
$arr[PHP_INT_MAX] = 1;
$arr[] = 2;
var_dump($arr);
?>
--EXPECTF--
Warning: Cannot add element to the array as the next element is already occupied in %s on line 4
array(1) {
[%d]=>
int(1)
}
-19
View File
@@ -1,19 +0,0 @@
--TEST--
Bug #47981 (error handler not called regardless)
--INI--
error_reporting=0
--FILE--
<?php
function errh($errno, $errstr) {
var_dump($errstr);
}
set_error_handler("errh");
interface a{}
class b implements a { function f($a=1) {}}
class c extends b {function f() {}}
?>
--EXPECTF--
string(62) "Declaration of c::f() should be compatible with that of b::f()"
-32
View File
@@ -1,32 +0,0 @@
--TEST--
Bug #48228 (crash when exception is thrown while passing function arguments)
--FILE--
<?php
function do_throw() {
throw new Exception();
}
class aa
{
function check()
{
}
function dosome()
{
$this->check(do_throw());
}
}
$l_aa=new aa();
$l_aa->dosome();
?>
--EXPECTF--
Fatal error: Uncaught exception 'Exception' in %s
Stack trace:
#0 %s(%d): do_throw()
#1 %s(%d): aa->dosome()
#2 {main}
thrown in %s
-27
View File
@@ -1,27 +0,0 @@
--TEST--
Bug #48248 (SIGSEGV when access to private property via &__get)
--FILE--
<?php
class A
{
public function & __get($name)
{
return $this->test;
}
}
class B extends A
{
private $test;
}
$b = new B;
var_dump($b->test);
?>
--EXPECTF--
Notice: Undefined property: B::$test in %s on line %d
Notice: Only variable references should be returned by reference in %s on line %d
NULL
-30
View File
@@ -1,30 +0,0 @@
--TEST--
Bug #48408 (crash when exception is thrown while passing function arguments)
--FILE--
<?php
class B{
public function process($x){
return $x;
}
}
class C{
public function generate($x){
throw new Exception;
}
}
$b = new B;
$c = new C;
try{
$b->process($c->generate(0));
}
catch(Exception $e){
$c->generate(0);
}
?>
--EXPECTF--
Fatal error: Uncaught exception 'Exception' in %s
Stack trace:
#0 %s(%d): C->generate(0)
#1 {main}
thrown in %s
-67
View File
@@ -1,67 +0,0 @@
--TEST--
Bug #48409 (crash when exception is thrown while passing function arguments)
--FILE--
<?php
class ABCException extends Exception {}
class BBB
{
public function xyz($d, $x)
{
if ($x == 34) {
throw new ABCException;
}
return array('foo' => 'xyz');
}
}
class CCC
{
public function process($p)
{
return $p;
}
}
class AAA
{
public function func()
{
$b = new BBB;
$c = new CCC;
$i = 34;
$item = array('foo' => 'bar');
try {
$c->process($b->xyz($item['foo'], $i));
}
catch(ABCException $e) {
$b->xyz($item['foo'], $i);
}
} // end func();
}
class Runner
{
public function run($x)
{
try {
$x->func();
}
catch(ABCException $e) {
throw new Exception;
}
}
}
try {
$runner = new Runner;
$runner->run(new AAA);
}
catch(Exception $e) {
die('Exception thrown');
}
?>
--EXPECT--
Exception thrown
-13
View File
@@ -1,13 +0,0 @@
--TEST--
Bug #48428 (crash when exception is thrown while passing function arguments)
--FILE--
<?php
try {
function x() { throw new Exception("ERROR"); }
x(x());
} catch(Exception $e) {
echo($e -> getMessage());
}
?>
--EXPECT--
ERROR
-30
View File
@@ -1,30 +0,0 @@
--TEST--
Testing Exception's methods
--FILE--
<?php
$x = new Exception;
$x->gettraceasstring(1);
$x->gettraceasstring();
$x->__tostring(1);
$x->gettrace(1);
$x->getline(1);
$x->getfile(1);
$x->getmessage(1);
$x->getcode(1);
?>
--EXPECTF--
Warning: Wrong parameter count for Exception::getTraceAsString() in %s on line %d
Warning: Wrong parameter count for Exception::__toString() in %s on line %d
Warning: Wrong parameter count for Exception::getTrace() in %s on line %d
Warning: Wrong parameter count for Exception::getLine() in %s on line %d
Warning: Wrong parameter count for Exception::getFile() in %s on line %d
Warning: Wrong parameter count for Exception::getMessage() in %s on line %d
Warning: Wrong parameter count for Exception::getCode() in %s on line %d
+1 -3
View File
@@ -33,7 +33,7 @@ new C;
?>
--EXPECT--
array(6) {
array(5) {
["aaa"]=>
int(7)
["ccc"]=>
@@ -42,8 +42,6 @@ array(6) {
int(1)
["aa"]=>
int(4)
["bb"]=>
int(5)
["cc"]=>
int(6)
}
+1 -3
View File
@@ -44,7 +44,5 @@ array(1) {
["a"]=>
int(1)
}
array(1) {
["a"]=>
int(1)
array(0) {
}
+1 -1
View File
@@ -835,7 +835,7 @@ void zend_deactivate_modules(TSRMLS_D)
EG(opline_ptr) = NULL; /* we're no longer executing anything */
zend_try {
zend_hash_reverse_apply(&module_registry, (apply_func_t) module_registry_cleanup TSRMLS_CC);
zend_hash_apply(&module_registry, (apply_func_t) module_registry_cleanup TSRMLS_CC);
} zend_end_try();
}
+1 -19
View File
@@ -178,12 +178,6 @@ char *alloca ();
#endif
#if defined(__GNUC__) && ZEND_GCC_VERSION >= 3400
#else
# define __restrict__
#endif
#define restrict __restrict__
#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(ZEND_WIN32)) && !(defined(ZTS) && defined(NETWARE)) && !(defined(ZTS) && defined(HPUX)) && !defined(DARWIN)
# define do_alloca(p) alloca(p)
# define free_alloca(p)
@@ -255,18 +249,6 @@ char *alloca ();
#define LONG_MIN (- LONG_MAX - 1)
#endif
#if SIZEOF_LONG == 4
#define MAX_LENGTH_OF_LONG 11
static const char long_min_digits[] = "2147483648";
#elif SIZEOF_LONG == 8
#define MAX_LENGTH_OF_LONG 20
static const char long_min_digits[] = "9223372036854775808";
#else
#error "Unknown SIZEOF_LONG"
#endif
#define MAX_LENGTH_OF_DOUBLE 32
#undef SUCCESS
#undef FAILURE
#define SUCCESS 0
@@ -280,7 +262,7 @@ static const char long_min_digits[] = "9223372036854775808";
#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, zval **return_value_ptr, zval *this_ptr, int return_value_used TSRMLS_DC
#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, return_value_ptr, this_ptr, return_value_used TSRMLS_CC
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX) && !defined(__osf__) && __GNUC__ >= 3
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX) && !defined(__osf__)
# define ZEND_VM_ALWAYS_INLINE __attribute__ ((always_inline))
void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((noreturn));
#else
+1
View File
@@ -1782,6 +1782,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
fname_len = strlen(ptr->fname);
lowercase_name = zend_str_tolower_dup(ptr->fname, fname_len);
if (zend_hash_exists(target_function_table, lowercase_name, fname_len+1)) {
efree(lowercase_name);
zend_error(error_type, "Function registration failed - duplicate name - %s%s%s", scope ? scope->name : "", scope ? "::" : "", ptr->fname);
}
efree(lowercase_name);
+1 -10
View File
@@ -148,12 +148,7 @@ static zend_mm_segment* zend_mm_mem_mmap_realloc(zend_mm_storage *storage, zend_
{
zend_mm_segment *ret;
#ifdef HAVE_MREMAP
#if defined(__NetBSD__)
/* NetBSD 5 supports mremap but takes an extra newp argument */
ret = (zend_mm_segment*)mremap(segment, segment->size, segment, size, MREMAP_MAYMOVE);
#else
ret = (zend_mm_segment*)mremap(segment, segment->size, size, MREMAP_MAYMOVE);
#endif
if (ret == MAP_FAILED) {
#endif
ret = storage->handlers->_alloc(storage, size);
@@ -2477,11 +2472,7 @@ ZEND_API size_t zend_memory_usage(int real_usage TSRMLS_DC)
if (real_usage) {
return AG(mm_heap)->real_size;
} else {
size_t usage = AG(mm_heap)->size;
#if ZEND_MM_CACHE
usage -= AG(mm_heap)->cached;
#endif
return usage;
return AG(mm_heap)->size;
}
}
+13 -38
View File
@@ -461,7 +461,6 @@ ZEND_FUNCTION(define)
zend_bool non_cs = 0;
int case_sensitive = CONST_CS;
zend_constant c;
char *p;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|b", &name, &name_len, &val, &non_cs) == FAILURE) {
return;
@@ -471,34 +470,6 @@ ZEND_FUNCTION(define)
case_sensitive = 0;
}
/* class constant, check if there is name and make sure class is valid & exists */
if ((p = zend_memnstr(name, "::", sizeof("::") - 1, name + name_len))) {
char *class_name;
int found;
zend_class_entry **ce;
ALLOCA_FLAG(use_heap)
if (p == (name + name_len - sizeof("::") + 1)) {
zend_error(E_WARNING, "Class constant must have a name");
RETURN_FALSE;
} else if (p == name) {
zend_error(E_WARNING, "Missing class name");
RETURN_FALSE;
}
class_name = do_alloca_with_limit((p - name + 1), use_heap);
zend_str_tolower_copy(class_name, name, (p - name));
found = zend_hash_find(EG(class_table), class_name, p - name + 1, (void **) &ce);
if (found != SUCCESS) {
zend_error(E_WARNING, "Class '%s' does not exist", class_name);
free_alloca_with_limit(class_name, use_heap);
RETURN_FALSE;
}
free_alloca_with_limit(class_name, use_heap);
}
repeat:
switch (Z_TYPE_P(val)) {
case IS_LONG:
@@ -735,22 +706,27 @@ static void add_class_vars(zend_class_entry *ce, HashTable *properties, zval *re
while (zend_hash_get_current_data_ex(properties, (void **) &prop, &pos) == SUCCESS) {
char *key, *class_name, *prop_name;
uint key_len;
ulong num_index;
ulong num_index, h;
int prop_name_len = 0;
zval *prop_copy;
zend_property_info *property_info;
zval zprop_name;
zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos);
zend_hash_move_forward_ex(properties, &pos);
zend_unmangle_property_name(key, key_len-1, &class_name, &prop_name);
prop_name_len = strlen(prop_name);
ZVAL_STRINGL(&zprop_name, prop_name, prop_name_len, 0);
property_info = zend_get_property_info(ce, &zprop_name, 1 TSRMLS_CC);
if (!property_info || property_info == &EG(std_property_info)) {
h = zend_get_hash_value(prop_name, prop_name_len+1);
if (zend_hash_quick_find(&ce->properties_info, prop_name, prop_name_len+1, h, (void **) &property_info) == FAILURE) {
continue;
}
if (property_info->flags & ZEND_ACC_SHADOW) {
continue;
} else if ((property_info->flags & ZEND_ACC_PRIVATE) && EG(scope) != ce) {
continue;
} else if ((property_info->flags & ZEND_ACC_PROTECTED) && zend_check_protected(ce, EG(scope)) == 0) {
continue;
}
@@ -1641,8 +1617,7 @@ ZEND_FUNCTION(get_defined_constants)
module_names[0] = "internal";
zend_hash_internal_pointer_reset_ex(&module_registry, &pos);
while (zend_hash_get_current_data_ex(&module_registry, (void *) &module, &pos) != FAILURE) {
module_names[module->module_number] = module->name;
i++;
module_names[i++] = module->name;
zend_hash_move_forward_ex(&module_registry, &pos);
}
module_names[i] = "user";
+7 -2
View File
@@ -1536,8 +1536,11 @@ void zend_do_begin_class_member_function_call(znode *class_name, znode *method_n
memcmp(lcname, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == 0) {
zval_dtor(&opline->op2.u.constant);
SET_UNUSED(opline->op2);
efree(lcname);
} else {
efree(opline->op2.u.constant.value.str.val);
opline->op2.u.constant.value.str.val = lcname;
}
efree(lcname);
}
zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *));
@@ -2135,7 +2138,7 @@ static zend_bool do_inherit_method_check(HashTable *child_function_table, zend_f
if (!zend_do_perform_implementation_check(child, child->common.prototype)) {
zend_error(E_COMPILE_ERROR, "Declaration of %s::%s() must be compatible with that of %s::%s()", ZEND_FN_SCOPE_NAME(child), child->common.function_name, ZEND_FN_SCOPE_NAME(child->common.prototype), child->common.prototype->common.function_name);
}
} else if (EG(error_reporting) & E_STRICT || EG(user_error_handler)) { /* Check E_STRICT (or custom error handler) before the check so that we save some time */
} else if (EG(error_reporting) & E_STRICT) { /* Check E_STRICT before the check so that we save some time */
if (!zend_do_perform_implementation_check(child, parent)) {
zend_error(E_STRICT, "Declaration of %s::%s() should be compatible with that of %s::%s()", ZEND_FN_SCOPE_NAME(child), child->common.function_name, ZEND_FN_SCOPE_NAME(parent), parent->common.function_name);
}
@@ -4192,6 +4195,8 @@ again:
case T_END_HEREDOC:
efree(Z_STRVAL(zendlval->u.constant));
break;
case EOF:
return EOF;
}
INIT_PZVAL(&zendlval->u.constant);
+1 -8
View File
@@ -428,14 +428,9 @@ static int _build_trace_string(zval **frame, int num_args, va_list args, zend_ha
ZEND_METHOD(exception, getTraceAsString)
{
zval *trace;
char *res, **str, *s_tmp;
char *res = estrdup(""), **str = &res, *s_tmp;
int res_len = 0, *len = &res_len, num = 0;
DEFAULT_0_PARAMS;
res = estrdup("");
str = &res;
trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC);
zend_hash_apply_with_arguments(Z_ARRVAL_P(trace), (apply_func_args_t)_build_trace_string, 3, str, len, &num);
@@ -470,8 +465,6 @@ ZEND_METHOD(exception, __toString)
int len;
zend_fcall_info fci;
zval fname;
DEFAULT_0_PARAMS;
_default_exception_get_entry(getThis(), "message", sizeof("message")-1, &message TSRMLS_CC);
_default_exception_get_entry(getThis(), "file", sizeof("file")-1, &file TSRMLS_CC);
+1 -3
View File
@@ -183,6 +183,7 @@ static inline zval *_get_zval_ptr_var(znode *node, temp_variable *Ts, zend_free_
if (T->str_offset.str->type != IS_STRING
|| ((int)T->str_offset.offset < 0)
|| (T->str_offset.str->value.str.len <= (int)T->str_offset.offset)) {
zend_error(E_NOTICE, "Uninitialized string offset: %d", T->str_offset.offset);
ptr->value.str.val = STR_EMPTY_ALLOC();
ptr->value.str.len = 0;
} else {
@@ -1132,9 +1133,6 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container
break;
}
if (result) {
if (Z_LVAL_P(dim) < 0 || Z_STRLEN_P(container) <= Z_LVAL_P(dim)) {
zend_error(E_NOTICE, "Uninitialized string offset: %ld", Z_LVAL_P(dim));
}
container = *container_ptr;
result->str_offset.str = container;
PZVAL_LOCK(container);
-21
View File
@@ -169,27 +169,6 @@ static inline int zend_ptr_stack_get_arg(int requested_arg, void **data TSRMLS_D
return SUCCESS;
}
static inline void zend_arg_types_stack_2_pop(zend_ptr_stack *stack, zval **object, zend_function **fbc)
{
void *a, *b;
zend_ptr_stack_2_pop(stack, &a, &b);
*object = a;
*fbc = b;
}
static inline void zend_arg_types_stack_3_pop(zend_ptr_stack *stack, zend_class_entry **called_scope, zval **object, zend_function **fbc)
{
void *a, *b, *c;
zend_ptr_stack_3_pop(stack, &a, &b, &c);
*called_scope = a;
*object = b;
*fbc = c;
}
void execute_new_code(TSRMLS_D);
+4 -1
View File
@@ -835,8 +835,11 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
efree(function_name_lc);
}
} else if (calling_scope) {
EX(function_state).function = zend_std_get_static_method(calling_scope, fname, fname_len TSRMLS_CC);
char *function_name_lc = zend_str_tolower_dup(fname, fname_len);
EX(function_state).function =
zend_std_get_static_method(calling_scope, function_name_lc, fname_len TSRMLS_CC);
efree(function_name_lc);
if (check_scope_or_static && EX(function_state).function
&& !(EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC)
&& !instanceof_function(check_scope_or_static, calling_scope TSRMLS_CC)) {
+2 -2
View File
@@ -376,7 +376,7 @@ ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void
UPDATE_DATA(ht, p, pData, nDataSize);
HANDLE_UNBLOCK_INTERRUPTIONS();
if ((long)h >= (long)ht->nNextFreeElement) {
ht->nNextFreeElement = h < LONG_MAX ? h + 1 : LONG_MAX;
ht->nNextFreeElement = h + 1;
}
if (pDest) {
*pDest = p->pData;
@@ -404,7 +404,7 @@ ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void
HANDLE_UNBLOCK_INTERRUPTIONS();
if ((long)h >= (long)ht->nNextFreeElement) {
ht->nNextFreeElement = h < LONG_MAX ? h + 1 : LONG_MAX;
ht->nNextFreeElement = h + 1;
}
ht->nNumOfElements++;
ZEND_HASH_IF_FULL_DO_RESIZE(ht);
+35 -36
View File
@@ -298,41 +298,40 @@ END_EXTERN_C()
zend_hash_init(ht, n, NULL, ZVAL_PTR_DTOR, persistent)
#define HANDLE_NUMERIC(key, length, func) do { \
register const char *tmp = key; \
\
if (*tmp == '-') { \
tmp++; \
} \
if (*tmp >= '0' && *tmp <= '9') { /* possibly a numeric index */ \
const char *end = key + length - 1; \
long idx; \
\
if ((*end != '\0') /* not a null terminated string */ \
|| (*tmp == '0' && length > 2) /* numbers with leading zeros */ \
|| (end - tmp > MAX_LENGTH_OF_LONG - 1) /* number too long */ \
|| (SIZEOF_LONG == 4 && \
end - tmp == MAX_LENGTH_OF_LONG - 1 && \
*tmp > '2')) { /* overflow */ \
break; \
} \
idx = (*tmp - '0'); \
while (++tmp != end && *tmp >= '0' && *tmp <= '9') { \
idx = (idx * 10) + (*tmp - '0'); \
} \
if (tmp == end) { \
if (*key == '-') { \
idx = -idx; \
if (idx > 0) { /* overflow */ \
break; \
} \
} else if (idx < 0) { /* overflow */ \
break; \
} \
return func; \
} \
} \
} while (0)
#define HANDLE_NUMERIC(key, length, func) { \
register char *tmp=key; \
\
if (*tmp=='-') { \
tmp++; \
} \
if ((*tmp>='0' && *tmp<='9')) do { /* possibly a numeric index */ \
char *end=key+length-1; \
long idx; \
\
if (*tmp++=='0' && length>2) { /* don't accept numbers with leading zeros */ \
break; \
} \
while (tmp<end) { \
if (!(*tmp>='0' && *tmp<='9')) { \
break; \
} \
tmp++; \
} \
if (tmp==end && *tmp=='\0') { /* a numeric index */ \
if (*key=='-') { \
idx = strtol(key, NULL, 10); \
if (idx!=LONG_MIN) { \
return func; \
} \
} else { \
idx = strtol(key, NULL, 10); \
if (idx!=LONG_MAX) { \
return func; \
} \
} \
} \
} while (0); \
}
static inline int zend_symtable_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest) \
@@ -344,7 +343,7 @@ static inline int zend_symtable_update(HashTable *ht, char *arKey, uint nKeyLeng
static inline int zend_symtable_del(HashTable *ht, char *arKey, uint nKeyLength)
{
HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_del(ht, idx));
HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_del(ht, idx))
return zend_hash_del(ht, arKey, nKeyLength);
}
+23 -2
View File
@@ -148,11 +148,19 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
zend_printf("<span style=\"color: %s\">", last_color);
}
}
zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC);
switch (token_type) {
case T_END_HEREDOC:
zend_html_puts(token.value.str.val, token.value.str.len TSRMLS_CC);
break;
default:
zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC);
break;
}
if (token.type == IS_STRING) {
switch (token_type) {
case EOF:
goto done;
case T_OPEN_TAG:
case T_OPEN_TAG_WITH_ECHO:
case T_CLOSE_TAG:
@@ -170,6 +178,19 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
token.type = 0;
}
/* handler for trailing comments, see bug #42767 */
if (LANG_SCNG(yy_leng) && LANG_SCNG(_yy_more_len)) {
if (last_color != syntax_highlighter_ini->highlight_comment) {
if (last_color != syntax_highlighter_ini->highlight_html) {
zend_printf("</span>");
}
if (syntax_highlighter_ini->highlight_comment != syntax_highlighter_ini->highlight_html) {
zend_printf("<span style=\"color: %s\">", syntax_highlighter_ini->highlight_comment);
}
}
zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(_yy_more_len) TSRMLS_CC);
}
done:
if (last_color != syntax_highlighter_ini->highlight_html) {
zend_printf("</span>\n");
}
+1 -3
View File
@@ -2033,9 +2033,7 @@ wrong_label:
<ST_COMMENT,ST_DOC_COMMENT><<EOF>> {
zend_error(E_COMPILE_WARNING,"Unterminated comment starting line %d", CG(comment_start_line));
yyless(yyleng - 1);
BEGIN(ST_IN_SCRIPTING);
return T_COMMENT;
return 0;
}
+80 -80
View File
@@ -37,8 +37,8 @@ static zend_encoding* zend_multibyte_detect_utf_encoding(char *script, int scrip
/*
* encodings
*/
static const char *ucs2_aliases[] = {"ISO-10646-UCS-2", "UCS2" , "UNICODE", NULL};
static zend_encoding encoding_ucs2 = {
const char *ucs2_aliases[] = {"ISO-10646-UCS-2", "UCS2" , "UNICODE", NULL};
zend_encoding encoding_ucs2 = {
NULL,
NULL,
"UCS-2",
@@ -46,7 +46,7 @@ static zend_encoding encoding_ucs2 = {
0
};
static zend_encoding encoding_ucs2be = {
zend_encoding encoding_ucs2be = {
NULL,
NULL,
"UCS-2BE",
@@ -54,7 +54,7 @@ static zend_encoding encoding_ucs2be = {
0
};
static zend_encoding encoding_ucs2le = {
zend_encoding encoding_ucs2le = {
NULL,
NULL,
"UCS-2LE",
@@ -62,8 +62,8 @@ static zend_encoding encoding_ucs2le = {
0
};
static const char *ucs4_aliases[] = {"ISO-10646-UCS-4", "UCS4", NULL};
static zend_encoding encoding_ucs4 = {
const char *ucs4_aliases[] = {"ISO-10646-UCS-4", "UCS4", NULL};
zend_encoding encoding_ucs4 = {
NULL,
NULL,
"UCS-4",
@@ -71,7 +71,7 @@ static zend_encoding encoding_ucs4 = {
0
};
static zend_encoding encoding_ucs4be = {
zend_encoding encoding_ucs4be = {
NULL,
NULL,
"UCS-4BE",
@@ -79,7 +79,7 @@ static zend_encoding encoding_ucs4be = {
0
};
static zend_encoding encoding_ucs4le = {
zend_encoding encoding_ucs4le = {
NULL,
NULL,
"UCS-4LE",
@@ -87,8 +87,8 @@ static zend_encoding encoding_ucs4le = {
0
};
static const char *utf32_aliases[] = {"utf32", NULL};
static zend_encoding encoding_utf32 = {
const char *utf32_aliases[] = {"utf32", NULL};
zend_encoding encoding_utf32 = {
NULL,
NULL,
"UTF-32",
@@ -96,7 +96,7 @@ static zend_encoding encoding_utf32 = {
0
};
static zend_encoding encoding_utf32be = {
zend_encoding encoding_utf32be = {
NULL,
NULL,
"UTF-32BE",
@@ -104,7 +104,7 @@ static zend_encoding encoding_utf32be = {
0
};
static zend_encoding encoding_utf32le = {
zend_encoding encoding_utf32le = {
NULL,
NULL,
"UTF-32LE",
@@ -112,8 +112,8 @@ static zend_encoding encoding_utf32le = {
0
};
static const char *utf16_aliases[] = {"utf16", NULL};
static zend_encoding encoding_utf16 = {
const char *utf16_aliases[] = {"utf16", NULL};
zend_encoding encoding_utf16 = {
NULL,
NULL,
"UTF-16",
@@ -121,7 +121,7 @@ static zend_encoding encoding_utf16 = {
0
};
static zend_encoding encoding_utf16be = {
zend_encoding encoding_utf16be = {
NULL,
NULL,
"UTF-16BE",
@@ -129,7 +129,7 @@ static zend_encoding encoding_utf16be = {
0
};
static zend_encoding encoding_utf16le = {
zend_encoding encoding_utf16le = {
NULL,
NULL,
"UTF-16LE",
@@ -137,8 +137,8 @@ static zend_encoding encoding_utf16le = {
0
};
static const char *utf8_aliases[] = {"utf8", NULL};
static zend_encoding encoding_utf8 = {
const char *utf8_aliases[] = {"utf8", NULL};
zend_encoding encoding_utf8 = {
NULL,
NULL,
"UTF-8",
@@ -146,8 +146,8 @@ static zend_encoding encoding_utf8 = {
1
};
static const char *ascii_aliases[] = {"ANSI_X3.4-1968", "iso-ir-6", "ANSI_X3.4-1986", "ISO_646.irv:1991", "US-ASCII", "ISO646-US", "us", "IBM367", "cp367", "csASCII", NULL};
static zend_encoding encoding_ascii = {
const char *ascii_aliases[] = {"ANSI_X3.4-1968", "iso-ir-6", "ANSI_X3.4-1986", "ISO_646.irv:1991", "US-ASCII", "ISO646-US", "us", "IBM367", "cp367", "csASCII", NULL};
zend_encoding encoding_ascii = {
NULL,
NULL,
"ASCII",
@@ -155,8 +155,8 @@ static zend_encoding encoding_ascii = {
1
};
static const char *euc_jp_aliases[] = {"EUC", "EUC_JP", "eucJP", "x-euc-jp", NULL};
static zend_encoding encoding_euc_jp = {
const char *euc_jp_aliases[] = {"EUC", "EUC_JP", "eucJP", "x-euc-jp", NULL};
zend_encoding encoding_euc_jp = {
NULL,
NULL,
"EUC-JP",
@@ -164,8 +164,8 @@ static zend_encoding encoding_euc_jp = {
1
};
static const char *sjis_aliases[] = {"x-sjis", "SJIS", "SHIFT-JIS", NULL};
static zend_encoding encoding_sjis = {
const char *sjis_aliases[] = {"x-sjis", "SJIS", "SHIFT-JIS", NULL};
zend_encoding encoding_sjis = {
sjis_input_filter,
sjis_output_filter,
"Shift_JIS",
@@ -173,8 +173,8 @@ static zend_encoding encoding_sjis = {
0
};
static const char *eucjp_win_aliases[] = {"eucJP-open", NULL};
static zend_encoding encoding_eucjp_win = {
const char *eucjp_win_aliases[] = {"eucJP-open", NULL};
zend_encoding encoding_eucjp_win = {
NULL,
NULL,
"eucJP-win",
@@ -182,8 +182,8 @@ static zend_encoding encoding_eucjp_win = {
1
};
static const char *sjis_win_aliases[] = {"SJIS-open", "MS_Kanji", "Windows-31J", "CP932", NULL};
static zend_encoding encoding_sjis_win = {
const char *sjis_win_aliases[] = {"SJIS-open", "MS_Kanji", "Windows-31J", "CP932", NULL};
zend_encoding encoding_sjis_win = {
/* sjis-filters does not care about diffs of Shift_JIS and CP932 */
sjis_input_filter,
sjis_output_filter,
@@ -192,8 +192,8 @@ static zend_encoding encoding_sjis_win = {
0
};
static const char *jis_aliases[] = {"ISO-2022-JP", NULL};
static zend_encoding encoding_jis = {
const char *jis_aliases[] = {"ISO-2022-JP", NULL};
zend_encoding encoding_jis = {
NULL,
NULL,
"JIS",
@@ -201,8 +201,8 @@ static zend_encoding encoding_jis = {
0
};
static const char *euc_cn_aliases[] = {"CN-GB", "EUC_CN", "eucCN", "x-euc-cn", "gb2312", NULL};
static zend_encoding encoding_euc_cn = {
const char *euc_cn_aliases[] = {"CN-GB", "EUC_CN", "eucCN", "x-euc-cn", "gb2312", NULL};
zend_encoding encoding_euc_cn = {
NULL,
NULL,
"EUC-CN",
@@ -210,8 +210,8 @@ static zend_encoding encoding_euc_cn = {
1
};
static const char *cp936_aliases[] = {"CP-936", NULL};
static zend_encoding encoding_cp936 = {
const char *cp936_aliases[] = {"CP-936", NULL};
zend_encoding encoding_cp936 = {
NULL,
NULL,
"CP936",
@@ -219,8 +219,8 @@ static zend_encoding encoding_cp936 = {
0
};
static const char *hz_aliases[] = {"HZ-GB-2312", NULL};
static zend_encoding encoding_hz = {
const char *hz_aliases[] = {"HZ-GB-2312", NULL};
zend_encoding encoding_hz = {
NULL,
NULL,
"HZ",
@@ -228,8 +228,8 @@ static zend_encoding encoding_hz = {
0
};
static const char *euc_tw_aliases[] = {"EUC_TW", "eucTW", "x-euc-tw", NULL};
static zend_encoding encoding_euc_tw = {
const char *euc_tw_aliases[] = {"EUC_TW", "eucTW", "x-euc-tw", NULL};
zend_encoding encoding_euc_tw = {
NULL,
NULL,
"EUC-TW",
@@ -237,8 +237,8 @@ static zend_encoding encoding_euc_tw = {
1
};
static const char *big5_aliases[] = {"BIG5", "CN-BIG5", "BIG-FIVE", "BIGFIVE", "CP950", NULL};
static zend_encoding encoding_big5 = {
const char *big5_aliases[] = {"BIG5", "CN-BIG5", "BIG-FIVE", "BIGFIVE", "CP950", NULL};
zend_encoding encoding_big5 = {
NULL,
NULL,
"BIG-5",
@@ -246,8 +246,8 @@ static zend_encoding encoding_big5 = {
0
};
static const char *euc_kr_aliases[] = {"EUC_KR", "eucKR", "x-euc-kr", NULL};
static zend_encoding encoding_euc_kr = {
const char *euc_kr_aliases[] = {"EUC_KR", "eucKR", "x-euc-kr", NULL};
zend_encoding encoding_euc_kr = {
NULL,
NULL,
"EUC-KR",
@@ -255,8 +255,8 @@ static zend_encoding encoding_euc_kr = {
1
};
static const char *uhc_aliases[] = {"CP949", NULL};
static zend_encoding encoding_uhc = {
const char *uhc_aliases[] = {"CP949", NULL};
zend_encoding encoding_uhc = {
NULL,
NULL,
"UHC",
@@ -264,7 +264,7 @@ static zend_encoding encoding_uhc = {
1
};
static zend_encoding encoding_2022kr = {
zend_encoding encoding_2022kr = {
NULL,
NULL,
"ISO-2022-KR",
@@ -272,8 +272,8 @@ static zend_encoding encoding_2022kr = {
0
};
static const char *cp1252_aliases[] = {"cp1252", NULL};
static zend_encoding encoding_cp1252 = {
const char *cp1252_aliases[] = {"cp1252", NULL};
zend_encoding encoding_cp1252 = {
NULL,
NULL,
"Windows-1252",
@@ -281,8 +281,8 @@ static zend_encoding encoding_cp1252 = {
1
};
static const char *iso_8859_1_aliases[] = {"ISO_8859-1", "latin1", NULL};
static zend_encoding encoding_8859_1 = {
const char *iso_8859_1_aliases[] = {"ISO_8859-1", "latin1", NULL};
zend_encoding encoding_8859_1 = {
NULL,
NULL,
"ISO-8859-1",
@@ -290,8 +290,8 @@ static zend_encoding encoding_8859_1 = {
1
};
static const char *iso_8859_2_aliases[] = {"ISO_8859-2", "latin2", NULL};
static zend_encoding encoding_8859_2 = {
const char *iso_8859_2_aliases[] = {"ISO_8859-2", "latin2", NULL};
zend_encoding encoding_8859_2 = {
NULL,
NULL,
"ISO-8859-2",
@@ -299,8 +299,8 @@ static zend_encoding encoding_8859_2 = {
1
};
static const char *iso_8859_3_aliases[] = {"ISO_8859-3", "latin3", NULL};
static zend_encoding encoding_8859_3 = {
const char *iso_8859_3_aliases[] = {"ISO_8859-3", "latin3", NULL};
zend_encoding encoding_8859_3 = {
NULL,
NULL,
"ISO-8859-3",
@@ -308,8 +308,8 @@ static zend_encoding encoding_8859_3 = {
1
};
static const char *iso_8859_4_aliases[] = {"ISO_8859-4", "latin4", NULL};
static zend_encoding encoding_8859_4 = {
const char *iso_8859_4_aliases[] = {"ISO_8859-4", "latin4", NULL};
zend_encoding encoding_8859_4 = {
NULL,
NULL,
"ISO-8859-4",
@@ -317,8 +317,8 @@ static zend_encoding encoding_8859_4 = {
1
};
static const char *iso_8859_5_aliases[] = {"ISO_8859-5", "cyrillic", NULL};
static zend_encoding encoding_8859_5 = {
const char *iso_8859_5_aliases[] = {"ISO_8859-5", "cyrillic", NULL};
zend_encoding encoding_8859_5 = {
NULL,
NULL,
"ISO-8859-5",
@@ -326,8 +326,8 @@ static zend_encoding encoding_8859_5 = {
1
};
static const char *iso_8859_6_aliases[] = {"ISO_8859-6", "arabic", NULL};
static zend_encoding encoding_8859_6 = {
const char *iso_8859_6_aliases[] = {"ISO_8859-6", "arabic", NULL};
zend_encoding encoding_8859_6 = {
NULL,
NULL,
"ISO-8859-6",
@@ -335,8 +335,8 @@ static zend_encoding encoding_8859_6 = {
1
};
static const char *iso_8859_7_aliases[] = {"ISO_8859-7", "greek", NULL};
static zend_encoding encoding_8859_7 = {
const char *iso_8859_7_aliases[] = {"ISO_8859-7", "greek", NULL};
zend_encoding encoding_8859_7 = {
NULL,
NULL,
"ISO-8859-7",
@@ -344,8 +344,8 @@ static zend_encoding encoding_8859_7 = {
1
};
static const char *iso_8859_8_aliases[] = {"ISO_8859-8", "hebrew", NULL};
static zend_encoding encoding_8859_8 = {
const char *iso_8859_8_aliases[] = {"ISO_8859-8", "hebrew", NULL};
zend_encoding encoding_8859_8 = {
NULL,
NULL,
"ISO-8859-8",
@@ -353,8 +353,8 @@ static zend_encoding encoding_8859_8 = {
1
};
static const char *iso_8859_9_aliases[] = {"ISO_8859-9", "latin5", NULL};
static zend_encoding encoding_8859_9 = {
const char *iso_8859_9_aliases[] = {"ISO_8859-9", "latin5", NULL};
zend_encoding encoding_8859_9 = {
NULL,
NULL,
"ISO-8859-9",
@@ -362,8 +362,8 @@ static zend_encoding encoding_8859_9 = {
1
};
static const char *iso_8859_10_aliases[] = {"ISO_8859-10", "latin6", NULL};
static zend_encoding encoding_8859_10 = {
const char *iso_8859_10_aliases[] = {"ISO_8859-10", "latin6", NULL};
zend_encoding encoding_8859_10 = {
NULL,
NULL,
"ISO-8859-10",
@@ -371,8 +371,8 @@ static zend_encoding encoding_8859_10 = {
1
};
static const char *iso_8859_13_aliases[] = {"ISO_8859-13", NULL};
static zend_encoding encoding_8859_13 = {
const char *iso_8859_13_aliases[] = {"ISO_8859-13", NULL};
zend_encoding encoding_8859_13 = {
NULL,
NULL,
"ISO-8859-13",
@@ -380,8 +380,8 @@ static zend_encoding encoding_8859_13 = {
1
};
static const char *iso_8859_14_aliases[] = {"ISO_8859-14", "latin8", NULL};
static zend_encoding encoding_8859_14 = {
const char *iso_8859_14_aliases[] = {"ISO_8859-14", "latin8", NULL};
zend_encoding encoding_8859_14 = {
NULL,
NULL,
"ISO-8859-14",
@@ -389,8 +389,8 @@ static zend_encoding encoding_8859_14 = {
1
};
static const char *iso_8859_15_aliases[] = {"ISO_8859-15", NULL};
static zend_encoding encoding_8859_15 = {
const char *iso_8859_15_aliases[] = {"ISO_8859-15", NULL};
zend_encoding encoding_8859_15 = {
NULL,
NULL,
"ISO-8859-15",
@@ -398,8 +398,8 @@ static zend_encoding encoding_8859_15 = {
1
};
static const char *cp1251_aliases[] = {"CP1251", "CP-1251", "WINDOWS-1251", NULL};
static zend_encoding encoding_cp1251 = {
const char *cp1251_aliases[] = {"CP1251", "CP-1251", "WINDOWS-1251", NULL};
zend_encoding encoding_cp1251 = {
NULL,
NULL,
"Windows-1251",
@@ -407,8 +407,8 @@ static zend_encoding encoding_cp1251 = {
1
};
static const char *cp866_aliases[] = {"CP866", "CP-866", "IBM-866", NULL};
static zend_encoding encoding_cp866 = {
const char *cp866_aliases[] = {"CP866", "CP-866", "IBM-866", NULL};
zend_encoding encoding_cp866 = {
NULL,
NULL,
"CP866",
@@ -416,8 +416,8 @@ static zend_encoding encoding_cp866 = {
1
};
static const char *koi8r_aliases[] = {"KOI8-R", "KOI8R", NULL};
static zend_encoding encoding_koi8r = {
const char *koi8r_aliases[] = {"KOI8-R", "KOI8R", NULL};
zend_encoding encoding_koi8r = {
NULL,
NULL,
"KOI8-R",
@@ -425,7 +425,7 @@ static zend_encoding encoding_koi8r = {
1
};
static zend_encoding *zend_encoding_table[] = {
zend_encoding *zend_encoding_table[] = {
&encoding_ucs4,
&encoding_ucs4be,
&encoding_ucs4le,
+4 -11
View File
@@ -564,8 +564,8 @@ static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC
zend_guard *guard;
if (!zobj->ce->__get ||
zend_get_property_guard(zobj, property_info, member, &guard) != SUCCESS ||
(property_info && guard->in_get)) {
zend_get_property_guard(zobj, property_info, member, &guard) != SUCCESS ||
guard->in_get) {
/* we don't have access controls - will just add it */
new_zval = &EG(uninitialized_zval);
@@ -856,14 +856,9 @@ static union _zend_function *zend_std_get_method(zval **object_ptr, char *method
/* This is not (yet?) in the API, but it belongs in the built-in objects callbacks */
ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC)
{
char *lc_function_name;
zend_function *fbc;
lc_function_name = zend_str_tolower_dup(function_name_strval, function_name_strlen);
if (zend_hash_find(&ce->function_table, lc_function_name, function_name_strlen+1, (void **) &fbc)==FAILURE) {
efree(lc_function_name);
zend_function *fbc;
if (zend_hash_find(&ce->function_table, function_name_strval, function_name_strlen+1, (void **) &fbc)==FAILURE) {
if (ce->__call &&
EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
@@ -891,8 +886,6 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, char *f
zend_error(E_ERROR, "Call to undefined method %s::%s()", class_name, function_name_strval);
}
}
efree(lc_function_name);
if (fbc->op_array.fn_flags & ZEND_ACC_PUBLIC) {
/* No further checks necessary, most common case */
} else if (fbc->op_array.fn_flags & ZEND_ACC_PRIVATE) {
+12
View File
@@ -36,6 +36,18 @@
#include "ext/bcmath/libbcmath/src/bcmath.h"
#endif
#if SIZEOF_LONG == 4
#define MAX_LENGTH_OF_LONG 11
static const char long_min_digits[] = "2147483648";
#elif SIZEOF_LONG == 8
#define MAX_LENGTH_OF_LONG 20
static const char long_min_digits[] = "9223372036854775808";
#else
#error "Unknown SIZEOF_LONG"
#endif
#define MAX_LENGTH_OF_DOUBLE 32
BEGIN_EXTERN_C()
ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
+20 -20
View File
@@ -26,7 +26,8 @@
#include "zend_constants.h"
#include "zend_list.h"
ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC) /* {{{ */
ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC)
{
switch (zvalue->type & ~IS_CONSTANT_INDEX) {
case IS_STRING:
@@ -68,9 +69,9 @@ ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC) /* {{{ */
break;
}
}
/* }}} */
ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC) /* {{{ */
ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC)
{
switch (zvalue->type & ~IS_CONSTANT_INDEX) {
case IS_STRING:
@@ -92,15 +93,15 @@ ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC) /* {{{ */
break;
}
}
/* }}} */
ZEND_API void zval_add_ref(zval **p) /* {{{ */
ZEND_API void zval_add_ref(zval **p)
{
(*p)->refcount++;
}
/* }}} */
ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC) /* {{{ */
ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC)
{
switch (zvalue->type) {
case IS_RESOURCE: {
@@ -142,44 +143,43 @@ ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC) /* {{{ */
break;
}
}
/* }}} */
ZEND_API int zend_print_variable(zval *var) /* {{{ */
ZEND_API int zend_print_variable(zval *var)
{
return zend_print_zval(var, 0);
}
/* }}} */
#if ZEND_DEBUG
ZEND_API void _zval_copy_ctor_wrapper(zval *zvalue) /* {{{ */
ZEND_API void _zval_copy_ctor_wrapper(zval *zvalue)
{
zval_copy_ctor(zvalue);
}
/* }}} */
ZEND_API void _zval_dtor_wrapper(zval *zvalue) /* {{{ */
ZEND_API void _zval_dtor_wrapper(zval *zvalue)
{
zval_dtor(zvalue);
}
/* }}} */
ZEND_API void _zval_internal_dtor_wrapper(zval *zvalue) /* {{{ */
ZEND_API void _zval_internal_dtor_wrapper(zval *zvalue)
{
zval_internal_dtor(zvalue);
}
/* }}} */
ZEND_API void _zval_ptr_dtor_wrapper(zval **zval_ptr) /* {{{ */
ZEND_API void _zval_ptr_dtor_wrapper(zval **zval_ptr)
{
zval_ptr_dtor(zval_ptr);
}
/* }}} */
ZEND_API void _zval_internal_ptr_dtor_wrapper(zval **zval_ptr) /* {{{ */
ZEND_API void _zval_internal_ptr_dtor_wrapper(zval **zval_ptr)
{
zval_internal_ptr_dtor(zval_ptr);
}
/* }}} */
#endif
/*
+8 -8
View File
@@ -29,20 +29,20 @@ ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC);
static inline void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC)
{
if (zvalue->type <= IS_BOOL) {
return;
}
_zval_dtor_func(zvalue ZEND_FILE_LINE_RELAY_CC);
if (zvalue->type <= IS_BOOL) {
return;
}
_zval_dtor_func(zvalue ZEND_FILE_LINE_CC);
}
ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC);
static inline void _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC)
{
if (zvalue->type <= IS_BOOL) {
return;
}
_zval_copy_ctor_func(zvalue ZEND_FILE_LINE_RELAY_CC);
if (zvalue->type <= IS_BOOL) {
return;
}
_zval_copy_ctor_func(zvalue ZEND_FILE_LINE_CC);
}
+7 -21
View File
@@ -294,10 +294,6 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR
zval **retval = &EX_T(result->u.var).var.ptr;
int have_get_ptr = 0;
if (OP1_TYPE == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
EX_T(result->u.var).var.ptr_ptr = NULL;
make_real_object(object_ptr TSRMLS_CC);
object = *object_ptr;
@@ -549,10 +545,6 @@ ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR|
zval **retval = &EX_T(opline->result.u.var).var.ptr;
int have_get_ptr = 0;
if (OP1_TYPE == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -645,10 +637,6 @@ ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR
zval *retval = &EX_T(opline->result.u.var).tmp_var;
int have_get_ptr = 0;
if (OP1_TYPE == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -1795,7 +1783,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, ANY, CONST|TMP|VAR|UNUSED|CV)
ce = EX_T(opline->op1.u.var).class_entry;
if(OP2_TYPE != IS_UNUSED) {
char *function_name_strval = NULL;
char *function_name_strval;
int function_name_strlen;
zend_bool is_const = (OP2_TYPE == IS_CONST);
zend_free_op free_op2;
@@ -1808,17 +1796,15 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, ANY, CONST|TMP|VAR|UNUSED|CV)
if (Z_TYPE_P(function_name) != IS_STRING) {
zend_error_noreturn(E_ERROR, "Function name must be a string");
} else {
function_name_strval = Z_STRVAL_P(function_name);
function_name_strlen = Z_STRLEN_P(function_name);
}
function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len);
function_name_strlen = function_name->value.str.len;
}
if (function_name_strval) {
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
}
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
if (!is_const) {
efree(function_name_strval);
FREE_OP2();
}
} else {
@@ -2084,7 +2070,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
EG(This) = current_this;
EG(scope) = current_scope;
}
zend_arg_types_stack_2_pop(&EG(arg_types_stack), &EX(object), &EX(fbc));
zend_ptr_stack_2_pop(&EG(arg_types_stack), (void**)&EX(object), (void**)&EX(fbc));
zend_ptr_stack_clear_multiple(TSRMLS_C);
@@ -3856,7 +3842,7 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
}
zval_ptr_dtor(&EX(object));
}
zend_arg_types_stack_2_pop(&EG(arg_types_stack), &EX(object), &EX(fbc));
zend_ptr_stack_2_pop(&EG(arg_types_stack), (void**)&EX(object), (void**)&EX(fbc));
}
for (i=0; i<EX(op_array)->last_brk_cont; i++) {
+27 -193
View File
@@ -302,7 +302,7 @@ static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
EG(This) = current_this;
EG(scope) = current_scope;
}
zend_arg_types_stack_2_pop(&EG(arg_types_stack), &EX(object), &EX(fbc));
zend_ptr_stack_2_pop(&EG(arg_types_stack), (void**)&EX(object), (void**)&EX(fbc));
zend_ptr_stack_clear_multiple(TSRMLS_C);
@@ -562,7 +562,7 @@ static int ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
zval_ptr_dtor(&EX(object));
}
zend_arg_types_stack_2_pop(&EG(arg_types_stack), &EX(object), &EX(fbc));
zend_ptr_stack_2_pop(&EG(arg_types_stack), (void**)&EX(object), (void**)&EX(fbc));
}
for (i=0; i<EX(op_array)->last_brk_cont; i++) {
@@ -667,7 +667,7 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
ce = EX_T(opline->op1.u.var).class_entry;
if(IS_CONST != IS_UNUSED) {
char *function_name_strval = NULL;
char *function_name_strval;
int function_name_strlen;
zend_bool is_const = (IS_CONST == IS_CONST);
@@ -680,17 +680,15 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
if (Z_TYPE_P(function_name) != IS_STRING) {
zend_error_noreturn(E_ERROR, "Function name must be a string");
} else {
function_name_strval = Z_STRVAL_P(function_name);
function_name_strlen = Z_STRLEN_P(function_name);
}
function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len);
function_name_strlen = function_name->value.str.len;
}
if (function_name_strval) {
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
}
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
if (!is_const) {
efree(function_name_strval);
}
} else {
@@ -880,7 +878,7 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
ce = EX_T(opline->op1.u.var).class_entry;
if(IS_TMP_VAR != IS_UNUSED) {
char *function_name_strval = NULL;
char *function_name_strval;
int function_name_strlen;
zend_bool is_const = (IS_TMP_VAR == IS_CONST);
zend_free_op free_op2;
@@ -893,17 +891,15 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
if (Z_TYPE_P(function_name) != IS_STRING) {
zend_error_noreturn(E_ERROR, "Function name must be a string");
} else {
function_name_strval = Z_STRVAL_P(function_name);
function_name_strlen = Z_STRLEN_P(function_name);
}
function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len);
function_name_strlen = function_name->value.str.len;
}
if (function_name_strval) {
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
}
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
if (!is_const) {
efree(function_name_strval);
zval_dtor(free_op2.var);
}
} else {
@@ -1053,7 +1049,7 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
ce = EX_T(opline->op1.u.var).class_entry;
if(IS_VAR != IS_UNUSED) {
char *function_name_strval = NULL;
char *function_name_strval;
int function_name_strlen;
zend_bool is_const = (IS_VAR == IS_CONST);
zend_free_op free_op2;
@@ -1066,17 +1062,15 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
if (Z_TYPE_P(function_name) != IS_STRING) {
zend_error_noreturn(E_ERROR, "Function name must be a string");
} else {
function_name_strval = Z_STRVAL_P(function_name);
function_name_strlen = Z_STRLEN_P(function_name);
}
function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len);
function_name_strlen = function_name->value.str.len;
}
if (function_name_strval) {
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
}
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
if (!is_const) {
efree(function_name_strval);
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
}
} else {
@@ -1225,7 +1219,7 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_
ce = EX_T(opline->op1.u.var).class_entry;
if(IS_UNUSED != IS_UNUSED) {
char *function_name_strval = NULL;
char *function_name_strval;
int function_name_strlen;
zend_bool is_const = (IS_UNUSED == IS_CONST);
@@ -1238,17 +1232,15 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_
if (Z_TYPE_P(function_name) != IS_STRING) {
zend_error_noreturn(E_ERROR, "Function name must be a string");
} else {
function_name_strval = Z_STRVAL_P(function_name);
function_name_strlen = Z_STRLEN_P(function_name);
}
function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len);
function_name_strlen = function_name->value.str.len;
}
if (function_name_strval) {
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
}
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
if (!is_const) {
efree(function_name_strval);
}
} else {
@@ -1330,7 +1322,7 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
ce = EX_T(opline->op1.u.var).class_entry;
if(IS_CV != IS_UNUSED) {
char *function_name_strval = NULL;
char *function_name_strval;
int function_name_strlen;
zend_bool is_const = (IS_CV == IS_CONST);
@@ -1343,17 +1335,15 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
if (Z_TYPE_P(function_name) != IS_STRING) {
zend_error_noreturn(E_ERROR, "Function name must be a string");
} else {
function_name_strval = Z_STRVAL_P(function_name);
function_name_strlen = Z_STRLEN_P(function_name);
}
function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len);
function_name_strlen = function_name->value.str.len;
}
if (function_name_strval) {
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
}
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
if (!is_const) {
efree(function_name_strval);
}
} else {
@@ -8563,10 +8553,6 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*binary_op)(zval
zval **retval = &EX_T(result->u.var).var.ptr;
int have_get_ptr = 0;
if (IS_VAR == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
EX_T(result->u.var).var.ptr_ptr = NULL;
make_real_object(object_ptr TSRMLS_CC);
object = *object_ptr;
@@ -8817,10 +8803,6 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t incdec_op, ZE
zval **retval = &EX_T(opline->result.u.var).var.ptr;
int have_get_ptr = 0;
if (IS_VAR == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -8913,10 +8895,6 @@ static int zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_t incdec_op, Z
zval *retval = &EX_T(opline->result.u.var).tmp_var;
int have_get_ptr = 0;
if (IS_VAR == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -10092,10 +10070,6 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*binary_op)(zval *
zval **retval = &EX_T(result->u.var).var.ptr;
int have_get_ptr = 0;
if (IS_VAR == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
EX_T(result->u.var).var.ptr_ptr = NULL;
make_real_object(object_ptr TSRMLS_CC);
object = *object_ptr;
@@ -10347,10 +10321,6 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t incdec_op, ZEND
zval **retval = &EX_T(opline->result.u.var).var.ptr;
int have_get_ptr = 0;
if (IS_VAR == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -10443,10 +10413,6 @@ static int zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t incdec_op, ZEN
zval *retval = &EX_T(opline->result.u.var).tmp_var;
int have_get_ptr = 0;
if (IS_VAR == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -11625,10 +11591,6 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*binary_op)(zval *
zval **retval = &EX_T(result->u.var).var.ptr;
int have_get_ptr = 0;
if (IS_VAR == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
EX_T(result->u.var).var.ptr_ptr = NULL;
make_real_object(object_ptr TSRMLS_CC);
object = *object_ptr;
@@ -11880,10 +11842,6 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t incdec_op, ZEND
zval **retval = &EX_T(opline->result.u.var).var.ptr;
int have_get_ptr = 0;
if (IS_VAR == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -11976,10 +11934,6 @@ static int zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t incdec_op, ZEN
zval *retval = &EX_T(opline->result.u.var).tmp_var;
int have_get_ptr = 0;
if (IS_VAR == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -12972,10 +12926,6 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*binary_op)(zva
zval **retval = &EX_T(result->u.var).var.ptr;
int have_get_ptr = 0;
if (IS_VAR == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
EX_T(result->u.var).var.ptr_ptr = NULL;
make_real_object(object_ptr TSRMLS_CC);
object = *object_ptr;
@@ -13657,10 +13607,6 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*binary_op)(zval *r
zval **retval = &EX_T(result->u.var).var.ptr;
int have_get_ptr = 0;
if (IS_VAR == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
EX_T(result->u.var).var.ptr_ptr = NULL;
make_real_object(object_ptr TSRMLS_CC);
object = *object_ptr;
@@ -13911,10 +13857,6 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t incdec_op, ZEND_
zval **retval = &EX_T(opline->result.u.var).var.ptr;
int have_get_ptr = 0;
if (IS_VAR == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -14007,10 +13949,6 @@ static int zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t incdec_op, ZEND
zval *retval = &EX_T(opline->result.u.var).tmp_var;
int have_get_ptr = 0;
if (IS_VAR == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -15079,10 +15017,6 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int (*binary_op)(z
zval **retval = &EX_T(result->u.var).var.ptr;
int have_get_ptr = 0;
if (IS_UNUSED == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
EX_T(result->u.var).var.ptr_ptr = NULL;
make_real_object(object_ptr TSRMLS_CC);
object = *object_ptr;
@@ -15332,10 +15266,6 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(incdec_t incdec_op,
zval **retval = &EX_T(opline->result.u.var).var.ptr;
int have_get_ptr = 0;
if (IS_UNUSED == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -15428,10 +15358,6 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incdec_t incdec_op
zval *retval = &EX_T(opline->result.u.var).tmp_var;
int have_get_ptr = 0;
if (IS_UNUSED == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -16115,10 +16041,6 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*binary_op)(zva
zval **retval = &EX_T(result->u.var).var.ptr;
int have_get_ptr = 0;
if (IS_UNUSED == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
EX_T(result->u.var).var.ptr_ptr = NULL;
make_real_object(object_ptr TSRMLS_CC);
object = *object_ptr;
@@ -16369,10 +16291,6 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(incdec_t incdec_op, Z
zval **retval = &EX_T(opline->result.u.var).var.ptr;
int have_get_ptr = 0;
if (IS_UNUSED == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -16465,10 +16383,6 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec_t incdec_op,
zval *retval = &EX_T(opline->result.u.var).tmp_var;
int have_get_ptr = 0;
if (IS_UNUSED == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -17108,10 +17022,6 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*binary_op)(zva
zval **retval = &EX_T(result->u.var).var.ptr;
int have_get_ptr = 0;
if (IS_UNUSED == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
EX_T(result->u.var).var.ptr_ptr = NULL;
make_real_object(object_ptr TSRMLS_CC);
object = *object_ptr;
@@ -17362,10 +17272,6 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_t incdec_op, Z
zval **retval = &EX_T(opline->result.u.var).var.ptr;
int have_get_ptr = 0;
if (IS_UNUSED == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -17458,10 +17364,6 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec_t incdec_op,
zval *retval = &EX_T(opline->result.u.var).tmp_var;
int have_get_ptr = 0;
if (IS_UNUSED == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -18101,10 +18003,6 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int (*binary_op)(
zval **retval = &EX_T(result->u.var).var.ptr;
int have_get_ptr = 0;
if (IS_UNUSED == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
EX_T(result->u.var).var.ptr_ptr = NULL;
make_real_object(object_ptr TSRMLS_CC);
object = *object_ptr;
@@ -18371,10 +18269,6 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*binary_op)(zval
zval **retval = &EX_T(result->u.var).var.ptr;
int have_get_ptr = 0;
if (IS_UNUSED == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
EX_T(result->u.var).var.ptr_ptr = NULL;
make_real_object(object_ptr TSRMLS_CC);
object = *object_ptr;
@@ -18624,10 +18518,6 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_CV(incdec_t incdec_op, ZE
zval **retval = &EX_T(opline->result.u.var).var.ptr;
int have_get_ptr = 0;
if (IS_UNUSED == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -18720,10 +18610,6 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_t incdec_op, Z
zval *retval = &EX_T(opline->result.u.var).tmp_var;
int have_get_ptr = 0;
if (IS_UNUSED == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -20825,10 +20711,6 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*binary_op)(zval
zval **retval = &EX_T(result->u.var).var.ptr;
int have_get_ptr = 0;
if (IS_CV == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
EX_T(result->u.var).var.ptr_ptr = NULL;
make_real_object(object_ptr TSRMLS_CC);
object = *object_ptr;
@@ -21078,10 +20960,6 @@ static int zend_pre_incdec_property_helper_SPEC_CV_CONST(incdec_t incdec_op, ZEN
zval **retval = &EX_T(opline->result.u.var).var.ptr;
int have_get_ptr = 0;
if (IS_CV == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -21174,10 +21052,6 @@ static int zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t incdec_op, ZE
zval *retval = &EX_T(opline->result.u.var).tmp_var;
int have_get_ptr = 0;
if (IS_CV == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -22346,10 +22220,6 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*binary_op)(zval *r
zval **retval = &EX_T(result->u.var).var.ptr;
int have_get_ptr = 0;
if (IS_CV == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
EX_T(result->u.var).var.ptr_ptr = NULL;
make_real_object(object_ptr TSRMLS_CC);
object = *object_ptr;
@@ -22600,10 +22470,6 @@ static int zend_pre_incdec_property_helper_SPEC_CV_TMP(incdec_t incdec_op, ZEND_
zval **retval = &EX_T(opline->result.u.var).var.ptr;
int have_get_ptr = 0;
if (IS_CV == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -22696,10 +22562,6 @@ static int zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t incdec_op, ZEND
zval *retval = &EX_T(opline->result.u.var).tmp_var;
int have_get_ptr = 0;
if (IS_CV == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -23871,10 +23733,6 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*binary_op)(zval *r
zval **retval = &EX_T(result->u.var).var.ptr;
int have_get_ptr = 0;
if (IS_CV == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
EX_T(result->u.var).var.ptr_ptr = NULL;
make_real_object(object_ptr TSRMLS_CC);
object = *object_ptr;
@@ -24125,10 +23983,6 @@ static int zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t incdec_op, ZEND_
zval **retval = &EX_T(opline->result.u.var).var.ptr;
int have_get_ptr = 0;
if (IS_CV == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -24221,10 +24075,6 @@ static int zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t incdec_op, ZEND
zval *retval = &EX_T(opline->result.u.var).tmp_var;
int have_get_ptr = 0;
if (IS_CV == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -25209,10 +25059,6 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*binary_op)(zval
zval **retval = &EX_T(result->u.var).var.ptr;
int have_get_ptr = 0;
if (IS_CV == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
EX_T(result->u.var).var.ptr_ptr = NULL;
make_real_object(object_ptr TSRMLS_CC);
object = *object_ptr;
@@ -25893,10 +25739,6 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binary_op)(zval *re
zval **retval = &EX_T(result->u.var).var.ptr;
int have_get_ptr = 0;
if (IS_CV == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
EX_T(result->u.var).var.ptr_ptr = NULL;
make_real_object(object_ptr TSRMLS_CC);
object = *object_ptr;
@@ -26146,10 +25988,6 @@ static int zend_pre_incdec_property_helper_SPEC_CV_CV(incdec_t incdec_op, ZEND_O
zval **retval = &EX_T(opline->result.u.var).var.ptr;
int have_get_ptr = 0;
if (IS_CV == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -26242,10 +26080,6 @@ static int zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t incdec_op, ZEND_
zval *retval = &EX_T(opline->result.u.var).tmp_var;
int have_get_ptr = 0;
if (IS_CV == IS_VAR && !object_ptr) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
+7 -27
View File
@@ -920,7 +920,7 @@ AC_DEFUN([PHP_GEN_BUILD_DIRS],[
])
dnl
dnl PHP_NEW_EXTENSION(extname, sources [, shared [, sapi_class [, extra-cflags [, cxx [, zend_ext]]]]])
dnl PHP_NEW_EXTENSION(extname, sources [, shared [,sapi_class[, extra-cflags[, cxx[, zend_ext]]]]])
dnl
dnl Includes an extension in the build.
dnl
@@ -968,15 +968,12 @@ dnl ---------------------------------------------- Shared module
if test "$3" != "shared" && test "$3" != "yes" && test "$4" = "cli"; then
dnl ---------------------------------------------- CLI static module
[PHP_]translit($1,a-z_-,A-Z__)[_SHARED]=no
case "$PHP_SAPI" in
cgi|embed[)]
PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,)
EXT_STATIC="$EXT_STATIC $1"
;;
*[)]
PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,cli)
;;
esac
if test "$PHP_SAPI" = "cgi"; then
PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,)
EXT_STATIC="$EXT_STATIC $1"
else
PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,cli)
fi
EXT_CLI_STATIC="$EXT_CLI_STATIC $1"
fi
PHP_ADD_BUILD_DIR($ext_builddir)
@@ -2769,23 +2766,6 @@ 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
AC_DEFUN([PHP_DETECT_SUNCC],[
SUNCC="no"
AC_MSG_CHECKING([for suncc])
AC_EGREP_CPP([^__SUNPRO_C], [__SUNPRO_C],
SUNCC="no"
AC_MSG_RESULT([no]),
SUNCC="yes"
GCC="no"
test -n "$auto_cflags" && CFLAGS="-fsimple=2 -xnorunpath -xO4 -xalias_level=basic -xipo=1 -xlibmopt -xprefetch_level=1 -xprefetch=auto -xstrconst -xtarget=native -zlazyload"
GCC=""
AC_MSG_RESULT([yes])
)
])
dnl
dnl PHP_CRYPT_R_STYLE
dnl detect the style of crypt_r() is any is available
+4 -1
View File
@@ -51,6 +51,8 @@ function do_deps(mod_idx, module_name, mod_name_len, dep, ext, val, depid
do_deps(depidx);
}
}
#printf(" phpext_%s_ptr,\n", module_name);
printf(" phpext_%s_ptr,@NEWLINE@", module_name);
delete mods[mod_idx];
}
@@ -77,7 +79,8 @@ END {
out_count = 0;
while (count(mods)) {
for (i = 0; i <= mod_count - 1; i++) {
# count down, since we need to assemble it in reverse order
for (i = mod_count-1; i >= 0; --i) {
if (i in mods) {
do_deps(i);
}
+4 -18
View File
@@ -41,8 +41,8 @@ AC_CONFIG_HEADER(main/php_config.h)
PHP_MAJOR_VERSION=5
PHP_MINOR_VERSION=2
PHP_RELEASE_VERSION=10
PHP_EXTRA_VERSION="RC2"
PHP_RELEASE_VERSION=9
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`
@@ -140,9 +140,8 @@ esac
dnl Checks for programs.
dnl -------------------------------------------------------------------------
AC_PROG_CC([cc gcc])
AC_PROG_CC
PHP_DETECT_ICC
PHP_DETECT_SUNCC
AC_PROG_CC_C_O
dnl Change to AC_PROG_CC_STDC when we start requiring a post-2.13 autoconf
dnl AC_PROG_CC_STDC
@@ -188,10 +187,6 @@ case $host_cpu in
CFLAGS="$CFLAGS -ieee"
fi
;;
sparc*)
if test "$SUNCC" = "yes"; then
CFLAGS="$CFLAGS -xmemalign=8s"
fi
esac
case $host_alias in
@@ -690,7 +685,7 @@ 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"
ltp_version_list="1.5 1.6"
AC_CHECK_PROG(LTP, lcov, lcov)
AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)
@@ -736,15 +731,6 @@ if test "$PHP_GCOV" = "yes"; then
dnl Add the special gcc flags
CFLAGS="$CFLAGS -O0 -fprofile-arcs -ftest-coverage"
CXXFLAGS="$CXXFLAGS -O0 -fprofile-arcs -ftest-coverage"
if test "$SUNCC" = "yes"; then
if test -n "$auto_cflags"; then
CFLAGS="-g"
CXXFLAGS="-g"
else
CFLAGS="$CFLAGS -g"
CXXFLAGS="$CFLAGS -g"
fi
fi
fi
PHP_ARG_ENABLE(debug, whether to include debugging symbols,
+60 -65
View File
@@ -48,80 +48,75 @@ if test "$PHP_CURL" != "no"; then
else
AC_MSG_ERROR(cURL version 7.10.5 or later is required to compile php with cURL support)
fi
PHP_ADD_INCLUDE($CURL_DIR/include)
PHP_EVAL_LIBLINE($CURL_LIBS, CURL_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(curl, $CURL_DIR/$PHP_LIBDIR, CURL_SHARED_LIBADD)
AC_MSG_CHECKING([for SSL support in libcurl])
CURL_SSL=`$CURL_CONFIG --feature | $EGREP SSL`
if test "$CURL_SSL" = "SSL"; then
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_CURL_SSL], [1], [Have cURL with SSL support])
save_CFLAGS="$CFLAGS"
CFLAGS="`$CURL_CONFIG --cflags`"
save_LDFLAGS="$LDFLAGS"
LDFLAGS="`$CURL_CONFIG --libs` $ld_runpath_switch$CURL_DIR/$PHP_LIBDIR"
AC_PROG_CPP
AC_MSG_CHECKING([for openssl support in libcurl])
AC_TRY_RUN([
#include <curl/curl.h>
int main(int argc, char *argv[]) {
curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
if (data && data->ssl_version && *data->ssl_version) {
const char *ptr = data->ssl_version;
while(*ptr == ' ') ++ptr;
return strncasecmp(ptr, "OpenSSL", sizeof("OpenSSL")-1);
}
return 1;
}
],[
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_CURL_SSL], [1], [Have cURL with SSL support])
save_CFLAGS="$CFLAGS"
CFLAGS="`$CURL_CONFIG --cflags`"
AC_PROG_CPP
AC_MSG_CHECKING([for openssl support in libcurl])
AC_TRY_RUN([
#include <curl/curl.h>
int main(int argc, char *argv[])
{
curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
if (data && data->ssl_version && *data->ssl_version) {
const char *ptr = data->ssl_version;
while(*ptr == ' ') ++ptr;
return strncasecmp(ptr, "OpenSSL", sizeof("OpenSSL")-1);
}
return 1;
}
],[
AC_MSG_RESULT([yes])
AC_CHECK_HEADERS([openssl/crypto.h], [
AC_DEFINE([HAVE_CURL_OPENSSL], [1], [Have cURL with OpenSSL support])
])
], [
AC_MSG_RESULT([no])
], [
AC_MSG_RESULT([no])
AC_CHECK_HEADERS([openssl/crypto.h], [
AC_DEFINE([HAVE_CURL_OPENSSL], [1], [Have cURL with OpenSSL support])
])
AC_MSG_CHECKING([for gnutls support in libcurl])
AC_TRY_RUN([
#include <curl/curl.h>
int main(int argc, char *argv[])
{
curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
if (data && data->ssl_version && *data->ssl_version) {
const char *ptr = data->ssl_version;
while(*ptr == ' ') ++ptr;
return strncasecmp(ptr, "GnuTLS", sizeof("GnuTLS")-1);
}
return 1;
}
], [
AC_MSG_RESULT([yes])
AC_CHECK_HEADER([gcrypt.h], [
AC_DEFINE([HAVE_CURL_GNUTLS], [1], [Have cURL with GnuTLS support])
])
], [
AC_MSG_RESULT([no])
], [
AC_MSG_RESULT([no])
])
CFLAGS="$save_CFLAGS"
else
], [
AC_MSG_RESULT([no])
], [
AC_MSG_RESULT([no])
])
AC_MSG_CHECKING([for gnutls support in libcurl])
AC_TRY_RUN([
#include <curl/curl.h>
int main(int argc, char *argv[]) {
curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
if (data && data->ssl_version && *data->ssl_version) {
const char *ptr = data->ssl_version;
while(*ptr == ' ') ++ptr;
return strncasecmp(ptr, "GnuTLS", sizeof("GnuTLS")-1);
}
return 1;
}
], [
AC_MSG_RESULT([yes])
AC_CHECK_HEADER([gcrypt.h], [
AC_DEFINE([HAVE_CURL_GNUTLS], [1], [Have cURL with GnuTLS support])
])
], [
AC_MSG_RESULT([no])
], [
AC_MSG_RESULT([no])
])
CFLAGS="$save_CFLAGS"
LDFLAGS="$save_LDFLAGS"
else
AC_MSG_RESULT([no])
fi
PHP_ADD_INCLUDE($CURL_DIR/include)
PHP_EVAL_LIBLINE($CURL_LIBS, CURL_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(curl, $CURL_DIR/$PHP_LIBDIR, CURL_SHARED_LIBADD)
PHP_CHECK_LIBRARY(curl,curl_easy_perform,
[
AC_DEFINE(HAVE_CURL,1,[ ])
+165 -255
View File
@@ -147,7 +147,6 @@ static struct gcry_thread_cbs php_curl_gnutls_tsl = {
#endif
/* }}} */
static void _php_curl_close_ex(php_curl *ch TSRMLS_DC);
static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
#define SAVE_CURL_ERROR(__handle, __err) (__handle)->err.no = (int) __err;
@@ -158,51 +157,36 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
#define CAAZ(s, v) add_assoc_zval_ex(return_value, s, sizeof(s), (zval *) v);
#if defined(PHP_WIN32) || defined(__GNUC__)
# define php_curl_ret(__ret) RETVAL_FALSE; return __ret;
#define php_curl_ret(__ret) RETVAL_FALSE; return __ret;
#else
# define php_curl_ret(__ret) RETVAL_FALSE; return;
#define php_curl_ret(__ret) RETVAL_FALSE; return;
#endif
static int php_curl_option_url(php_curl *ch, const char *url, const int len) /* {{{ */
{
CURLcode error = CURLE_OK;
#if LIBCURL_VERSION_NUM < 0x071100
char *copystr = NULL;
#endif
TSRMLS_FETCH();
/* Disable file:// if open_basedir or safe_mode are used */
if ((PG(open_basedir) && *PG(open_basedir)) || PG(safe_mode)) {
#if LIBCURL_VERSION_NUM >= 0x071304
error = curl_easy_setopt(ch->cp, CURLOPT_PROTOCOLS, CURLPROTO_ALL & ~CURLPROTO_FILE);
#else
php_url *uri;
if (!(uri = php_url_parse_ex(url, len))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid URL '%s'", url);
return 0;
}
if (!strncasecmp("file", uri->scheme, sizeof("file"))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Protocol 'file' disabled in cURL");
php_url_free(uri);
return 0;
}
php_url_free(uri);
#endif
#define PHP_CURL_CHECK_OPEN_BASEDIR(str, len, __ret) \
if (((PG(open_basedir) && *PG(open_basedir)) || PG(safe_mode)) && \
strncasecmp(str, "file:", sizeof("file:") - 1) == 0) \
{ \
php_url *tmp_url; \
\
if (!(tmp_url = php_url_parse_ex(str, len))) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid URL '%s'", str); \
php_curl_ret(__ret); \
} \
\
if (tmp_url->host || !php_memnstr(str, tmp_url->path, strlen(tmp_url->path), str + len)) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "URL '%s' contains unencoded control characters", str); \
php_url_free(tmp_url); \
php_curl_ret(__ret); \
} \
\
if (tmp_url->query || tmp_url->fragment || php_check_open_basedir(tmp_url->path TSRMLS_CC) || \
(PG(safe_mode) && !php_checkuid(tmp_url->path, "rb+", CHECKUID_CHECK_MODE_PARAM)) \
) { \
php_url_free(tmp_url); \
php_curl_ret(__ret); \
} \
php_url_free(tmp_url); \
}
/* Strings passed to libcurl as 'char *' arguments, are copied by the library... NOTE: before 7.17.0 strings were not copied. */
#if LIBCURL_VERSION_NUM >= 0x071100
error = curl_easy_setopt(ch->cp, CURLOPT_URL, url);
#else
copystr = estrndup(url, len);
error = curl_easy_setopt(ch->cp, CURLOPT_URL, copystr);
zend_llist_add_element(&ch->to_free.str, &copystr);
#endif
return (error == CURLE_OK ? 1 : 0);
}
/* }}} */
/* {{{ arginfo */
static
@@ -295,13 +279,14 @@ ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_multi_info_read, 0, 0, 1)
ZEND_ARG_INFO(0, mh)
ZEND_ARG_INFO(1, msgs_in_queue)
ZEND_ARG_INFO(0, msgs_in_queue)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO(arginfo_curl_multi_close, 0)
ZEND_ARG_INFO(0, mh)
ZEND_END_ARG_INFO()
/* }}} */
/* {{{ curl_functions[]
@@ -368,11 +353,7 @@ PHP_MINIT_FUNCTION(curl)
{
le_curl = zend_register_list_destructors_ex(_php_curl_close, NULL, "curl", module_number);
le_curl_multi_handle = zend_register_list_destructors_ex(_php_curl_multi_close, NULL, "curl", module_number);
/* See http://curl.haxx.se/lxr/source/docs/libcurl/symbols-in-versions
or curl src/docs/libcurl/symbols-in-versions for a (almost) complete list
of options and which version they were introduced */
/* Constants for curl_setopt() */
REGISTER_CURL_CONSTANT(CURLOPT_DNS_USE_GLOBAL_CACHE);
REGISTER_CURL_CONSTANT(CURLOPT_DNS_CACHE_TIMEOUT);
@@ -440,7 +421,7 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLOPT_FILETIME);
REGISTER_CURL_CONSTANT(CURLOPT_WRITEFUNCTION);
REGISTER_CURL_CONSTANT(CURLOPT_READFUNCTION);
#if CURLOPT_PASSWDFUNCTION != 0
#if CURLOPT_PASSWDFUNCTION != 0
REGISTER_CURL_CONSTANT(CURLOPT_PASSWDFUNCTION);
#endif
REGISTER_CURL_CONSTANT(CURLOPT_HEADERFUNCTION);
@@ -486,14 +467,14 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURL_TIMECOND_LASTMOD);
#if LIBCURL_VERSION_NUM > 0x070a05 /* CURLOPT_HTTPAUTH is available since curl 7.10.6 */
REGISTER_CURL_CONSTANT(CURLOPT_HTTPAUTH);
/* http authentication options */
REGISTER_CURL_CONSTANT(CURLAUTH_BASIC);
REGISTER_CURL_CONSTANT(CURLAUTH_DIGEST);
REGISTER_CURL_CONSTANT(CURLAUTH_GSSNEGOTIATE);
REGISTER_CURL_CONSTANT(CURLAUTH_NTLM);
REGISTER_CURL_CONSTANT(CURLAUTH_ANY);
REGISTER_CURL_CONSTANT(CURLAUTH_ANYSAFE);
REGISTER_CURL_CONSTANT(CURLOPT_HTTPAUTH);
/* http authentication options */
REGISTER_CURL_CONSTANT(CURLAUTH_BASIC);
REGISTER_CURL_CONSTANT(CURLAUTH_DIGEST);
REGISTER_CURL_CONSTANT(CURLAUTH_GSSNEGOTIATE);
REGISTER_CURL_CONSTANT(CURLAUTH_NTLM);
REGISTER_CURL_CONSTANT(CURLAUTH_ANY);
REGISTER_CURL_CONSTANT(CURLAUTH_ANYSAFE);
#endif
#if LIBCURL_VERSION_NUM > 0x070a06 /* CURLOPT_PROXYAUTH & CURLOPT_FTP_CREATE_MISSING_DIRS are available since curl 7.10.7 */
@@ -539,7 +520,7 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURL_VERSION_KERBEROS4);
REGISTER_CURL_CONSTANT(CURL_VERSION_SSL);
REGISTER_CURL_CONSTANT(CURL_VERSION_LIBZ);
/* version constants */
REGISTER_CURL_CONSTANT(CURLVERSION_NOW);
@@ -613,8 +594,8 @@ PHP_MINIT_FUNCTION(curl)
#if LIBCURL_VERSION_NUM >= 0x070b00
REGISTER_CURL_CONSTANT(CURLE_FTP_SSL_FAILED);
#endif
REGISTER_CURL_CONSTANT(CURLPROXY_HTTP);
REGISTER_CURL_CONSTANT(CURLPROXY_SOCKS4);
REGISTER_CURL_CONSTANT(CURLPROXY_SOCKS5);
REGISTER_CURL_CONSTANT(CURL_NETRC_OPTIONAL);
@@ -624,7 +605,7 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURL_HTTP_VERSION_NONE);
REGISTER_CURL_CONSTANT(CURL_HTTP_VERSION_1_0);
REGISTER_CURL_CONSTANT(CURL_HTTP_VERSION_1_1);
REGISTER_CURL_CONSTANT(CURLM_CALL_MULTI_PERFORM);
REGISTER_CURL_CONSTANT(CURLM_OK);
REGISTER_CURL_CONSTANT(CURLM_BAD_HANDLE);
@@ -649,34 +630,16 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLFTPSSL_ALL);
#endif
#if LIBCURL_VERSION_NUM >= 0x071304
REGISTER_CURL_CONSTANT(CURLOPT_REDIR_PROTOCOLS);
REGISTER_CURL_CONSTANT(CURLOPT_PROTOCOLS);
REGISTER_CURL_CONSTANT(CURLPROTO_HTTP);
REGISTER_CURL_CONSTANT(CURLPROTO_HTTPS);
REGISTER_CURL_CONSTANT(CURLPROTO_FTP);
REGISTER_CURL_CONSTANT(CURLPROTO_FTPS);
REGISTER_CURL_CONSTANT(CURLPROTO_SCP);
REGISTER_CURL_CONSTANT(CURLPROTO_SFTP);
REGISTER_CURL_CONSTANT(CURLPROTO_TELNET);
REGISTER_CURL_CONSTANT(CURLPROTO_LDAP);
REGISTER_CURL_CONSTANT(CURLPROTO_LDAPS);
REGISTER_CURL_CONSTANT(CURLPROTO_DICT);
REGISTER_CURL_CONSTANT(CURLPROTO_FILE);
REGISTER_CURL_CONSTANT(CURLPROTO_TFTP);
REGISTER_CURL_CONSTANT(CURLPROTO_ALL);
#endif
#ifdef PHP_CURL_NEED_OPENSSL_TSL
if (!CRYPTO_get_id_callback()) {
int i, c = CRYPTO_num_locks();
php_curl_openssl_tsl = malloc(c * sizeof(MUTEX_T));
for (i = 0; i < c; ++i) {
php_curl_openssl_tsl[i] = tsrm_mutex_alloc();
}
CRYPTO_set_id_callback(php_curl_ssl_id);
CRYPTO_set_locking_callback(php_curl_ssl_lock);
}
@@ -684,7 +647,7 @@ PHP_MINIT_FUNCTION(curl)
#ifdef PHP_CURL_NEED_GNUTLS_TSL
gcry_control(GCRYCTL_SET_THREAD_CBS, &php_curl_gnutls_tsl);
#endif
if (curl_global_init(CURL_GLOBAL_SSL) != CURLE_OK) {
return FAILURE;
}
@@ -706,7 +669,7 @@ PHP_MINIT_FUNCTION(curl)
php_register_url_stream_wrapper("ldap", &php_curl_wrapper TSRMLS_CC);
# endif
#endif
return SUCCESS;
}
/* }}} */
@@ -725,14 +688,14 @@ PHP_MSHUTDOWN_FUNCTION(curl)
#ifdef PHP_CURL_NEED_OPENSSL_TSL
if (php_curl_openssl_tsl) {
int i, c = CRYPTO_num_locks();
CRYPTO_set_id_callback(NULL);
CRYPTO_set_locking_callback(NULL);
for (i = 0; i < c; ++i) {
tsrm_mutex_free(php_curl_openssl_tsl[i]);
}
free(php_curl_openssl_tsl);
php_curl_openssl_tsl = NULL;
}
@@ -754,7 +717,7 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
fprintf(stderr, "curl_write() called\n");
fprintf(stderr, "data = %s, size = %d, nmemb = %d, ctx = %x\n", data, size, nmemb, ctx);
#endif
switch (t->method) {
case PHP_CURL_STDOUT:
PHPWRITE(data, length);
@@ -778,7 +741,7 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
ZVAL_RESOURCE(handle, ch->id);
zend_list_addref(ch->id);
argv[0] = &handle;
MAKE_STD_ZVAL(zdata);
ZVAL_STRINGL(zdata, data, length, 1);
argv[1] = &zdata;
@@ -869,7 +832,7 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
error = zend_call_function(&fci, &t->fci_cache TSRMLS_CC);
ch->in_callback = 0;
if (error == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_READFUNCTION");
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_READFUNCTION");
#if LIBCURL_VERSION_NUM >= 0x070c01 /* 7.12.1 */
length = CURL_READFUNC_ABORT;
#endif
@@ -900,7 +863,7 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
php_curl_write *t = ch->handlers->write_header;
size_t length = size * nmemb;
TSRMLS_FETCH_FROM_CTX(ch->thread_ctx);
switch (t->method) {
case PHP_CURL_STDOUT:
/* Handle special case write when we're returning the entire transfer
@@ -976,7 +939,7 @@ static int curl_debug(CURL *cp, curl_infotype type, char *buf, size_t buf_len, v
if (type == CURLINFO_HEADER_OUT) {
if (ch->header.str_len) {
efree(ch->header.str);
efree(ch->header.str);
}
if (buf_len > 0) {
ch->header.str = estrndup(buf, buf_len);
@@ -1022,7 +985,7 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "User handler '%s' did not return a string", Z_STRVAL_P(func));
}
zval_ptr_dtor(&argv[0]);
zval_ptr_dtor(&argv[1]);
zval_ptr_dtor(&argv[2]);
@@ -1039,7 +1002,7 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
static void curl_free_string(void **string)
{
efree(*string);
}
}
/* }}} */
#endif
@@ -1064,7 +1027,7 @@ static void curl_free_slist(void **slist)
PHP_FUNCTION(curl_version)
{
curl_version_info_data *d;
long uversion = CURLVERSION_NOW;
long uversion = CURLVERSION_NOW;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &uversion) == FAILURE) {
return;
@@ -1094,8 +1057,7 @@ PHP_FUNCTION(curl_version)
array_init(protocol_list);
while (*p != NULL) {
add_next_index_string(protocol_list, *p, 1);
p++;
add_next_index_string(protocol_list, *p++, 1);
}
CAAZ("protocols", protocol_list);
}
@@ -1114,9 +1076,9 @@ static void alloc_curl_handle(php_curl **ch)
(*ch)->in_callback = 0;
(*ch)->header.str_len = 0;
memset(&(*ch)->err, 0, sizeof((*ch)->err));
#if LIBCURL_VERSION_NUM < 0x071101
zend_llist_init(&(*ch)->to_free.str, sizeof(char *), (llist_dtor_func_t) curl_free_string, 0);
#endif
@@ -1129,10 +1091,10 @@ static void alloc_curl_handle(php_curl **ch)
Initialize a cURL session */
PHP_FUNCTION(curl_init)
{
php_curl *ch;
zval **url;
CURL *cp;
int argc = ZEND_NUM_ARGS();
zval **url;
php_curl *ch;
CURL *cp;
int argc = ZEND_NUM_ARGS();
if (argc < 0 || argc > 1 || zend_get_parameters_ex(argc, &url) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1140,6 +1102,7 @@ PHP_FUNCTION(curl_init)
if (argc > 0) {
convert_to_string_ex(url);
PHP_CURL_CHECK_OPEN_BASEDIR(Z_STRVAL_PP(url), Z_STRLEN_PP(url), (void) NULL);
}
cp = curl_easy_init();
@@ -1152,7 +1115,7 @@ PHP_FUNCTION(curl_init)
TSRMLS_SET_CTX(ch->thread_ctx);
ch->cp = cp;
ch->handlers->write->method = PHP_CURL_STDOUT;
ch->handlers->write->type = PHP_CURL_ASCII;
ch->handlers->read->method = PHP_CURL_DIRECT;
@@ -1177,10 +1140,15 @@ PHP_FUNCTION(curl_init)
#endif
if (argc > 0) {
if (!php_curl_option_url(ch, Z_STRVAL_PP(url), Z_STRLEN_PP(url))) {
_php_curl_close_ex(ch TSRMLS_CC);
RETURN_FALSE;
}
#if LIBCURL_VERSION_NUM >= 0x071100
curl_easy_setopt(ch->cp, CURLOPT_URL, Z_STRVAL_PP(url));
#else
char *urlcopy;
urlcopy = estrndup(Z_STRVAL_PP(url), Z_STRLEN_PP(url));
curl_easy_setopt(ch->cp, CURLOPT_URL, urlcopy);
zend_llist_add_element(&ch->to_free.str, &urlcopy);
#endif
}
ZEND_REGISTER_RESOURCE(return_value, ch, le_curl);
@@ -1192,14 +1160,14 @@ PHP_FUNCTION(curl_init)
Copy a cURL handle along with all of it's preferences */
PHP_FUNCTION(curl_copy_handle)
{
CURL *cp;
zval **zid;
php_curl *ch, *dupch;
zval **zid;
CURL *cp;
php_curl *ch;
php_curl *dupch;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zid) == FAILURE) {
WRONG_PARAM_COUNT;
}
ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
cp = curl_easy_duphandle(ch->cp);
@@ -1212,7 +1180,6 @@ PHP_FUNCTION(curl_copy_handle)
TSRMLS_SET_CTX(dupch->thread_ctx);
dupch->cp = cp;
dupch->uses = 0;
dupch->handlers->write->method = ch->handlers->write->method;
dupch->handlers->write->type = ch->handlers->write->type;
dupch->handlers->read->method = ch->handlers->read->method;
@@ -1335,19 +1302,8 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
case CURLOPT_COOKIESESSION:
#if LIBCURL_VERSION_NUM > 0x070b01 /* CURLOPT_TCP_NODELAY is available since curl 7.11.2 */
case CURLOPT_TCP_NODELAY:
#endif
#if LIBCURL_VERSION_NUM >= 0x71304
case CURLOPT_REDIR_PROTOCOLS:
case CURLOPT_PROTOCOLS:
#endif
convert_to_long_ex(zvalue);
#if LIBCURL_VERSION_NUM >= 0x71304
if (((PG(open_basedir) && *PG(open_basedir)) || PG(safe_mode)) && (Z_LVAL_PP(zvalue) & CURLPROTO_FILE)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLPROTO_FILE cannot be activated when in safe_mode or an open_basedir is set");
RETVAL_FALSE;
return 1;
}
#endif
error = curl_easy_setopt(ch->cp, option, Z_LVAL_PP(zvalue));
break;
case CURLOPT_FOLLOWLOCATION:
@@ -1373,50 +1329,47 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
case CURLOPT_COOKIE:
case CURLOPT_REFERER:
case CURLOPT_INTERFACE:
case CURLOPT_KRB4LEVEL:
case CURLOPT_KRB4LEVEL:
case CURLOPT_EGDSOCKET:
case CURLOPT_CAINFO:
case CURLOPT_CAINFO:
case CURLOPT_CAPATH:
case CURLOPT_SSL_CIPHER_LIST:
case CURLOPT_SSL_CIPHER_LIST:
case CURLOPT_SSLKEY:
case CURLOPT_SSLKEYTYPE:
case CURLOPT_SSLKEYPASSWD:
case CURLOPT_SSLENGINE:
case CURLOPT_SSLKEYTYPE:
case CURLOPT_SSLKEYPASSWD:
case CURLOPT_SSLENGINE:
case CURLOPT_SSLENGINE_DEFAULT:
case CURLOPT_SSLCERTTYPE:
case CURLOPT_ENCODING:
{
case CURLOPT_ENCODING: {
#if LIBCURL_VERSION_NUM < 0x071100
char *copystr = NULL;
#endif
convert_to_string_ex(zvalue);
if (option == CURLOPT_URL) {
if (!php_curl_option_url(ch, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue))) {
RETVAL_FALSE;
return 1;
}
} else {
#if LIBCURL_VERSION_NUM >= 0x071100
/* Strings passed to libcurl as ’char *’ arguments, are copied by the library... NOTE: before 7.17.0 strings were not copied. */
error = curl_easy_setopt(ch->cp, option, Z_STRVAL_PP(zvalue));
#else
copystr = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
error = curl_easy_setopt(ch->cp, option, copystr);
zend_llist_add_element(&ch->to_free.str, &copystr);
#endif
PHP_CURL_CHECK_OPEN_BASEDIR(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue), 1);
}
#if LIBCURL_VERSION_NUM >= 0x071100
/* Strings passed to libcurl as ’char *’ arguments, are copied by the library... NOTE: before 7.17.0 strings were not copied. */
error = curl_easy_setopt(ch->cp, option, Z_STRVAL_PP(zvalue));
#else
copystr = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
error = curl_easy_setopt(ch->cp, option, copystr);
zend_llist_add_element(&ch->to_free.str, &copystr);
#endif
break;
}
case CURLOPT_FILE:
case CURLOPT_INFILE:
case CURLOPT_INFILE:
case CURLOPT_WRITEHEADER:
case CURLOPT_STDERR: {
FILE *fp = NULL;
int type;
void * what;
what = zend_fetch_resource(zvalue TSRMLS_CC, -1, "File-Handle", &type, 1, php_file_le_stream());
if (!what) {
RETVAL_FALSE;
@@ -1436,46 +1389,18 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
error = CURLE_OK;
switch (option) {
case CURLOPT_FILE:
if (((php_stream *) what)->mode[0] != 'r') {
zend_list_addref(Z_LVAL_PP(zvalue));
ch->handlers->write->fp = fp;
ch->handlers->write->method = PHP_CURL_FILE;
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "the provided file handle is not writable");
RETVAL_FALSE;
return 1;
}
ch->handlers->write->fp = fp;
ch->handlers->write->method = PHP_CURL_FILE;
break;
case CURLOPT_WRITEHEADER:
if (((php_stream *) what)->mode[0] != 'r') {
zend_list_addref(Z_LVAL_PP(zvalue));
ch->handlers->write_header->fp = fp;
ch->handlers->write_header->method = PHP_CURL_FILE;
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "the provided file handle is not writable");
RETVAL_FALSE;
return 1;
}
ch->handlers->write_header->fp = fp;
ch->handlers->write_header->method = PHP_CURL_FILE;
break;
case CURLOPT_INFILE:
zend_list_addref(Z_LVAL_PP(zvalue));
ch->handlers->read->fp = fp;
ch->handlers->read->fd = Z_LVAL_PP(zvalue);
break;
case CURLOPT_STDERR:
if (((php_stream *) what)->mode[0] != 'r') {
if (ch->handlers->std_err) {
zval_ptr_dtor(&ch->handlers->std_err);
}
zval_add_ref(zvalue);
ch->handlers->std_err = *zvalue;
zend_list_addref(Z_LVAL_PP(zvalue));
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "the provided file handle is not writable");
RETVAL_FALSE;
return 1;
}
/* break omitted intentionally */
default:
error = curl_easy_setopt(ch->cp, option, fp);
break;
@@ -1493,7 +1418,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
}
break;
case CURLOPT_BINARYTRANSFER:
convert_to_long_ex(zvalue);
convert_to_long_ex(zvalue);
if (Z_LVAL_PP(zvalue)) {
ch->handlers->write->type = PHP_CURL_BINARY;
@@ -1551,8 +1476,8 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
uint string_key_len;
postfields = HASH_OF(*zvalue);
if (!postfields) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't get HashTable in CURLOPT_POSTFIELDS");
if (! postfields) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't get HashTable in CURLOPT_POSTFIELDS");
RETVAL_FALSE;
return 1;
}
@@ -1566,7 +1491,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
convert_to_string_ex(current);
zend_hash_get_current_key_ex(postfields, &string_key, &string_key_len, &num_key, 0, NULL);
postval = Z_STRVAL_PP(current);
/* The arguments after _NAMELENGTH and _CONTENTSLENGTH
@@ -1588,7 +1513,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
return 1;
}
if (type) {
error = curl_formadd(&first, &last,
error = curl_formadd(&first, &last,
CURLFORM_COPYNAME, string_key,
CURLFORM_NAMELENGTH, (long)string_key_len - 1,
CURLFORM_FILE, postval,
@@ -1596,7 +1521,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
CURLFORM_END);
*type = ';';
} else {
error = curl_formadd(&first, &last,
error = curl_formadd(&first, &last,
CURLFORM_COPYNAME, string_key,
CURLFORM_NAMELENGTH, (long)string_key_len - 1,
CURLFORM_FILE, postval,
@@ -1604,10 +1529,10 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
}
} else {
error = curl_formadd(&first, &last,
error = curl_formadd(&first, &last,
CURLFORM_COPYNAME, string_key,
CURLFORM_NAMELENGTH, (long)string_key_len - 1,
CURLFORM_COPYCONTENTS, postval,
CURLFORM_COPYCONTENTS, postval,
CURLFORM_CONTENTSLENGTH, (long)Z_STRLEN_PP(current),
CURLFORM_END);
}
@@ -1624,7 +1549,6 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
} else {
#if LIBCURL_VERSION_NUM >= 0x071101
convert_to_string_ex(zvalue);
/* with curl 7.17.0 and later, we can use COPYPOSTFIELDS, but we have to provide size before */
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRLEN_PP(zvalue));
error = curl_easy_setopt(ch->cp, CURLOPT_COPYPOSTFIELDS, Z_STRVAL_PP(zvalue));
@@ -1640,7 +1564,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
#endif
}
break;
case CURLOPT_HTTPHEADER:
case CURLOPT_HTTPHEADER:
case CURLOPT_QUOTE:
case CURLOPT_HTTP200ALIASES:
case CURLOPT_POSTQUOTE: {
@@ -1664,7 +1588,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
slist = curl_slist_append(slist, Z_STRVAL_PP(current));
if (!slist) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not build curl_slist");
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not build curl_slist");
RETVAL_FALSE;
return 1;
}
@@ -1731,7 +1655,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
PHP_FUNCTION(curl_setopt)
{
zval **zid, **zoption, **zvalue;
php_curl *ch;
php_curl *ch;
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &zid, &zoption, &zvalue) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1755,24 +1679,24 @@ PHP_FUNCTION(curl_setopt_array)
{
zval *zid, *arr, **entry;
php_curl *ch;
ulong option;
long option;
HashPosition pos;
char *string_key;
uint str_key_len;
char *string_key;
int str_key_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "za", &zid, &arr) == FAILURE) {
return;
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(ch, php_curl *, &zid, -1, le_curl_name, le_curl);
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(arr), &pos);
while (zend_hash_get_current_data_ex(Z_ARRVAL_P(arr), (void **)&entry, &pos) == SUCCESS) {
if (zend_hash_get_current_key_ex(Z_ARRVAL_P(arr), &string_key, &str_key_len, &option, 0, &pos) != HASH_KEY_IS_LONG) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array keys must be CURLOPT constants or equivalent integer values");
if (zend_hash_get_current_key_ex(Z_ARRVAL_P(arr), &string_key, &str_key_len, &option, 0, &pos) == HASH_KEY_IS_STRING) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array keys must be CURLOPT constants or equivalent integer values");
RETURN_FALSE;
}
if (_php_curl_setopt(ch, (long) option, entry, return_value TSRMLS_CC)) {
if (_php_curl_setopt(ch, option, entry, return_value TSRMLS_CC)) {
RETURN_FALSE;
}
zend_hash_move_forward_ex(Z_ARRVAL_P(arr), &pos);
@@ -1781,7 +1705,7 @@ PHP_FUNCTION(curl_setopt_array)
}
/* }}} */
/* {{{ _php_curl_cleanup_handle(ch)
/* {{{ _php_curl_cleanup_handle(ch)
Cleanup an execution phase */
void _php_curl_cleanup_handle(php_curl *ch)
{
@@ -1802,9 +1726,9 @@ void _php_curl_cleanup_handle(php_curl *ch)
Perform a cURL session */
PHP_FUNCTION(curl_exec)
{
CURLcode error;
zval **zid;
php_curl *ch;
zval **zid;
php_curl *ch;
CURLcode error;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zid) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1813,7 +1737,7 @@ PHP_FUNCTION(curl_exec)
ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
_php_curl_cleanup_handle(ch);
error = curl_easy_perform(ch->cp);
SAVE_CURL_ERROR(ch, error);
/* CURLE_PARTIAL_FILE is returned by HEAD requests */
@@ -1844,9 +1768,10 @@ PHP_FUNCTION(curl_exec)
Get information regarding a specific transfer */
PHP_FUNCTION(curl_getinfo)
{
zval **zid, **zoption;
php_curl *ch;
int option, argc = ZEND_NUM_ARGS();
zval **zid,
**zoption;
php_curl *ch;
int option, argc = ZEND_NUM_ARGS();
if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &zid, &zoption) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1935,22 +1860,22 @@ PHP_FUNCTION(curl_getinfo)
option = Z_LVAL_PP(zoption);
switch (option) {
case CURLINFO_PRIVATE:
case CURLINFO_EFFECTIVE_URL:
case CURLINFO_EFFECTIVE_URL:
case CURLINFO_CONTENT_TYPE: {
char *s_code = NULL;
char *s_code = NULL;
if (curl_easy_getinfo(ch->cp, option, &s_code) == CURLE_OK && s_code) {
RETURN_STRING(s_code, 1);
} else {
RETURN_FALSE;
}
if (curl_easy_getinfo(ch->cp, option, &s_code) == CURLE_OK && s_code) {
RETURN_STRING(s_code, 1);
} else {
RETURN_FALSE;
}
break;
}
case CURLINFO_HTTP_CODE:
case CURLINFO_HEADER_SIZE:
case CURLINFO_REQUEST_SIZE:
case CURLINFO_FILETIME:
case CURLINFO_SSL_VERIFYRESULT:
case CURLINFO_HTTP_CODE:
case CURLINFO_HEADER_SIZE:
case CURLINFO_REQUEST_SIZE:
case CURLINFO_FILETIME:
case CURLINFO_SSL_VERIFYRESULT:
case CURLINFO_REDIRECT_COUNT: {
long code = 0;
@@ -1961,16 +1886,16 @@ PHP_FUNCTION(curl_getinfo)
}
break;
}
case CURLINFO_TOTAL_TIME:
case CURLINFO_NAMELOOKUP_TIME:
case CURLINFO_TOTAL_TIME:
case CURLINFO_NAMELOOKUP_TIME:
case CURLINFO_CONNECT_TIME:
case CURLINFO_PRETRANSFER_TIME:
case CURLINFO_SIZE_UPLOAD:
case CURLINFO_PRETRANSFER_TIME:
case CURLINFO_SIZE_UPLOAD:
case CURLINFO_SIZE_DOWNLOAD:
case CURLINFO_SPEED_DOWNLOAD:
case CURLINFO_SPEED_UPLOAD:
case CURLINFO_SPEED_DOWNLOAD:
case CURLINFO_SPEED_UPLOAD:
case CURLINFO_CONTENT_LENGTH_DOWNLOAD:
case CURLINFO_CONTENT_LENGTH_UPLOAD:
case CURLINFO_CONTENT_LENGTH_UPLOAD:
case CURLINFO_STARTTRANSFER_TIME:
case CURLINFO_REDIRECT_TIME: {
double code = 0.0;
@@ -1997,9 +1922,9 @@ PHP_FUNCTION(curl_getinfo)
Return a string contain the last error for the current session */
PHP_FUNCTION(curl_error)
{
zval **zid;
php_curl *ch;
zval **zid;
php_curl *ch;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zid) == FAILURE) {
WRONG_PARAM_COUNT;
}
@@ -2015,8 +1940,8 @@ PHP_FUNCTION(curl_error)
Return an integer containing the last error number */
PHP_FUNCTION(curl_errno)
{
zval **zid;
php_curl *ch;
zval **zid;
php_curl *ch;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zid) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -2032,8 +1957,8 @@ PHP_FUNCTION(curl_errno)
Close a cURL session */
PHP_FUNCTION(curl_close)
{
zval **zid;
php_curl *ch;
zval **zid;
php_curl *ch;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zid) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -2045,8 +1970,8 @@ PHP_FUNCTION(curl_close)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempt to close cURL handle from a callback");
return;
}
if (ch->uses) {
if (ch->uses) {
ch->uses--;
} else {
zend_list_delete(Z_LVAL_PP(zid));
@@ -2056,17 +1981,14 @@ PHP_FUNCTION(curl_close)
/* {{{ _php_curl_close()
List destructor for curl handles */
static void _php_curl_close_ex(php_curl *ch TSRMLS_DC)
static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC)
{
php_curl *ch = (php_curl *) rsrc->ptr;
#if PHP_CURL_DEBUG
fprintf(stderr, "DTOR CALLED, ch = %x\n", ch);
#endif
/* Prevent crash inside cURL if passed file has already been closed */
if (ch->handlers->std_err && ch->handlers->std_err->refcount <= 0) {
curl_easy_setopt(ch->cp, CURLOPT_STDERR, stderr);
}
curl_easy_cleanup(ch->cp);
#if LIBCURL_VERSION_NUM < 0x071101
zend_llist_clean(&ch->to_free.str);
@@ -2089,28 +2011,16 @@ static void _php_curl_close_ex(php_curl *ch TSRMLS_DC)
if (ch->handlers->passwd) {
zval_ptr_dtor(&ch->handlers->passwd);
}
if (ch->handlers->std_err) {
zval_ptr_dtor(&ch->handlers->std_err);
}
if (ch->header.str_len > 0) {
efree(ch->header.str);
}
efree(ch->handlers->write);
efree(ch->handlers->write_header);
efree(ch->handlers->read);
efree(ch->handlers);
efree(ch);
}
/* }}} */
/* {{{ _php_curl_close()
List destructor for curl handles */
static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC)
{
php_curl *ch = (php_curl *) rsrc->ptr;
_php_curl_close_ex(ch TSRMLS_CC);
}
}
/* }}} */
#endif /* HAVE_CURL */
-1
View File
@@ -101,7 +101,6 @@ typedef struct {
php_curl_write *write_header;
php_curl_read *read;
zval *passwd;
zval *std_err;
} php_curl_handlers;
struct _php_curl_error {
+12 -39
View File
@@ -48,7 +48,6 @@
#include "ext/standard/php_smart_str.h"
#include "ext/standard/info.h"
#include "ext/standard/file.h"
#include "ext/standard/php_string.h"
#include "php_curl.h"
static size_t on_data_available(char *data, size_t size, size_t nmemb, void *ctx)
@@ -259,7 +258,6 @@ php_stream *php_curl_stream_opener(php_stream_wrapper *wrapper, char *filename,
php_stream *stream;
php_curl_stream *curlstream;
zval *tmp, **ctx_opt = NULL;
struct curl_slist *slist = NULL;
curlstream = emalloc(sizeof(php_curl_stream));
memset(curlstream, 0, sizeof(php_curl_stream));
@@ -308,15 +306,6 @@ php_stream *php_curl_stream_opener(php_stream_wrapper *wrapper, char *filename,
/* TODO: read cookies and options from context */
if (context && !strncasecmp(filename, "http", sizeof("http")-1)) {
/* Protocol version */
if (SUCCESS == php_stream_context_get_option(context, "http", "protocol_version", &ctx_opt) && Z_TYPE_PP(ctx_opt) == IS_DOUBLE) {
if (Z_DVAL_PP(ctx_opt) == 1.1) {
curl_easy_setopt(curlstream->curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
} else {
curl_easy_setopt(curlstream->curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
}
}
if (SUCCESS == php_stream_context_get_option(context, "http", "curl_verify_ssl_host", &ctx_opt) && Z_TYPE_PP(ctx_opt) == IS_BOOL && Z_LVAL_PP(ctx_opt) == 1) {
curl_easy_setopt(curlstream->curl, CURLOPT_SSL_VERIFYHOST, 1);
} else {
@@ -332,34 +321,20 @@ php_stream *php_curl_stream_opener(php_stream_wrapper *wrapper, char *filename,
if (SUCCESS == php_stream_context_get_option(context, "http", "user_agent", &ctx_opt) && Z_TYPE_PP(ctx_opt) == IS_STRING) {
curl_easy_setopt(curlstream->curl, CURLOPT_USERAGENT, Z_STRVAL_PP(ctx_opt));
}
if (SUCCESS == php_stream_context_get_option(context, "http", "header", &ctx_opt)) {
if (Z_TYPE_PP(ctx_opt) == IS_ARRAY) {
HashPosition pos;
zval **header = NULL;
if (SUCCESS == php_stream_context_get_option(context, "http", "header", &ctx_opt) && Z_TYPE_PP(ctx_opt) == IS_ARRAY) {
HashPosition pos;
zval **header = NULL;
struct curl_slist *hl = NULL;
for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(ctx_opt), &pos);
SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(ctx_opt), (void *)&header, &pos);
zend_hash_move_forward_ex(Z_ARRVAL_PP(ctx_opt), &pos)
) {
if (Z_TYPE_PP(header) == IS_STRING) {
slist = curl_slist_append(slist, Z_STRVAL_PP(header));
}
for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(ctx_opt), &pos);
SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(ctx_opt), (void *)&header, &pos);
zend_hash_move_forward_ex(Z_ARRVAL_PP(ctx_opt), &pos)) {
if (Z_TYPE_PP(header) == IS_STRING) {
hl = curl_slist_append(hl, Z_STRVAL_PP(header));
}
} else if (Z_TYPE_PP(ctx_opt) == IS_STRING && Z_STRLEN_PP(ctx_opt)) {
char *p, *token, *trimmed, *copy_ctx_opt;
copy_ctx_opt = php_trim(Z_STRVAL_PP(ctx_opt), Z_STRLEN_PP(ctx_opt), NULL, 0, NULL, 3 TSRMLS_CC);
p = php_strtok_r(copy_ctx_opt, "\r\n", &token);
while (p) {
trimmed = php_trim(p, strlen(p), NULL, 0, NULL, 3 TSRMLS_CC);
slist = curl_slist_append(slist, trimmed);
efree(trimmed);
p = php_strtok_r(NULL, "\r\n", &token);
}
efree(copy_ctx_opt);
}
if (slist) {
curl_easy_setopt(curlstream->curl, CURLOPT_HTTPHEADER, slist);
if (hl) {
curl_easy_setopt(curlstream->curl, CURLOPT_HTTPHEADER, hl);
}
}
if (SUCCESS == php_stream_context_get_option(context, "http", "method", &ctx_opt) && Z_TYPE_PP(ctx_opt) == IS_STRING) {
@@ -492,9 +467,7 @@ php_stream *php_curl_stream_opener(php_stream_wrapper *wrapper, char *filename,
return NULL;
}
}
if (slist) {
curl_slist_free_all(slist);
}
return stream;
}
-2
View File
@@ -1,7 +1,5 @@
--TEST--
Bug #45161 (Reusing a curl handle leaks memory)
--SKIPIF--
<?php $curl_version = curl_version(); if ($curl_version['version_number'] < 0x071100) die("skip: test works only with curl >= 7.17.0"); ?>
--FILE--
<?php
-27
View File
@@ -1,27 +0,0 @@
--TEST--
Bug #46711 (lost memory when foreach is used for values passed to curl_setopt())
--FILE--
<?php
$ch = curl_init();
$opt = array(
CURLOPT_AUTOREFERER => TRUE,
CURLOPT_BINARYTRANSFER => TRUE
);
curl_setopt( $ch, CURLOPT_AUTOREFERER , TRUE );
foreach( $opt as $option => $value ) {
curl_setopt( $ch, $option, $value );
}
var_dump($opt); // with this bug, $opt[58] becomes NULL
?>
--EXPECT--
array(2) {
[58]=>
bool(true)
[19914]=>
bool(true)
}
-24
View File
@@ -1,24 +0,0 @@
--TEST--
Bug #48203 (Crash when CURLOPT_STDERR is set to regular file)
--FILE--
<?php
$fp = fopen(dirname(__FILE__) . '/bug48203.tmp', 'w');
$ch = curl_init();
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_STDERR, $fp);
curl_setopt($ch, CURLOPT_URL, "");
fclose($fp); // <-- premature close of $fp caused a crash!
curl_exec($ch);
echo "Ok\n";
?>
--CLEAN--
<?php @unlink(dirname(__FILE__) . '/bug48203.tmp'); ?>
--EXPECT--
Ok
-45
View File
@@ -1,45 +0,0 @@
--TEST--
Test curl_exec() function with basic functionality
--CREDITS--
Sebastian Deutsch <sebastian.deutsch@9elements.com>
TestFest 2009 - AFUP - Jean-Marc Fontaine <jmf@durcommefaire.net>
--SKIPIF--
<?php
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
?>
--FILE--
<?php
/* Prototype : bool curl_exec(resource ch)
* Description: Perform a cURL session
* Source code: ext/curl/interface.c
* Alias to functions:
*/
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
// start testing
echo "*** Testing curl_exec() : basic functionality ***\n";
$url = "{$host}/get.php?test=get";
$ch = curl_init();
ob_start(); // start output buffering
curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
$ok = curl_exec($ch);
curl_close($ch);
$curl_content = ob_get_contents();
ob_end_clean();
if($ok) {
var_dump( $curl_content );
} else {
echo "curl_exec returned false";
}
?>
===DONE===
--EXPECTF--
*** Testing curl_exec() : basic functionality ***
string(25) "Hello World!
Hello World!"
===DONE===
-41
View File
@@ -1,41 +0,0 @@
--TEST--
Test curl_opt() function with CURLOPT_RETURNTRANSFER parameter set to 1
--CREDITS--
Sebastian Deutsch <sebastian.deutsch@9elements.com>
TestFest 2009 - AFUP - Jean-Marc Fontaine <jmf@durcommefaire.net>
--SKIPIF--
<?php
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
?>
--FILE--
<?php
/* Prototype : bool curl_setopt(resource ch, int option, mixed value)
* Description: Set an option for a cURL transfer
* Source code: ext/curl/interface.c
* Alias to functions:
*/
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
// start testing
echo '*** Testing curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); ***' . "\n";
$url = "{$host}/get.php?test=get";
$ch = curl_init();
ob_start(); // start output buffering
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
$curl_content = curl_exec($ch);
curl_close($ch);
var_dump( $curl_content );
?>
===DONE===
--EXPECTF--
*** Testing curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); ***
string(25) "Hello World!
Hello World!"
===DONE===
-56
View File
@@ -1,56 +0,0 @@
--TEST--
Test curl_opt() function with POST parameters
--CREDITS--
Sebastian Deutsch <sebastian.deutsch@9elements.com>
TestFest 2009 - AFUP - Jean-Marc Fontaine <jmf@durcommefaire.net>
--SKIPIF--
<?php
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
?>
--FILE--
<?php
/* Prototype : bool curl_setopt(resource ch, int option, mixed value)
* Description: Set an option for a cURL transfer
* Source code: ext/curl/interface.c
* Alias to functions:
*/
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
// start testing
echo '*** Testing curl sending through GET an POST ***' . "\n";
$url = "{$host}/get.php?test=getpost&get_param=Hello%20World";
$ch = curl_init();
ob_start(); // start output buffering
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "Hello=World&Foo=Bar&Person=John%20Doe");
curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
$curl_content = curl_exec($ch);
curl_close($ch);
var_dump( $curl_content );
?>
===DONE===
--EXPECTF--
*** Testing curl sending through GET an POST ***
string(208) "array(2) {
["test"]=>
string(7) "getpost"
["get_param"]=>
string(11) "Hello World"
}
array(3) {
["Hello"]=>
string(5) "World"
["Foo"]=>
string(3) "Bar"
["Person"]=>
string(8) "John Doe"
}
"
===DONE===
-41
View File
@@ -1,41 +0,0 @@
--TEST--
Test curl_opt() function with setting referer
--CREDITS--
Sebastian Deutsch <sebastian.deutsch@9elements.com>
TestFest 2009 - AFUP - Jean-Marc Fontaine <jmf@durcommefaire.net>
--SKIPIF--
<?php
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
?>
--FILE--
<?php
/* Prototype : bool curl_setopt(resource ch, int option, mixed value)
* Description: Set an option for a cURL transfer
* Source code: ext/curl/interface.c
* Alias to functions:
*/
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
// start testing
echo '*** Testing curl setting referer ***' . "\n";
$url = "{$host}/get.php?test=referer";
$ch = curl_init();
ob_start(); // start output buffering
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, 'http://www.refer.er');
curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
$curl_content = curl_exec($ch);
curl_close($ch);
var_dump( $curl_content );
?>
===DONE===
--EXPECTF--
*** Testing curl setting referer ***
string(19) "http://www.refer.er"
===DONE===
-41
View File
@@ -1,41 +0,0 @@
--TEST--
Test curl_opt() function with user agent
--CREDITS--
Sebastian Deutsch <sebastian.deutsch@9elements.com>
TestFest 2009 - AFUP - Jean-Marc Fontaine <jmf@durcommefaire.net>
--SKIPIF--
<?php
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
?>
--FILE--
<?php
/* Prototype : bool curl_setopt(resource ch, int option, mixed value)
* Description: Set an option for a cURL transfer
* Source code: ext/curl/interface.c
* Alias to functions:
*/
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
// start testing
echo '*** Testing curl with user agent ***' . "\n";
$url = "{$host}/get.php?test=useragent";
$ch = curl_init();
ob_start(); // start output buffering
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'cURL phpt');
curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
$curl_content = curl_exec($ch);
curl_close($ch);
var_dump( $curl_content );
?>
===DONE===
--EXPECTF--
*** Testing curl with user agent ***
string(9) "cURL phpt"
===DONE===
-24
View File
@@ -1,24 +0,0 @@
--TEST--
Test curl_error() & curl_errno() function without url
--CREDITS--
TestFest 2009 - AFUP - Perrick Penet <perrick@noparking.net>
--SKIPIF--
<?php if (!extension_loaded("curl")) print "skip"; ?>
--FILE--
<?php
//In January 2008 , level 7.18.0 of the curl lib, many of the messages changed.
//The final crlf was removed. This test is coded to work with or without the crlf.
$ch = curl_init();
curl_exec($ch);
var_dump(curl_error($ch));
var_dump(curl_errno($ch));
curl_close($ch);
?>
--EXPECTF--
%string|unicode%(%d) "No URL set!%w"
int(3)
-23
View File
@@ -1,23 +0,0 @@
--TEST--
Test curl_error() & curl_errno() function with problematic host
--CREDITS--
TestFest 2009 - AFUP - Perrick Penet <perrick@noparking.net>
--SKIPIF--
<?php if (!extension_loaded("curl")) print "skip"; ?>
--FILE--
<?php
$url = "http://www.".uniqid().".".uniqid();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_exec($ch);
var_dump(curl_error($ch));
var_dump(curl_errno($ch));
curl_close($ch);
?>
--EXPECTF--
%unicode|string%(%d) "%r(Couldn't resolve host|Could not resolve host:)%r %Swww.%s"
int(6)
-23
View File
@@ -1,23 +0,0 @@
--TEST--
Test curl_error() & curl_errno() function with problematic protocol
--CREDITS--
TestFest 2009 - AFUP - Perrick Penet <perrick@noparking.net>
--SKIPIF--
<?php if (!extension_loaded("curl")) print "skip"; ?>
--FILE--
<?php
$url = uniqid()."://www.".uniqid().".".uniqid();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_exec($ch);
var_dump(curl_error($ch));
var_dump(curl_errno($ch));
curl_close($ch);
?>
--EXPECTF--
%unicode|string%(%d) "%Srotocol%s"
int(1)
-24
View File
@@ -1,24 +0,0 @@
--TEST--
Test curl_error() & curl_errno() function with problematic proxy
--CREDITS--
TestFest 2009 - AFUP - Perrick Penet <perrick@noparking.net>
--SKIPIF--
<?php if (!extension_loaded("curl")) print "skip"; ?>
--FILE--
<?php
$url = "http://www.example.org";
$ch = curl_init();
curl_setopt($ch, CURLOPT_PROXY, uniqid().":".uniqid());
curl_setopt($ch, CURLOPT_URL, $url);
curl_exec($ch);
var_dump(curl_error($ch));
var_dump(curl_errno($ch));
curl_close($ch);
?>
--EXPECTF--
%unicode|string%(%d) "%r(Couldn't resolve proxy|Could not resolve proxy:)%r %s"
int(5)
-38
View File
@@ -1,38 +0,0 @@
--TEST--
Test curl_opt() function with COOKIE
--CREDITS--
TestFest 2009 - AFUP - Xavier Gorse <xgorse@elao.com>
--SKIPIF--
<?php if (!extension_loaded("curl") || false === getenv(b'PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
--FILE--
<?php
/* Prototype : bool curl_setopt(resource ch, int option, mixed value)
* Description: Set an option for a cURL transfer
* Source code: ext/curl/interface.c
* Alias to functions:
*/
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
// start testing
echo '*** Testing curl with cookie ***' . "\n";
$url = "{$host}/get.php?test=cookie";
$ch = curl_init();
ob_start(); // start output buffering
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIE, 'foo=bar');
curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
$curl_content = curl_exec($ch);
curl_close($ch);
var_dump( $curl_content );
?>
===DONE===
--EXPECTF--
*** Testing curl with cookie ***
string(3) "bar"
===DONE===
-38
View File
@@ -1,38 +0,0 @@
--TEST--
Test curl_opt() function with CURLOPT_HTTP_VERSION/CURL_HTTP_VERSION_1_0
--CREDITS--
TestFest 2009 - AFUP - Xavier Gorse <xgorse@elao.com>
--SKIPIF--
<?php if (!extension_loaded("curl") || false === getenv(b'PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
--FILE--
<?php
/* Prototype : bool curl_setopt(resource ch, int option, mixed value)
* Description: Set an option for a cURL transfer
* Source code: ext/curl/interface.c
* Alias to functions:
*/
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
// start testing
echo '*** Testing curl with HTTP/1.0 ***' . "\n";
$url = "{$host}/get.php?test=httpversion";
$ch = curl_init();
ob_start(); // start output buffering
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
$curl_content = curl_exec($ch);
curl_close($ch);
var_dump( $curl_content );
?>
===DONE===
--EXPECTF--
*** Testing curl with HTTP/1.0 ***
string(8) "HTTP/1.0"
===DONE===
-38
View File
@@ -1,38 +0,0 @@
--TEST--
Test curl_opt() function with CURLOPT_HTTP_VERSION/CURL_HTTP_VERSION_1_1
--CREDITS--
TestFest 2009 - AFUP - Xavier Gorse <xgorse@elao.com>
--SKIPIF--
<?php if (!extension_loaded("curl") || false === getenv(b'PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
--FILE--
<?php
/* Prototype : bool curl_setopt(resource ch, int option, mixed value)
* Description: Set an option for a cURL transfer
* Source code: ext/curl/interface.c
* Alias to functions:
*/
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
// start testing
echo '*** Testing curl with HTTP/1.1 ***' . "\n";
$url = "{$host}/get.php?test=httpversion";
$ch = curl_init();
ob_start(); // start output buffering
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
$curl_content = curl_exec($ch);
curl_close($ch);
var_dump( $curl_content );
?>
===DONE===
--EXPECTF--
*** Testing curl with HTTP/1.1 ***
string(8) "HTTP/1.1"
===DONE===
-15
View File
@@ -1,15 +0,0 @@
--TEST--
Test curl_init() function with basic functionality
--CREDITS--
Jean-Marc Fontaine <jmf@durcommefaire.net>
--SKIPIF--
<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded"); ?>
--FILE--
<?php
$ch = curl_init();
var_dump($ch);
?>
===DONE===
--EXPECTF--
resource(%d) of type (curl)
===DONE===
-16
View File
@@ -1,16 +0,0 @@
--TEST--
Test curl_init() function with $url parameter defined
--CREDITS--
Jean-Marc Fontaine <jmf@durcommefaire.net>
--SKIPIF--
<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded"); ?>
--FILE--
<?php
$url = 'http://www.example.com/';
$ch = curl_init($url);
var_dump($url == curl_getinfo($ch, CURLINFO_EFFECTIVE_URL));
?>
===DONE===
--EXPECTF--
bool(true)
===DONE===
-57
View File
@@ -1,57 +0,0 @@
--TEST--
Test curl_getinfo() function with basic functionality
--CREDITS--
Jean-Marc Fontaine <jmf@durcommefaire.net>
--SKIPIF--
<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded"); ?>
--FILE--
<?php
$ch = curl_init();
$info = curl_getinfo($ch);
var_dump($info);
?>
===DONE===
--EXPECTF--
array(20) {
[%u|b%"url"]=>
string(0) ""
["content_type"]=>
NULL
["http_code"]=>
int(0)
["header_size"]=>
int(0)
["request_size"]=>
int(0)
["filetime"]=>
int(0)
["ssl_verify_result"]=>
int(0)
["redirect_count"]=>
int(0)
["total_time"]=>
float(0)
["namelookup_time"]=>
float(0)
["connect_time"]=>
float(0)
["pretransfer_time"]=>
float(0)
["size_upload"]=>
float(0)
["size_download"]=>
float(0)
["speed_download"]=>
float(0)
["speed_upload"]=>
float(0)
["download_content_length"]=>
float(%f)
["upload_content_length"]=>
float(%f)
["starttransfer_time"]=>
float(0)
["redirect_time"]=>
float(0)
}
===DONE===
-69
View File
@@ -1,69 +0,0 @@
--TEST--
Test curl_multi_exec() function with basic functionality
--CREDITS--
TestFest 2009 - AFUP - Thomas Rabaix <thomas.rabaix@gmail.com>
--SKIPIF--
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
--FILE--
<?php
/* Prototype : bool curl_multi_exec(resource ch)
* Description: Perform a cURL session
* Source code: ext/curl/multi.c
* Alias to functions:
*/
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
// start testing
echo "*** Testing curl_exec() : basic functionality ***\n";
$url = "{$host}/get.php?test=get";
$chs = array(
0 => curl_init(),
1 => curl_init(),
2 => curl_init(),
);
ob_start(); // start output buffering
curl_setopt($chs[0], CURLOPT_URL, $url); //set the url we want to use
curl_setopt($chs[1], CURLOPT_URL, $url); //set the url we want to use
curl_setopt($chs[2], CURLOPT_URL, $url); //set the url we want to use
$mh = curl_multi_init();
// add handlers
curl_multi_add_handle($mh, $chs[0]);
curl_multi_add_handle($mh, $chs[1]);
curl_multi_add_handle($mh, $chs[2]);
$running=null;
//execute the handles
$state = null;
do {
$state = curl_multi_exec($mh, $running);
} while ($running > 0);
//close the handles
curl_multi_remove_handle($mh, $chs[0]);
curl_multi_remove_handle($mh, $chs[1]);
curl_multi_remove_handle($mh, $chs[2]);
curl_multi_close($mh);
$curl_content = ob_get_contents();
ob_end_clean();
if($state === CURLM_OK) {
var_dump( $curl_content );
} else {
echo "curl_exec returned false";
}
?>
===DONE===
--EXPECTF--
*** Testing curl_exec() : basic functionality ***
string(75) "Hello World!
Hello World!Hello World!
Hello World!Hello World!
Hello World!"
===DONE===
-72
View File
@@ -1,72 +0,0 @@
--TEST--
Test curl_setopt() with curl_multi function with basic functionality
--CREDITS--
TestFest 2009 - AFUP - Thomas Rabaix <thomas.rabaix@gmail.com>
--SKIPIF--
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
--FILE--
<?php
/* Prototype : bool curl_setopt(resource ch, int option, mixed value)
* Description: Set an option for a cURL transfer
* Source code: ext/curl/interface.c
* Alias to functions:
*/
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
// start testing
echo "*** Testing curl_exec() : basic functionality ***\n";
$url = "{$host}/get.php?test=get";
$chs = array(
0 => curl_init(),
1 => curl_init(),
2 => curl_init(),
);
ob_start(); // start output buffering
$options = array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $url,
);
curl_setopt_array($chs[0], $options); //set the options
curl_setopt_array($chs[1], $options); //set the options
curl_setopt_array($chs[2], $options); //set the options
$mh = curl_multi_init();
// add handlers
curl_multi_add_handle($mh, $chs[0]);
curl_multi_add_handle($mh, $chs[1]);
curl_multi_add_handle($mh, $chs[2]);
$running=null;
//execute the handles
do {
curl_multi_exec($mh, $running);
} while ($running > 0);
$curl_content = '';
$curl_content .= curl_multi_getcontent($chs[0]);
$curl_content .= curl_multi_getcontent($chs[1]);
$curl_content .= curl_multi_getcontent($chs[2]);
//close the handles
curl_multi_remove_handle($mh, $chs[0]);
curl_multi_remove_handle($mh, $chs[1]);
curl_multi_remove_handle($mh, $chs[2]);
curl_multi_close($mh);
var_dump( $curl_content );
?>
===DONE===
--EXPECTF--
*** Testing curl_exec() : basic functionality ***
%unicode|string%(75) "Hello World!
Hello World!Hello World!
Hello World!Hello World!
Hello World!"
===DONE===
-28
View File
@@ -1,28 +0,0 @@
--TEST--
Test curl_getinfo() function with CURLINFO_EFFECTIVE_URL parameter
--CREDITS--
Jean-Marc Fontaine <jmf@durcommefaire.net>
--SKIPIF--
<?php
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
?>
--FILE--
<?php
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
$url = "{$host}/get.php?test=";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_exec($ch);
$info = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
var_dump($url == $info);
curl_close($ch);
?>
===DONE===
--EXPECTF--
Hello World!
Hello World!bool(true)
===DONE===
-25
View File
@@ -1,25 +0,0 @@
--TEST--
Test curl_getinfo() function with CURLINFO_HTTP_CODE parameter
--CREDITS--
Jean-Marc Fontaine <jmf@durcommefaire.net>
--SKIPIF--
<?php
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
?>
--FILE--
<?php
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
$url = "{$host}/get.php?test=";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_exec($ch);
var_dump(curl_getinfo($ch, CURLINFO_HTTP_CODE));
curl_close($ch);
?>
===DONE===
--EXPECTF--
Hello World!
Hello World!int(200)
===DONE===
-24
View File
@@ -1,24 +0,0 @@
--TEST--
Test curl_getinfo() function with CURLINFO_CONTENT_TYPE parameter
--CREDITS--
Jean-Marc Fontaine <jmf@durcommefaire.net>
--SKIPIF--
<?php
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
?>
--FILE--
<?php
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
$url = "{$host}/get.php?test=contenttype";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_exec($ch);
var_dump(curl_getinfo($ch, CURLINFO_CONTENT_TYPE));
curl_close($ch);
?>
===DONE===
--EXPECTF--
%unicode|string%(24) "text/plain;charset=utf-8"
===DONE===
-30
View File
@@ -1,30 +0,0 @@
<?php
switch($_GET['test']) {
case 'getpost':
var_dump($_GET);
var_dump($_POST);
break;
case 'referer':
echo $_SERVER['HTTP_REFERER'];
break;
case 'useragent':
echo $_SERVER['HTTP_USER_AGENT'];
break;
case 'httpversion':
echo $_SERVER['SERVER_PROTOCOL'];
break;
case 'cookie':
echo $_COOKIE['foo'];
break;
case 'encoding':
echo $_SERVER['HTTP_ACCEPT_ENCODING'];
break;
case 'contenttype':
header('Content-Type: text/plain;charset=utf-8');
break;
default:
echo "Hello World!\n";
echo "Hello World!";
break;
}
?>
File renamed without changes.
-3
View File
@@ -200,9 +200,6 @@ typedef struct _timelib_tzdb {
#define SECS_PER_DAY 86400
#define DAYS_PER_YEAR 365
#define DAYS_PER_LYEAR 366
/* 400*365 days + 97 leap days */
#define DAYS_PER_LYEAR_PERIOD 146097
#define YEARS_PER_LYEAR_PERIOD 400
#define timelib_is_leap(y) ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0))
+1299 -1321
View File
File diff suppressed because it is too large. Load diff
+12 -10
View File
@@ -31,12 +31,20 @@ static int days_in_month[13] = { 31, 31, 28, 31, 30, 31, 30, 31, 3
static int do_range_limit(timelib_sll start, timelib_sll end, timelib_sll adj, timelib_sll *a, timelib_sll *b)
{
if (*a < start) {
*b -= (start - *a - 1) / adj + 1;
*a += adj * ((start - *a - 1) / adj + 1);
*a += adj;
(*b)--;
return 1;
}
if (*a >= end) {
*b += *a / adj;
*a -= adj * (*a / adj);
if (start == 0) {
(*b) += (*a / end);
(*a) -= (end * (*a / end));
return 0;
}
*a -= adj;
(*b)++;
return 1;
}
return 0;
}
@@ -47,12 +55,6 @@ static int do_range_limit_days(timelib_sll *y, timelib_sll *m, timelib_sll *d)
timelib_sll days_this_month;
timelib_sll last_month, last_year;
timelib_sll days_last_month;
/* can jump an entire leap year period quickly */
if (*d >= DAYS_PER_LYEAR_PERIOD || *d <= -DAYS_PER_LYEAR_PERIOD) {
*y += YEARS_PER_LYEAR_PERIOD * (*d / DAYS_PER_LYEAR_PERIOD);
*d -= DAYS_PER_LYEAR_PERIOD * (*d / DAYS_PER_LYEAR_PERIOD);
}
do_range_limit(1, 13, 12, m, y);
+14 -25
View File
@@ -30,14 +30,6 @@
#include "lib/timelib.h"
#include <time.h>
#ifdef PHP_WIN32
static __inline __int64 llabs( __int64 i ) { return i >= 0? i: -i; }
#endif
#if defined(__GNUC__) && __GNUC__ < 3
static __inline __int64_t llabs( __int64_t i ) { return i >= 0 ? i : -i; }
#endif
/* {{{ arginfo */
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_date, 0, 0, 1)
@@ -320,11 +312,17 @@ static zend_object_value date_object_clone_date(zval *this_ptr TSRMLS_DC);
static int date_object_compare_date(zval *d1, zval *d2 TSRMLS_DC);
static zend_object_value date_object_clone_timezone(zval *this_ptr TSRMLS_DC);
/* This is need to ensure that session extension request shutdown occurs 1st, because it uses the date extension */
static zend_module_dep date_deps[] = {
ZEND_MOD_OPTIONAL("session")
{NULL, NULL, NULL}
};
/* {{{ Module struct */
zend_module_entry date_module_entry = {
STANDARD_MODULE_HEADER_EX,
NULL,
NULL,
date_deps,
"date", /* extension name */
date_functions, /* function list */
PHP_MINIT(date), /* process startup */
@@ -347,7 +345,6 @@ static PHP_GINIT_FUNCTION(date)
{
date_globals->default_timezone = NULL;
date_globals->timezone = NULL;
date_globals->tzcache = NULL;
}
/* }}} */
@@ -366,7 +363,7 @@ PHP_RINIT_FUNCTION(date)
efree(DATEG(timezone));
}
DATEG(timezone) = NULL;
DATEG(tzcache) = NULL;
zend_hash_init(&DATEG(tzcache), 4, NULL, _php_date_tzinfo_dtor, 0);
return SUCCESS;
}
@@ -379,11 +376,8 @@ PHP_RSHUTDOWN_FUNCTION(date)
efree(DATEG(timezone));
}
DATEG(timezone) = NULL;
if(DATEG(tzcache)) {
zend_hash_destroy(DATEG(tzcache));
FREE_HASHTABLE(DATEG(tzcache));
DATEG(tzcache) = NULL;
}
zend_hash_destroy(&DATEG(tzcache));
return SUCCESS;
}
/* }}} */
@@ -560,18 +554,13 @@ static timelib_tzinfo *php_date_parse_tzfile(char *formal_tzname, const timelib_
{
timelib_tzinfo *tzi, **ptzi;
if(!DATEG(tzcache)) {
ALLOC_HASHTABLE(DATEG(tzcache));
zend_hash_init(DATEG(tzcache), 4, NULL, _php_date_tzinfo_dtor, 0);
}
if (zend_hash_find(DATEG(tzcache), formal_tzname, strlen(formal_tzname) + 1, (void **) &ptzi) == SUCCESS) {
if (zend_hash_find(&DATEG(tzcache), formal_tzname, strlen(formal_tzname) + 1, (void **) &ptzi) == SUCCESS) {
return *ptzi;
}
tzi = timelib_parse_tzfile(formal_tzname, tzdb);
if (tzi) {
zend_hash_add(DATEG(tzcache), formal_tzname, strlen(formal_tzname) + 1, (void *) &tzi, sizeof(timelib_tzinfo*), NULL);
zend_hash_add(&DATEG(tzcache), formal_tzname, strlen(formal_tzname) + 1, (void *) &tzi, sizeof(timelib_tzinfo*), NULL);
}
return tzi;
}
@@ -667,7 +656,7 @@ PHPAPI timelib_tzinfo *get_timezone_info(TSRMLS_D)
{
char *tz;
timelib_tzinfo *tzi;
tz = guess_timezone(DATE_TIMEZONEDB TSRMLS_CC);
tzi = php_date_parse_tzfile(tz, DATE_TIMEZONEDB TSRMLS_CC);
if (! tzi) {
@@ -798,7 +787,7 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
/* year */
case 'L': length = slprintf(buffer, 32, "%d", timelib_is_leap((int) t->y)); break;
case 'y': length = slprintf(buffer, 32, "%02d", (int) t->y % 100); break;
case 'Y': length = slprintf(buffer, 32, "%s%04ld", t->y < 0 ? "-" : "", llabs(t->y)); break;
case 'Y': length = slprintf(buffer, 32, "%s%04d", t->y < 0 ? "-" : "", abs((int) t->y)); break;
/* time */
case 'a': length = slprintf(buffer, 32, "%s", t->h >= 12 ? "pm" : "am"); break;
+1 -1
View File
@@ -87,7 +87,7 @@ PHP_MINFO_FUNCTION(date);
ZEND_BEGIN_MODULE_GLOBALS(date)
char *default_timezone;
char *timezone;
HashTable *tzcache;
HashTable tzcache;
ZEND_END_MODULE_GLOBALS(date)
#ifdef ZTS
@@ -1,39 +0,0 @@
--TEST--
Test clone on DateTimeZone objects
--FILE--
<?php
//Set the default time zone
date_default_timezone_set('Europe/London');
echo "*** Testing clone on DateTime objects ***\n";
// Create a DateTimeZone object..
$orig = new DateTimeZone("GMT");
// ..create a clone of it ..Clone
$clone = clone $orig;
var_dump($orig);
var_dump($clone);
if ($clone != $orig) {
echo "TEST FAILED : objects not equal\n";
}else if ($clone === $orig) {
echo "TEST FAILED : objects identical\n";
} else {
echo "TEST PASSED : Objects equal but not indetical\n";
}
?>
===DONE===
--EXPECTF--
*** Testing clone on DateTime objects ***
object(DateTimeZone)#%d (0) {
}
object(DateTimeZone)#%d (0) {
}
TEST PASSED : Objects equal but not indetical
===DONE===
@@ -1,66 +0,0 @@
--TEST--
Testing clone on objects whoose class derived from DateTimeZone class
--FILE--
<?php
//Set the default time zone
date_default_timezone_set("Europe/London");
class DateTimeZoneExt1 extends DateTimeZone {
public $property1 = 99;
public $property2 = "Hello";
}
class DateTimeZoneExt2 extends DateTimeZoneExt1 {
public $property3 = true;
public $property4 = 10.5;
}
echo "*** Testing clone on objects whoose class derived from DateTimeZone class ***\n";
$d1 = new DateTimeZoneExt1("Europe/London");
var_dump($d1);
$d1_clone = clone $d1;
var_dump($d1_clone);
$d2 = new DateTimeZoneExt2("Europe/London");
var_dump($d2);
$d2_clone = clone $d2;
var_dump($d2_clone);
?>
===DONE===
--EXPECTF--
*** Testing clone on objects whoose class derived from DateTimeZone class ***
object(DateTimeZoneExt1)#%d (2) {
["property1"]=>
int(99)
["property2"]=>
string(5) "Hello"
}
object(DateTimeZoneExt1)#%d (2) {
["property1"]=>
int(99)
["property2"]=>
string(5) "Hello"
}
object(DateTimeZoneExt2)#%d (4) {
["property3"]=>
bool(true)
["property4"]=>
float(10.5)
["property1"]=>
int(99)
["property2"]=>
string(5) "Hello"
}
object(DateTimeZoneExt2)#%d (4) {
["property3"]=>
bool(true)
["property4"]=>
float(10.5)
["property1"]=>
int(99)
["property2"]=>
string(5) "Hello"
}
===DONE===
@@ -1,75 +0,0 @@
--TEST--
Test clone of DateTimeZOne objects
--FILE--
<?php
//Set the default time zone
date_default_timezone_set("Europe/London");
echo "*** Testing clone on DateTime objects ***\n";
echo "\n-- Create a DateTimeZone object --\n";
$d1 = new DateTimeZone("Europe/London");
var_dump($d1);
echo "\n-- Add some properties --\n";
$d1->property1 = 99;
$d1->property2 = "Hello";
var_dump($d1);
echo "\n-- clone it --\n";
$d1_clone = clone $d1;
var_dump($d1_clone);
echo "\n-- Add some more properties --\n";
$d1_clone->property3 = true;
$d1_clone->property4 = 10.5;
var_dump($d1_clone);
echo "\n-- clone it --\n";
$d2_clone = clone $d1_clone;
var_dump($d2_clone);
?>
===DONE===
--EXPECTF--
*** Testing clone on DateTime objects ***
-- Create a DateTimeZone object --
object(DateTimeZone)#%d (0) {
}
-- Add some properties --
object(DateTimeZone)#%d (2) {
["property1"]=>
int(99)
["property2"]=>
string(5) "Hello"
}
-- clone it --
object(DateTimeZone)#%d (2) {
["property1"]=>
int(99)
["property2"]=>
string(5) "Hello"
}
-- Add some more properties --
object(DateTimeZone)#%d (4) {
["property1"]=>
int(99)
["property2"]=>
string(5) "Hello"
["property3"]=>
bool(true)
["property4"]=>
float(10.5)
}
-- clone it --
object(DateTimeZone)#%d (4) {
["property1"]=>
int(99)
["property2"]=>
string(5) "Hello"
["property3"]=>
bool(true)
["property4"]=>
float(10.5)
}
===DONE===
@@ -1,28 +0,0 @@
--TEST--
Test clone of DateTimeZone derived objects with __clone magic method
--FILE--
<?php
//Set the default time zone
date_default_timezone_set("Europe/London");
class DateTimeZoneExt1 extends DateTimeZone {
public function __clone() {
echo "-- DateTimeExt1 __clone magic method called --\n";
}
}
echo "*** Testing clone of objects derived from DateTimeZone class with __clone magic method***\n";
$d1 = new DateTimeZoneExt1("America/New_York");
$d1_clone = clone $d1;
//verify clone by calling method on new object
var_dump( $d1_clone->getName() );
?>
===DONE===
--EXPECTF--
*** Testing clone of objects derived from DateTimeZone class with __clone magic method***
-- DateTimeExt1 __clone magic method called --
string(16) "America/New_York"
===DONE===
@@ -1,54 +0,0 @@
--TEST--
Test of compare object handler for DateTime objects
--FILE--
<?php
// NB: DateTimeZone class does not define a customized compare class handler so standard object handler will be used
echo "Simple test for DateTimeZone compare object handler\n";
//Set the default time zone
date_default_timezone_set("Europe/London");
class DateTimeZoneExt1 extends DateTimeZone {
}
class DateTimeZoneExt2 extends DateTimeZone{
public $foo = "Hello";
private $bar = 99;
}
class DateTimeZoneExt3 extends DateTimeZoneExt2 {
}
$obj1 = new DateTimeZone("Europe/London");
$obj2 = new DateTimeZoneExt1("Europe/London");
$obj3 = new DateTimeZoneExt2("Europe/London");
$obj4 = new DateTimeZoneExt3("Europe/London");
echo "\n-- All the following tests should compare equal --\n";
var_dump($obj1 == $obj1);
echo "\n-- All the following tests should compare NOT equal --\n";
var_dump($obj1 == $obj2);
var_dump($obj1 == $obj3);
var_dump($obj1 == $obj4);
var_dump($obj2 == $obj3);
var_dump($obj2 == $obj4);
var_dump($obj3 == $obj4);
?>
===DONE===
--EXPECT--
Simple test for DateTimeZone compare object handler
-- All the following tests should compare equal --
bool(true)
-- All the following tests should compare NOT equal --
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
===DONE===
@@ -1,30 +0,0 @@
--TEST--
Test new DateTimeZone() : basic functionality
--FILE--
<?php
/* Prototype : DateTimeZone::__construct ( string $timezone )
* Description: Returns new DateTimeZone object
* Source code: ext/date/php_date.c
* Alias to functions:
*/
//Set the default time zone
date_default_timezone_set("Europe/London");
echo "*** Testing new DateTimeZone() : basic functionality ***\n";
var_dump( new DateTimeZone("GMT") );
var_dump( new DateTimeZone("Europe/London") );
var_dump( new DateTimeZone("America/Los_Angeles") );
?>
===DONE===
--EXPECTF--
*** Testing new DateTimeZone() : basic functionality ***
object(DateTimeZone)#%d (0) {
}
object(DateTimeZone)#%d (0) {
}
object(DateTimeZone)#%d (0) {
}
===DONE===
@@ -1,33 +0,0 @@
--TEST--
Test new DateTimeZone() : error conditions
--FILE--
<?php
/* Prototype : DateTimeZone::__construct ( string $timezone )
* Description: Returns new DateTimeZone object
* Source code: ext/date/php_date.c
* Alias to functions:
*/
//Set the default time zone
date_default_timezone_set("GMT");
echo "*** Testing DateTimeZone() : error conditions ***\n";
echo "\n-- Testing new DateTimeZone() with more than expected no. of arguments --\n";
$timezone = "GMT";
$extra_arg = 99;
var_dump( new DateTimeZone($timezone, $extra_arg) );
?>
===DONE===
--EXPECTF--
*** Testing DateTimeZone() : error conditions ***
-- Testing new DateTimeZone() with more than expected no. of arguments --
Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct() expects exactly 1 parameter, 2 given' in %s:%d
Stack trace:
#0 %s(%d): DateTimeZone->__construct('GMT', 99)
#1 {main}
thrown in %s on line %d
@@ -1,200 +0,0 @@
--TEST--
Test DateTime::__construct() function : usage variation - Passing unexpected values to first argument $timezone.
--FILE--
<?php
/* Prototype : DateTimeZone::__construct ( string $timezone )
* Description: Returns new DateTimeZone object
* Source code: ext/date/php_date.c
* Alias to functions:
*/
echo "*** Testing DateTime::__construct() : usage variation - unexpected values to first argument \$timezone***\n";
//Set the default time zone
date_default_timezone_set("Europe/London");
//get an unset variable
$unset_var = 10;
unset ($unset_var);
// define some classes
class classWithToString
{
public function __toString() {
return "Class A object";
}
}
class classWithoutToString
{
}
// heredoc string
$heredoc = <<<EOT
hello world
EOT;
// add arrays
$index_array = array (1, 2, 3);
$assoc_array = array ('one' => 1, 'two' => 2);
// resource
$file_handle = fopen(__FILE__, 'r');
//array of values to iterate over
$inputs = array(
// int data
'int 0' => 0,
'int 1' => 1,
'int 12345' => 12345,
'int -12345' => -12345,
// float data
'float 10.5' => 10.5,
'float -10.5' => -10.5,
'float .5' => .5,
// array data
'empty array' => array(),
'int indexed array' => $index_array,
'associative array' => $assoc_array,
'nested arrays' => array('foo', $index_array, $assoc_array),
// null data
'uppercase NULL' => NULL,
'lowercase null' => null,
// boolean data
'lowercase true' => true,
'lowercase false' =>false,
'uppercase TRUE' =>TRUE,
'uppercase FALSE' =>FALSE,
// empty data
'empty string DQ' => "",
'empty string SQ' => '',
// string data
'string DQ' => "string",
'string SQ' => 'string',
'mixed case string' => "sTrInG",
'heredoc' => $heredoc,
// object data
'instance of classWithToString' => new classWithToString(),
'instance of classWithoutToString' => new classWithoutToString(),
// undefined data
'undefined var' => @$undefined_var,
// unset data
'unset var' => @$unset_var,
// resource
'resource' => $file_handle
);
foreach($inputs as $variation =>$timezone) {
echo "\n-- $variation --\n";
try {
var_dump( new DateTimezone($timezone) );
} catch(Exception $e) {
$msg = $e->getMessage();
echo "FAILED: " . $msg . "\n";
}
};
// closing the resource
fclose( $file_handle );
?>
===DONE===
--EXPECTF--
*** Testing DateTime::__construct() : usage variation - unexpected values to first argument $timezone***
-- int 0 --
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (0)
-- int 1 --
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (1)
-- int 12345 --
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (12345)
-- int -12345 --
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (-12345)
-- float 10.5 --
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (10.5)
-- float -10.5 --
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (-10.5)
-- float .5 --
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (0.5)
-- empty array --
FAILED: DateTimeZone::__construct() expects parameter 1 to be string, array given
-- int indexed array --
FAILED: DateTimeZone::__construct() expects parameter 1 to be string, array given
-- associative array --
FAILED: DateTimeZone::__construct() expects parameter 1 to be string, array given
-- nested arrays --
FAILED: DateTimeZone::__construct() expects parameter 1 to be string, array given
-- uppercase NULL --
FAILED: DateTimeZone::__construct(): Unknown or bad timezone ()
-- lowercase null --
FAILED: DateTimeZone::__construct(): Unknown or bad timezone ()
-- lowercase true --
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (1)
-- lowercase false --
FAILED: DateTimeZone::__construct(): Unknown or bad timezone ()
-- uppercase TRUE --
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (1)
-- uppercase FALSE --
FAILED: DateTimeZone::__construct(): Unknown or bad timezone ()
-- empty string DQ --
FAILED: DateTimeZone::__construct(): Unknown or bad timezone ()
-- empty string SQ --
FAILED: DateTimeZone::__construct(): Unknown or bad timezone ()
-- string DQ --
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (string)
-- string SQ --
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (string)
-- mixed case string --
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (sTrInG)
-- heredoc --
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (hello world)
-- instance of classWithToString --
FAILED: DateTimeZone::__construct(): Unknown or bad timezone (Class A object)
-- instance of classWithoutToString --
FAILED: DateTimeZone::__construct() expects parameter 1 to be string, object given
-- undefined var --
FAILED: DateTimeZone::__construct(): Unknown or bad timezone ()
-- unset var --
FAILED: DateTimeZone::__construct(): Unknown or bad timezone ()
-- resource --
FAILED: DateTimeZone::__construct() expects parameter 1 to be string, resource given
===DONE===
@@ -1,34 +0,0 @@
--TEST--
Test DateTimeZone class inheritance
--FILE--
<?php
//Set the default time zone
date_default_timezone_set("Europe/London");
echo "*** Testing basic DateTimeZone inheritance() ***\n";
class DateTimeZoneExt extends DateTimeZone
{
public function __toString()
{
return parent::getName();
}
}
echo "\n-- Create an instance of DateTimeZoneExt --\n";
$d = new DateTimeZoneExt("America/Los_Angeles");
echo "\n-- Invoke __toString --\n";
echo $d . "\n";
?>
===DONE===
--EXPECTF--
*** Testing basic DateTimeZone inheritance() ***
-- Create an instance of DateTimeZoneExt --
-- Invoke __toString --
America/Los_Angeles
===DONE===
@@ -1,32 +0,0 @@
--TEST--
Test DateTimeZone::getName() function : basic functionality
--FILE--
<?php
/* Prototype : public string DateTimeZone::getName ( void )
* Description: Returns the name of the timezone
* Source code: ext/date/php_date.c
* Alias to functions: timezone_name_get()
*/
echo "*** Testing DateTimeZone::getName() : basic functionality ***\n";
//Set the default time zone
date_default_timezone_set("GMT");
$tz1 = new DateTimeZone("Europe/London");
var_dump( $tz1->getName() );
$tz2 = new DateTimeZone("America/New_York");
var_dump( $tz2->getName() );
$tz3 = new DateTimeZone("America/Los_Angeles");
var_dump( $tz3->getName() );
?>
===DONE===
--EXPECT--
*** Testing DateTimeZone::getName() : basic functionality ***
string(13) "Europe/London"
string(16) "America/New_York"
string(19) "America/Los_Angeles"
===DONE===
@@ -1,31 +0,0 @@
--TEST--
Test DateTimeZone::getName() function : error conditions
--FILE--
<?php
/* Prototype : public string DateTimeZone::getName ( void )
* Description: Returns the name of the timezone
* Source code: ext/date/php_date.c
* Alias to functions: timezone_name_get()
*/
//Set the default time zone
date_default_timezone_set("GMT");
$tz = new DateTimeZone("Europe/London");
echo "*** Testing DateTimeZone::getName() : error conditions ***\n";
echo "\n-- Testing DateTimeZone::getName() function with more than expected no. of arguments --\n";
$extra_arg = 99;
var_dump( $tz->getName($extra_arg) );
?>
===DONE===
--EXPECTF--
*** Testing DateTimeZone::getName() : error conditions ***
-- Testing DateTimeZone::getName() function with more than expected no. of arguments --
Warning: DateTimeZone::getName() expects exactly 0 parameters, 1 given in %s on line %d
bool(false)
===DONE===
@@ -1,33 +0,0 @@
--TEST--
Test DateTimeZone::getOffset() function : basic functionality
--FILE--
<?php
/* Prototype : int DateTimeZone::getOffset ( DateTime $datetime )
* Description: Returns the timezone offset from GMT
* Source code: ext/date/php_date.c
* Alias to functions: timezone_offset_get()
*/
echo "*** Testing DateTimeZone::getOffset() : basic functionality ***\n";
//Set the default time zone
date_default_timezone_set("GMT");
$tz1 = new DateTimeZone("Europe/London");
$date = new DateTime("GMT");
var_dump( $tz1->getOffset($date) );
$tz2 = new DateTimeZone("America/New_York");
var_dump( $tz2->getOffset($date) );
$tz3 = new DateTimeZone("America/Los_Angeles");
var_dump( $tz3->getOffset($date) );
?>
===DONE===
--EXPECTF--
*** Testing DateTimeZone::getOffset() : basic functionality ***
%rint\(0\)|int\(3600\)%r
%rint\(-18000\)|int\(-14400\)%r
%rint\(-28800\)|int\(-25200\)%r
===DONE===
@@ -1,40 +0,0 @@
--TEST--
Test DateTimeZone::getOffset() function : error conditions
--FILE--
<?php
/* Prototype : int DateTimeZone::getOffset ( DateTime $datetime )
* Description: Returns the timezone offset from GMT
* Source code: ext/date/php_date.c
* Alias to functions: timezone_offset_get()
*/
//Set the default time zone
date_default_timezone_set("GMT");
$tz = new DateTimeZone("Europe/London");
$date = date_create("GMT");
echo "*** Testing DateTimeZone::getOffset() : error conditions ***\n";
echo "\n-- Testing DateTimeZone::getOffset() function with zero arguments --\n";
var_dump( $tz->getOffset() );
echo "\n-- Testing DateTimeZone::getOffset() function with more than expected no. of arguments --\n";
$extra_arg = 99;
var_dump( $tz->getOffset($date, $extra_arg) );
?>
===DONE===
--EXPECTF--
*** Testing DateTimeZone::getOffset() : error conditions ***
-- Testing DateTimeZone::getOffset() function with zero arguments --
Warning: DateTimeZone::getOffset() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
-- Testing DateTimeZone::getOffset() function with more than expected no. of arguments --
Warning: DateTimeZone::getOffset() expects exactly 1 parameter, 2 given in %s on line %d
bool(false)
===DONE===
@@ -1,252 +0,0 @@
--TEST--
Test DateTimeZone::getOffset() function : usage variation - Passing unexpected values to first argument $datetime.
--FILE--
<?php
/* Prototype : int DateTimeZone::getOffset ( DateTime $datetime )
* Description: Returns the timezone offset from GMT
* Source code: ext/date/php_date.c
* Alias to functions: timezone_offset_get()
*/
echo "*** Testing DateTimeZone::getOffset() : usage variation - unexpected values to first argument \$datetime***\n";
//Set the default time zone
date_default_timezone_set("Europe/London");
//get an unset variable
$unset_var = 10;
unset ($unset_var);
// define some classes
class classWithToString
{
public function __toString() {
return "Class A object";
}
}
class classWithoutToString
{
}
// heredoc string
$heredoc = <<<EOT
hello world
EOT;
// add arrays
$index_array = array (1, 2, 3);
$assoc_array = array ('one' => 1, 'two' => 2);
// resource
$file_handle = fopen(__FILE__, 'r');
//array of values to iterate over
$inputs = array(
// int data
'int 0' => 0,
'int 1' => 1,
'int 12345' => 12345,
'int -12345' => -12345,
// float data
'float 10.5' => 10.5,
'float -10.5' => -10.5,
'float .5' => .5,
// array data
'empty array' => array(),
'int indexed array' => $index_array,
'associative array' => $assoc_array,
'nested arrays' => array('foo', $index_array, $assoc_array),
// null data
'uppercase NULL' => NULL,
'lowercase null' => null,
// boolean data
'lowercase true' => true,
'lowercase false' =>false,
'uppercase TRUE' =>TRUE,
'uppercase FALSE' =>FALSE,
// empty data
'empty string DQ' => "",
'empty string SQ' => '',
// string data
'string DQ' => "string",
'string SQ' => 'string',
'mixed case string' => "sTrInG",
'heredoc' => $heredoc,
// object data
'instance of classWithToString' => new classWithToString(),
'instance of classWithoutToString' => new classWithoutToString(),
// undefined data
'undefined var' => @$undefined_var,
// unset data
'unset var' => @$unset_var,
// resource
'resource' => $file_handle
);
$timezone = new DateTimezone("Europe/London");
foreach($inputs as $variation =>$datetime) {
echo "\n-- $variation --\n";
var_dump( $timezone->getOffset($datetime) );
};
// closing the resource
fclose( $file_handle );
?>
===DONE===
--EXPECTF--
*** Testing DateTimeZone::getOffset() : usage variation - unexpected values to first argument $datetime***
-- int 0 --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, integer given in %s on line %d
bool(false)
-- int 1 --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, integer given in %s on line %d
bool(false)
-- int 12345 --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, integer given in %s on line %d
bool(false)
-- int -12345 --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, integer given in %s on line %d
bool(false)
-- float 10.5 --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, double given in %s on line %d
bool(false)
-- float -10.5 --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, double given in %s on line %d
bool(false)
-- float .5 --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, double given in %s on line %d
bool(false)
-- empty array --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, array given in %s on line %d
bool(false)
-- int indexed array --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, array given in %s on line %d
bool(false)
-- associative array --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, array given in %s on line %d
bool(false)
-- nested arrays --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, array given in %s on line %d
bool(false)
-- uppercase NULL --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, null given in %s on line %d
bool(false)
-- lowercase null --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, null given in %s on line %d
bool(false)
-- lowercase true --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, boolean given in %s on line %d
bool(false)
-- lowercase false --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, boolean given in %s on line %d
bool(false)
-- uppercase TRUE --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, boolean given in %s on line %d
bool(false)
-- uppercase FALSE --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, boolean given in %s on line %d
bool(false)
-- empty string DQ --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d
bool(false)
-- empty string SQ --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d
bool(false)
-- string DQ --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d
bool(false)
-- string SQ --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d
bool(false)
-- mixed case string --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d
bool(false)
-- heredoc --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d
bool(false)
-- instance of classWithToString --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, object given in %s on line %d
bool(false)
-- instance of classWithoutToString --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, object given in %s on line %d
bool(false)
-- undefined var --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, null given in %s on line %d
bool(false)
-- unset var --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, null given in %s on line %d
bool(false)
-- resource --
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, resource given in %s on line %d
bool(false)
===DONE===
@@ -1,50 +0,0 @@
--TEST--
Test DateTimeZone::getTransitions() function : basic functionality
--FILE--
<?php
/* Prototype : array DateTimeZone::getTransitions ()
* Description: Returns all transitions for the timezone
* Source code: ext/date/php_date.c
* Alias to functions: timezone_transitions_get()
*/
echo "*** Testing DateTimeZone::getTransitions() : basic functionality ***\n";
//Set the default time zone
date_default_timezone_set("Europe/London");
// Create a DateTimeZone object
$tz = new DateTimeZone("Europe/London");
$tran = $tz->getTransitions();
if (!is_array($tran)) {
echo "TEST FAILED: Expected an array\n";
}
echo "\n-- Total number of transitions: " . count($tran). " --\n";
echo "\n-- Format a sample entry for Spring 1963 --\n";
var_dump( $tran[96] );
?>
===DONE===
--EXPECT--
*** Testing DateTimeZone::getTransitions() : basic functionality ***
-- Total number of transitions: 242 --
-- Format a sample entry for Spring 1963 --
array(5) {
["ts"]=>
int(-213228000)
["time"]=>
string(24) "1963-03-31T02:00:00+0000"
["offset"]=>
int(3600)
["isdst"]=>
bool(true)
["abbr"]=>
string(3) "BST"
}
===DONE===
@@ -1,31 +0,0 @@
--TEST--
Test DateTimeZone::getTransitions() function : error conditions
--FILE--
<?php
/* Prototype : array DateTimeZone::getTransitions ()
* Description: Returns all transitions for the timezone
* Source code: ext/date/php_date.c
* Alias to functions: timezone_transitions_get()
*/
//Set the default time zone
date_default_timezone_set("GMT");
$tz = new DateTimeZone("Europe/London");
echo "*** Testing DateTimeZone::getTransitions() : error conditions ***\n";
echo "\n-- Testing DateTimeZone::getTransitions() function with more than expected no. of arguments --\n";
$extra_arg = 99;
var_dump( $tz->getTransitions($extra_arg) );
?>
===DONE===
--EXPECTF--
*** Testing DateTimeZone::getTransitions() : error conditions ***
-- Testing DateTimeZone::getTransitions() function with more than expected no. of arguments --
Warning: DateTimeZone::getTransitions() expects exactly 0 parameters, 1 given in %s on line %d
bool(false)
===DONE===
@@ -1,70 +0,0 @@
--TEST--
Test DateTimeZone::listAbbreviations() function : basic functionality
--FILE--
<?php
/* Prototype : array DateTimeZone::listAbbreviations ( void )
* Description: Returns associative array containing dst, offset and the timezone name
* Source code: ext/date/php_date.c
* Alias to functions: timezone_abbreviations_list
*/
echo "*** Testing DateTimeZone::listAbbreviations() : basic functionality ***\n";
//Set the default time zone
date_default_timezone_set("GMT");
$abbr = DateTimeZone::listAbbreviations();
var_dump( gettype($abbr) );
var_dump( count($abbr) );
echo "\n-- Format a sample entry --\n";
var_dump( $abbr["acst"] );
?>
===DONE===
--EXPECT--
*** Testing DateTimeZone::listAbbreviations() : basic functionality ***
string(5) "array"
int(338)
-- Format a sample entry --
array(4) {
[0]=>
array(3) {
["dst"]=>
bool(true)
["offset"]=>
int(-14400)
["timezone_id"]=>
string(18) "America/Porto_Acre"
}
[1]=>
array(3) {
["dst"]=>
bool(true)
["offset"]=>
int(-14400)
["timezone_id"]=>
string(16) "America/Eirunepe"
}
[2]=>
array(3) {
["dst"]=>
bool(true)
["offset"]=>
int(-14400)
["timezone_id"]=>
string(18) "America/Rio_Branco"
}
[3]=>
array(3) {
["dst"]=>
bool(true)
["offset"]=>
int(-14400)
["timezone_id"]=>
string(11) "Brazil/Acre"
}
}
===DONE===
File diff suppressed because it is too large. Load diff
@@ -1,29 +0,0 @@
--TEST--
Test serialization of DateTimeZone objects
--FILE--
<?php
//Set the default time zone
date_default_timezone_set("Europe/London");
$tz1 = new DateTimeZone("America/New_York");
var_dump( $tz1 );
$serialized = serialize($tz1);
var_dump($serialized);
$tz2 = unserialize($serialized);
var_dump($tz2);
// Try to use unserialzied object
var_dump( $tz2->getName() );
?>
===DONE===
--EXPECTF--
object(DateTimeZone)#%d (0) {
}
string(24) "O:12:"DateTimeZone":0:{}"
object(DateTimeZone)#%d (0) {
}
Warning: DateTimeZone::getName(): The DateTimeZone object has not been correctly initialized by its constructor in %s on line %d
bool(false)
===DONE===
-78
View File
@@ -1,78 +0,0 @@
--TEST--
Test DateTimeZone class registration
--SKIPIF--
<?php if (!extension_loaded("reflection")) die("skip"); ?>
--FILE--
<?php
echo "*** Verify DateTimeZone class ***\n";
echo "Verify DateTimeZone class registered OK\n";
$class = new ReflectionClass('DateTimeZone');
var_dump($class);
echo "..and get names of all its methods\n";
$methods = $class->getMethods();
var_dump($methods);
echo "..and get names of all its class constants\n";
$constants = $class->getConstants();
var_dump($constants);
?>
===DONE===
--EXPECTF--
*** Verify DateTimeZone class ***
Verify DateTimeZone class registered OK
object(ReflectionClass)#%d (1) {
["name"]=>
string(12) "DateTimeZone"
}
..and get names of all its methods
array(6) {
[0]=>
&object(ReflectionMethod)#%d (2) {
["name"]=>
string(11) "__construct"
["class"]=>
string(12) "DateTimeZone"
}
[1]=>
&object(ReflectionMethod)#%d (2) {
["name"]=>
string(7) "getName"
["class"]=>
string(12) "DateTimeZone"
}
[2]=>
&object(ReflectionMethod)#%d (2) {
["name"]=>
string(9) "getOffset"
["class"]=>
string(12) "DateTimeZone"
}
[3]=>
&object(ReflectionMethod)#%d (2) {
["name"]=>
string(14) "getTransitions"
["class"]=>
string(12) "DateTimeZone"
}
[4]=>
&object(ReflectionMethod)#%d (2) {
["name"]=>
string(17) "listAbbreviations"
["class"]=>
string(12) "DateTimeZone"
}
[5]=>
&object(ReflectionMethod)#%d (2) {
["name"]=>
string(15) "listIdentifiers"
["class"]=>
string(12) "DateTimeZone"
}
}
..and get names of all its class constants
array(0) {
}
===DONE===
-29
View File
@@ -1,29 +0,0 @@
--TEST--
Test clone on DateTime objects
--FILE--
<?php
//Set the default time zone
date_default_timezone_set('Europe/London');
echo "*** Testing clone on DateTime objects ***\n";
// Create a DateTime object..
$orig = new DateTime('2008-07-02 14:25:41');
// ..create a clone of it ..Clone
$clone = clone $orig;
// ..and modify original
$orig->setTime(22, 41, 50);
echo "Original: " . $orig->format("H:i:s") . "\n";
echo "Clone: " . $clone->format("H:i:s") . "\n";
?>
===DONE===
--EXPECTF--
*** Testing clone on DateTime objects ***
Original: 22:41:50
Clone: 14:25:41
===DONE===
-66
View File
@@ -1,66 +0,0 @@
--TEST--
Test clone of objects whoose class derived from DateTime class
--FILE--
<?php
//Set the default time zone
date_default_timezone_set("Europe/London");
class DateTimeExt1 extends DateTime {
public $property1 = 99;
public $property2 = "Hello";
}
class DateTimeExt2 extends DateTimeExt1 {
public $property3 = true;
public $property4 = 10.5;
}
echo "*** Testing clone on objects whoose class derived from DateTime class ***\n";
$d1 = new DateTimeExt1("2009-02-03 12:34:41 GMT");
var_dump($d1);
$d1_clone = clone $d1;
var_dump($d1_clone);
$d2 = new DateTimeExt2("2009-02-03 12:34:41 GMT");
var_dump($d2);
$d2_clone = clone $d2;
var_dump($d2_clone);
?>
===DONE===
--EXPECTF--
*** Testing clone on objects whoose class derived from DateTime class ***
object(DateTimeExt1)#%d (2) {
["property1"]=>
int(99)
["property2"]=>
string(5) "Hello"
}
object(DateTimeExt1)#%d (2) {
["property1"]=>
int(99)
["property2"]=>
string(5) "Hello"
}
object(DateTimeExt2)#%d (4) {
["property3"]=>
bool(true)
["property4"]=>
float(10.5)
["property1"]=>
int(99)
["property2"]=>
string(5) "Hello"
}
object(DateTimeExt2)#%d (4) {
["property3"]=>
bool(true)
["property4"]=>
float(10.5)
["property1"]=>
int(99)
["property2"]=>
string(5) "Hello"
}
===DONE===
Loaded 100 of 865 files, more files were not shown because too many files have changed in this diff. Show more