Compare commits

..
251 changed files with 2212 additions and 5190 deletions

No files matched your search

+1 -1
View File
@@ -151,7 +151,7 @@ Naming Conventions
7. Classes should be given descriptive names. Avoid using abbreviations where
possible. Each word in the class name should start with a capital letter,
without underscore delimiters (CamelCaps starting with a capital letter).
without underscore delimiters (CampelCaps starting with a capital letter).
The class name should be prefixed with the name of the 'parent set' (e.g.
the name of the extension)::
+2 -2
View File
@@ -10,7 +10,7 @@ all: $(all_targets)
@echo "Build complete."
@echo "Don't forget to run 'make test'."
@echo
build-modules: $(PHP_MODULES) $(PHP_ZEND_EX)
build-binaries: $(PHP_BINARIES)
@@ -116,7 +116,7 @@ clean:
rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/*
distclean: clean
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h sapi/apache/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h sapi/apache/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp
$(EGREP) define'.*include/php' $(top_srcdir)/configure | $(SED) 's/.*>//'|xargs rm -f
.PHONY: all clean install distclean test
+5 -158
View File
@@ -1,164 +1,15 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
31 Oct 2013, PHP 5.4.22 RC1
- Core:
. Fixed bug #65911 (scope resolution operator - strange behavior with $this).
(Bob Weinand)
- CLI server:
. Fixed bug #65818 (Segfault with built-in webserver and chunked transfer
encoding). (Felipe)
- Exif:
. Fixed crash on unknown encoding. (Draal)
- FTP:
. Fixed bug #65667 (ftp_nb_continue produces segfault). (Philip Hofstetter)
- ODBC
. Fixed bug #65950 (Field name truncation if the field name is bigger than
32 characters). (patch submitted by: michael dot y at zend dot com, Yasuo)
- Sockets:
. Fixed bug #65808 (the socket_connect() won't work with IPv6 address).
(Mike)
- Standard:
. Fixed bug #64760 (var_export() does not use full precision for floating-point
numbers) (Yasuo)
- XMLReader:
. Fixed bug #51936 (Crash with clone XMLReader). (Mike)
. Fixed bug #64230 (XMLReader does not suppress errors). (Mike)
17 Oct 2013, PHP 5.4.21
- Core:
. Fixed bug #65322 (compile time errors won't trigger auto loading). (Nikita)
- CLI server:
. Fixed bug #65633 (built-in server treat some http headers as
case-sensitive). (Adam)
- Datetime:
. Fixed bug #64157 (DateTime::createFromFormat() reports confusing error
message). (Boro Sitnikovski)
- DBA extension:
. Fixed bug #65708 (dba functions cast $key param to string in-place,
bypassing copy on write). (Adam)
- Filter:
. Add RFC 6598 IPs to reserved addresses. (Sebastian Nohn)
. Fixed bug #64441 (FILTER_VALIDATE_URL rejects fully qualified domain names).
(Syra)
- IMAP:
. Fixed bug #65721 (configure script broken in 5.5.4 and 5.4.20 when enabling
imap). (ryotakatsuki at gmail dot com)
- Standard:
. Fixed bug #61548 (content-type must appear at the end of headers for 201
Location to work in http). (Mike)
- Build system:
. Fixed bug #62396 ('make test' crashes starting with 5.3.14 (missing
gzencode())). (Mike)
19 Sep 2013, PHP 5.4.20
- Core:
. Fixed bug #60598 (cli/apache sapi segfault on objects manipulation).
(Laruence)
. Fixed bug #65579 (Using traits with get_class_methods causes segfault).
(Adam)
. Fixed bug #65490 (Duplicate calls to get lineno & filename for
DTRACE_FUNCTION_*). (Chris Jones)
. Fixed bug #65483 (quoted-printable encode stream filter incorrectly encoding
spaces). (Michael M Slusarz)
. Fixed bug #65481 (shutdown segfault due to serialize) (Mike)
. Fixed bug #65470 (Segmentation fault in zend_error() with
--enable-dtrace). (Chris Jones, Kris Van Hees)
. Fixed bug #65372 (Segfault in gc_zval_possible_root when return reference
fails). (Laruence)
. Fixed bug #65304 (Use of max int in array_sum). (Laruence)
. Fixed bug #65291 (get_defined_constants() causes PHP to crash in a very
limited case). (Arpad)
. Fixed bug #65225 (PHP_BINARY incorrectly set). (Patrick Allaert)
. Improved fix for bug #63186 (compile failure on netbsd). (Matteo)
. Fixed bug #62692 (PHP fails to build with DTrace). (Chris Jones, Kris Van Hees)
. Fixed bug #61759 (class_alias() should accept classes with leading
backslashes). (Julien)
. Fixed bug #61345 (CGI mode - make install don't work). (Michael Heimpold)
. Cherry-picked some DTrace build commits (allowing builds on Linux,
bug #62691, and bug #63706) from PHP 5.5 branch
. Fixed bug #61268 (--enable-dtrace leads make to clobber
Zend/zend_dtrace.d) (Chris Jones)
- cURL:
. Fixed bug #65458 (curl memory leak). (Adam)
- Datetime:
. Fixed bug #65554 (createFromFormat broken when weekday name is followed
by some delimiters). (Valentin Logvinskiy, Stas).
. Fixed bug #65564 (stack-buffer-overflow in DateTimeZone stuff caught
by AddressSanitizer). (Remi).
- Openssl:
. Fixed bug #64802 (openssl_x509_parse fails to parse subject properly in
some cases). (Mark Jones)
- Session:
. Fixed bug #62129 (rfc1867 crashes php even though turned off). (gxd305 at
gmail dot com)
. Fixed bug #50308 (session id not appended properly for empty anchor tags).
(Arpad)
. Fixed possible buffer overflow under Windows. Note: Not a security fix.
(Yasuo)
. Changed session.auto_start to PHP_INI_PERDIR. (Yasuo)
- SOAP:
. Fixed bug #65018 (SoapHeader problems with SoapServer). (Dmitry)
- SPL:
. Fixed bug #65328 (Segfault when getting SplStack object Value). (Laruence)
- PDO:
. Fixed bug #64953 (Postgres prepared statement positional parameter
casting). (Mike)
- Phar:
. Fixed bug #65028 (Phar::buildFromDirectory creates corrupt archives for
some specific contents). (Stas)
- Pgsql:
. Fixed bug #65336 (pg_escape_literal/identifier() silently returns false).
(Yasuo)
. Fixed bug #62978 (Disallow possible SQL injections with pg_select()/pg_update()
/pg_delete()/pg_insert()). (Yasuo)
- Zlib:
. Fixed bug #65391 (Unable to send vary header user-agent when
ob_start('ob_gzhandler') is called) (Mike)
22 Aug 2013, PHP 5.4.19
- Core:
. Fixed bug #64503 (Compilation fails with error: conflicting types for
'zendparse'). (Laruence)
- Openssl:
. Fixed UMR in fix for CVE-2013-4248.
15 Aug 2013, PHP 5.4.18
01 Aug 2013, PHP 5.4.18 RC2
- Core:
. Fixed value of FILTER_SANITIZE_FULL_SPECIAL_CHARS constant (previously was
erroneously set to FILTER_SANITIZE_SPECIAL_CHARS value). (Andrey
avp200681 gmail com).
18 Jul 2013, PHP 5.4.18 RC1
- Core:
. Fixed bug #65254 (Exception not catchable when exception thrown in autoload
with a namespace). (Laruence)
. Fixed bug #65108 (is_callable() triggers Fatal Error).
@@ -210,10 +61,6 @@ PHP NEWS
. Fixed bug #61387 (NULL valued anonymous column causes segfault in
odbc_fetch_array). (Brandon Kirsch)
- Openssl:
. Fixed handling null bytes in subjectAltName (CVE-2013-4248).
(Christian Heimes)
- PDO:
. Allowed PDO_OCI to compile with Oracle Database 12c client libraries.
(Chris Jones)
+1 -1
View File
@@ -30,7 +30,7 @@ zend_module_entry foo_module_entry = {
PHP_RSHUTDOWN(foo), /* per-request shutdown function */
PHP_MINFO(foo), /* information function */
#if ZEND_MODULE_API_NO >= 20010901
PHP_FOO_VERSION, /* extension version number (string) */
FOO_VERSION, /* extension version number (string) */
#endif
STANDARD_MODULE_PROPERTIES
};
-5
View File
@@ -31,11 +31,6 @@ HOW TO USE IT
./buildconf; ./configure --enable-module_name; make
The definition of PHP_MODULE_NAME_VERSION will be present in the
php_module_name.h and injected into the zend_module_entry definition. This
is required by the PECL website for the version string conformity checks
against package.xml
But if you already have planned the overall scheme of your module, what
functions it will contain, their return types and the arguments they take
(a very good idea) and don't want to bother yourself with creating function
-15
View File
@@ -153,18 +153,3 @@ ADDING SHARED MODULE SUPPORT TO A MODULE
#ifdef COMPILE_DL_FOO
ZEND_GET_MODULE(foo)
#endif
PECL SITE CONFORMITY
If you plan to release an extension to the PECL website, there are several
points to be regarded.
1. Add LICENSE or COPYING to the package.xml
2. The following should be defined in one of the extension header files
#define PHP_FOO_VERSION "1.2.3"
This macros has to be used within your foo_module_entry to indicate the
extension version.
+3 -5
View File
@@ -625,7 +625,7 @@ TSRM_API int shmget(int key, int size, int flags)
shm->info = info_handle;
shm->descriptor = MapViewOfFileEx(shm->info, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL);
if (NULL != shm->descriptor && created) {
if (created) {
shm->descriptor->shm_perm.key = key;
shm->descriptor->shm_segsz = size;
shm->descriptor->shm_ctime = time(NULL);
@@ -639,10 +639,8 @@ TSRM_API int shmget(int key, int size, int flags)
shm->descriptor->shm_perm.mode = shm->descriptor->shm_perm.seq = 0;
}
if (NULL != shm->descriptor && (shm->descriptor->shm_perm.key != key || size > shm->descriptor->shm_segsz)) {
if (NULL != shm->segment) {
CloseHandle(shm->segment);
}
if (shm->descriptor->shm_perm.key != key || size > shm->descriptor->shm_segsz ) {
CloseHandle(shm->segment);
UnmapViewOfFile(shm->descriptor);
CloseHandle(shm->info);
return -1;
+1 -1
View File
@@ -12,7 +12,7 @@ AC_DEFUN([LIBZEND_BISON_CHECK],[
bison_version=none
if test "$YACC"; then
AC_CACHE_CHECK([for bison version], php_cv_bison_version, [
bison_version_vars=`$YACC --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /g' | tr -d a-z`
bison_version_vars=`bison --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /' | tr -d a-z`
php_cv_bison_version=invalid
if test -n "$bison_version_vars"; then
set $bison_version_vars
-30
View File
@@ -1,30 +0,0 @@
--TEST--
Bug #60598 (cli/apache sapi segfault on objects manipulation)
--FILE--
<?php
define('OBJECT_COUNT', 10000);
$containers = array();
class Object {
protected $_guid = 0;
public function __construct() {
global $containers;
$this->guid = 1;
$containers[spl_object_hash($this)] = $this;
}
public function __destruct() {
global $containers;
$containers[spl_object_hash($this)] = NULL;
}
}
for ($i = 0; $i < OBJECT_COUNT; ++$i) {
new Object();
}
// You probably won't see this because of the "zend_mm_heap corrupted"
?>
If you see this, try to increase OBJECT_COUNT to 100,000
--EXPECT--
If you see this, try to increase OBJECT_COUNT to 100,000
+10 -10
View File
@@ -1,10 +1,10 @@
--TEST--
test of larger than 8kb text file being parsed by require statement
--FILE--
<?php
file_put_contents('test.php',str_repeat('passed, ',1024));
require('./test.php');
unlink('test.php');
?>
--EXPECT--
passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed,Line truncated
--TEST--
test of larger than 8kb text file being parsed by require statement
--FILE--
<?php
file_put_contents('test.php',str_repeat('passed, ',1024));
require('test.php');
unlink('test.php');
?>
--EXPECT--
passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed,Line truncated
-47
View File
@@ -1,47 +0,0 @@
--TEST--
Bug #64896 (Segfault with gc_collect_cycles using unserialize on certain objects)
--XFAIL--
We can not fix this bug without a significant (performace slow down) change to gc
--FILE--
<?php
$bar = NULL;
class bad
{
private $_private = array();
public function __construct()
{
$this->_private[] = 'php';
}
public function __destruct()
{
global $bar;
$bar = $this;
}
}
$foo = new stdclass;
$foo->foo = $foo;
$foo->bad = new bad;
gc_disable();
unserialize(serialize($foo));
gc_collect_cycles();
var_dump($bar);
/* will output:
object(bad)#4 (1) {
["_private":"bad":private]=>
&UNKNOWN:0
}
*/
?>
--EXPECTF--
bject(bad)#%d (1) {
["_private":"bad":private]=>
array(1) {
[0]=>
string(3) "php"
}
}
-25
View File
@@ -1,25 +0,0 @@
--TEST--
Bug #65291 - get_defined_constants() causes PHP to crash in a very limited case.
--FILE--
<?php
trait TestTrait
{
public static function testStaticFunction()
{
return __CLASS__;
}
}
class Tester
{
use TestTrait;
}
$foo = Tester::testStaticFunction();
get_defined_constants();
get_defined_constants(true);
echo $foo;
?>
--EXPECT--
Tester
-22
View File
@@ -1,22 +0,0 @@
--TEST--
Bug #65322: compile time errors won't trigger auto loading
--FILE--
<?php
spl_autoload_register(function($class) {
var_dump($class);
class B {}
});
set_error_handler(function($_, $msg, $file) {
var_dump($msg, $file);
new B;
});
eval('class A { function a() {} function __construct() {} }');
?>
--EXPECTF--
string(50) "Redefining already defined constructor for class A"
string(%d) "%s(%d) : eval()'d code"
string(1) "B"
-40
View File
@@ -1,40 +0,0 @@
--TEST--
Bug #65372 (Segfault in gc_zval_possible_root when return reference fails)
--FILE--
<?php
class ParentClass
{
private static $_OBJECTS;
public static function Get()
{
self::$_OBJECTS[1] = new ChildClass();
return self::$_OBJECTS[1];
}
}
class ChildClass extends ParentClass
{
public $Manager;
function __construct()
{
$this->Manager = $this;
}
public static function &GetCurrent()
{
return ChildClass::Get();
}
public static function &Get()
{
return parent::Get();
}
}
$staff = ChildClass::GetCurrent();
?>
--EXPECTF--
Notice: Only variable references should be returned by reference in %sbug65372.php on line 30
-29
View File
@@ -1,29 +0,0 @@
--TEST--
Bug #65579 (Using traits with get_class_methods causes segfault)
--FILE--
<?php
trait ParentTrait {
public function testMethod() { }
}
trait ChildTrait {
use ParentTrait {
testMethod as testMethodFromParentTrait;
}
public function testMethod() { }
}
class TestClass {
use ChildTrait;
}
$obj = new TestClass();
var_dump(get_class_methods($obj));
?>
--EXPECT--
array(2) {
[0]=>
string(10) "testMethod"
[1]=>
string(25) "testmethodfromparenttrait"
}
-20
View File
@@ -1,20 +0,0 @@
--TEST--
Bug #65911 (scope resolution operator - strange behavior with $this)
--FILE--
<?php
class A {}
class B
{
public function go()
{
$this->foo = 'bar';
echo A::$this->foo; // should not output 'bar'
}
}
$obj = new B();
$obj->go();
?>
--EXPECTF--
Fatal error: Access to undeclared static property: A::$this in %s on line %d
-18
View File
@@ -1,18 +0,0 @@
--TEST--
Error message in error handler during compilation
--FILE--
<?php
set_error_handler(function($_, $msg, $file) {
var_dump($msg, $file);
echo $undefined;
});
eval('class A { function a() {} function __construct() {} }');
?>
--EXPECTF--
string(50) "Redefining already defined constructor for class A"
string(%d) "%s(%d) : eval()'d code"
Notice: Undefined variable: undefined in %s on line %d
@@ -1,5 +1,5 @@
--TEST--
Overriding Conflicting Methods should not result in a notice/warning about collisions
Overridding Conflicting Methods should not result in a notice/warning about collisions
--FILE--
<?php
error_reporting(E_ALL);
+4 -8
View File
@@ -1091,19 +1091,17 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
error_filename = "Unknown";
}
va_start(args, format);
#ifdef HAVE_DTRACE
if(DTRACE_ERROR_ENABLED()) {
char *dtrace_error_buffer;
va_start(args, format);
zend_vspprintf(&dtrace_error_buffer, 0, format, args);
DTRACE_ERROR(dtrace_error_buffer, (char *)error_filename, error_lineno);
DTRACE_ERROR(dtrace_error_buffer, error_filename, error_lineno);
efree(dtrace_error_buffer);
va_end(args);
}
#endif /* HAVE_DTRACE */
va_start(args, format);
/* if we don't have a user defined error handler */
if (!EG(user_error_handler)
|| !(EG(user_error_handler_error_reporting) & type)
@@ -1183,7 +1181,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
* such scripts recursivly, but some CG() variables may be
* inconsistent. */
in_compilation = CG(in_compilation);
in_compilation = zend_is_compiling(TSRMLS_C);
if (in_compilation) {
saved_class_entry = CG(active_class_entry);
CG(active_class_entry) = NULL;
@@ -1195,7 +1193,6 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
SAVE_STACK(declare_stack);
SAVE_STACK(list_stack);
SAVE_STACK(context_stack);
CG(in_compilation) = 0;
}
if (call_user_function_ex(CG(function_table), NULL, orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC) == SUCCESS) {
@@ -1220,7 +1217,6 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
RESTORE_STACK(declare_stack);
RESTORE_STACK(list_stack);
RESTORE_STACK(context_stack);
CG(in_compilation) = 1;
}
if (!EG(user_error_handler)) {
+9 -15
View File
@@ -2514,12 +2514,7 @@ ZEND_API int zend_register_class_alias_ex(const char *name, int name_len, zend_c
char *lcname = zend_str_tolower_dup(name, name_len);
int ret;
if (lcname[0] == '\\') {
ret = zend_hash_add(CG(class_table), lcname+1, name_len, &ce, sizeof(zend_class_entry *), NULL);
} else {
ret = zend_hash_add(CG(class_table), lcname, name_len+1, &ce, sizeof(zend_class_entry *), NULL);
}
ret = zend_hash_add(CG(class_table), lcname, name_len+1, &ce, sizeof(zend_class_entry *), NULL);
efree(lcname);
if (ret == SUCCESS) {
ce->refcount++;
@@ -3922,16 +3917,15 @@ ZEND_API const char* zend_find_alias_name(zend_class_entry *ce, const char *name
{
zend_trait_alias *alias, **alias_ptr;
if ((alias_ptr = ce->trait_aliases)) {
alias = *alias_ptr;
while (alias) {
if (alias->alias_len == len &&
!strncasecmp(name, alias->alias, alias->alias_len)) {
return alias->alias;
}
alias_ptr++;
alias = *alias_ptr;
alias_ptr = ce->trait_aliases;
alias = *alias_ptr;
while (alias) {
if (alias->alias_len == len &&
!strncasecmp(name, alias->alias, alias->alias_len)) {
return alias->alias;
}
alias_ptr++;
alias = *alias_ptr;
}
return name;
+11 -14
View File
@@ -1399,8 +1399,15 @@ ZEND_FUNCTION(class_alias)
return;
}
found = zend_lookup_class_ex(class_name, class_name_len, NULL, autoload, &ce TSRMLS_CC);
if (!autoload) {
lc_name = do_alloca(class_name_len + 1, use_heap);
zend_str_tolower_copy(lc_name, class_name, class_name_len);
found = zend_hash_find(EG(class_table), lc_name, class_name_len+1, (void **) &ce);
free_alloca(lc_name, use_heap);
} else {
found = zend_lookup_class(class_name, class_name_len, &ce TSRMLS_CC);
}
if (found == SUCCESS) {
if ((*ce)->type == ZEND_USER_CLASS) {
if (zend_register_class_alias_ex(alias_name, alias_name_len, *ce TSRMLS_CC) == SUCCESS) {
@@ -1919,11 +1926,6 @@ static int add_constant_info(zend_constant *constant, void *arg TSRMLS_DC)
zval *name_array = (zval *)arg;
zval *const_val;
if (!constant->name) {
/* skip special constants */
return 0;
}
MAKE_STD_ZVAL(const_val);
*const_val = constant->value;
zval_copy_ctor(const_val);
@@ -1991,16 +1993,11 @@ ZEND_FUNCTION(get_defined_constants)
while (zend_hash_get_current_data_ex(EG(zend_constants), (void **) &val, &pos) != FAILURE) {
zval *const_val;
if (!val->name) {
/* skip special constants */
goto next_constant;
}
if (val->module_number == PHP_USER_CONSTANT) {
module_number = i;
} else if (val->module_number > i || val->module_number < 0) {
/* should not happen */
goto next_constant;
goto bad_module_id;
} else {
module_number = val->module_number;
}
@@ -2017,7 +2014,7 @@ ZEND_FUNCTION(get_defined_constants)
INIT_PZVAL(const_val);
add_assoc_zval_ex(modules[module_number], val->name, val->name_len, const_val);
next_constant:
bad_module_id:
zend_hash_move_forward_ex(EG(zend_constants), &pos);
}
efree(module_names);
@@ -2389,7 +2386,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
MAKE_STD_ZVAL(arg_array);
array_init(arg_array);
/* include_filename always points to the last filename of the last last called-function.
/* include_filename always points to the last filename of the last last called-fuction.
if we have called include in the frame above - this is the file we have included.
*/
+3 -4
View File
@@ -905,7 +905,6 @@ static zend_bool opline_is_fetch_this(const zend_op *opline TSRMLS_DC) /* {{{ */
{
if ((opline->opcode == ZEND_FETCH_W) && (opline->op1_type == IS_CONST)
&& (Z_TYPE(CONSTANT(opline->op1.constant)) == IS_STRING)
&& ((opline->extended_value & ZEND_FETCH_STATIC_MEMBER) != ZEND_FETCH_STATIC_MEMBER)
&& (Z_HASH_P(&CONSTANT(opline->op1.constant)) == THIS_HASHVAL)
&& (Z_STRLEN(CONSTANT(opline->op1.constant)) == (sizeof("this")-1))
&& !memcmp(Z_STRVAL(CONSTANT(opline->op1.constant)), "this", sizeof("this"))) {
@@ -1724,7 +1723,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
}
{
/* Push a separator to the switch and foreach stacks */
/* Push a seperator to the switch and foreach stacks */
zend_switch_entry switch_entry;
switch_entry.cond.op_type = IS_UNUSED;
@@ -1818,7 +1817,7 @@ void zend_do_end_function_declaration(const znode *function_token TSRMLS_DC) /*
CG(active_op_array) = function_token->u.op_array;
/* Pop the switch and foreach separators */
/* Pop the switch and foreach seperators */
zend_stack_del_top(&CG(switch_cond_stack));
zend_stack_del_top(&CG(foreach_copy_stack));
}
@@ -2585,7 +2584,7 @@ static int generate_free_foreach_copy(const zend_op *foreach_copy TSRMLS_DC) /*
{
zend_op *opline;
/* If we reach the separator then stop applying the stack */
/* If we reach the seperator then stop applying the stack */
if (foreach_copy->result_type == IS_UNUSED && foreach_copy->op1_type == IS_UNUSED) {
return 1;
}
+13 -11
View File
@@ -24,7 +24,7 @@
#ifdef HAVE_DTRACE
/* PHP DTrace probes {{{ */
static inline const char *dtrace_get_executed_filename(TSRMLS_D)
static inline char *dtrace_get_executed_filename(TSRMLS_D)
{
if (EG(current_execute_data) && EG(current_execute_data)->op_array) {
return EG(current_execute_data)->op_array->filename;
@@ -36,9 +36,9 @@ static inline const char *dtrace_get_executed_filename(TSRMLS_D)
ZEND_API zend_op_array *dtrace_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC)
{
zend_op_array *res;
DTRACE_COMPILE_FILE_ENTRY(file_handle->opened_path, (char *)file_handle->filename);
DTRACE_COMPILE_FILE_ENTRY(file_handle->opened_path, file_handle->filename);
res = compile_file(file_handle, type TSRMLS_CC);
DTRACE_COMPILE_FILE_RETURN(file_handle->opened_path, (char *)file_handle->filename);
DTRACE_COMPILE_FILE_RETURN(file_handle->opened_path, file_handle->filename);
return res;
}
@@ -47,7 +47,7 @@ ZEND_API zend_op_array *dtrace_compile_file(zend_file_handle *file_handle, int t
ZEND_API void dtrace_execute(zend_op_array *op_array TSRMLS_DC)
{
int lineno;
const char *scope, *filename, *funcname, *classname;
char *scope, *filename, *funcname, *classname;
scope = filename = funcname = classname = NULL;
/* we need filename and lineno for both execute and function probes */
@@ -58,46 +58,48 @@ ZEND_API void dtrace_execute(zend_op_array *op_array TSRMLS_DC)
}
if (DTRACE_FUNCTION_ENTRY_ENABLED() || DTRACE_FUNCTION_RETURN_ENABLED()) {
filename = dtrace_get_executed_filename(TSRMLS_C);
classname = get_active_class_name(&scope TSRMLS_CC);
funcname = get_active_function_name(TSRMLS_C);
lineno = zend_get_executed_lineno(TSRMLS_C);
}
if (DTRACE_EXECUTE_ENTRY_ENABLED()) {
DTRACE_EXECUTE_ENTRY((char *)filename, lineno);
DTRACE_EXECUTE_ENTRY(filename, lineno);
}
if (DTRACE_FUNCTION_ENTRY_ENABLED() && funcname != NULL) {
DTRACE_FUNCTION_ENTRY((char *)funcname, (char *)filename, lineno, (char *)classname, (char *)scope);
DTRACE_FUNCTION_ENTRY(funcname, filename, lineno, classname, scope);
}
execute(op_array TSRMLS_CC);
if (DTRACE_FUNCTION_RETURN_ENABLED() && funcname != NULL) {
DTRACE_FUNCTION_RETURN((char *)funcname, (char *)filename, lineno, (char *)classname, (char *)scope);
DTRACE_FUNCTION_RETURN(funcname, filename, lineno, classname, scope);
}
if (DTRACE_EXECUTE_RETURN_ENABLED()) {
DTRACE_EXECUTE_RETURN((char *)filename, lineno);
DTRACE_EXECUTE_RETURN(filename, lineno);
}
}
ZEND_API void dtrace_execute_internal(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC)
{
int lineno;
const char *filename;
char *filename;
if (DTRACE_EXECUTE_ENTRY_ENABLED() || DTRACE_EXECUTE_RETURN_ENABLED()) {
filename = dtrace_get_executed_filename(TSRMLS_C);
lineno = zend_get_executed_lineno(TSRMLS_C);
}
if (DTRACE_EXECUTE_ENTRY_ENABLED()) {
DTRACE_EXECUTE_ENTRY((char *)filename, lineno);
DTRACE_EXECUTE_ENTRY(filename, lineno);
}
execute_internal(execute_data_ptr, return_value_used TSRMLS_CC);
if (DTRACE_EXECUTE_RETURN_ENABLED()) {
DTRACE_EXECUTE_RETURN((char *)filename, lineno);
DTRACE_EXECUTE_RETURN(filename, lineno);
}
}
+3 -3
View File
@@ -85,12 +85,12 @@ void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */
{
#ifdef HAVE_DTRACE
if (DTRACE_EXCEPTION_THROWN_ENABLED()) {
const char *classname;
zend_uint name_len;
char *classname;
int name_len;
if (exception != NULL) {
zend_get_object_classname(exception, &classname, &name_len TSRMLS_CC);
DTRACE_EXCEPTION_THROWN((char *)classname);
DTRACE_EXCEPTION_THROWN(classname);
} else {
DTRACE_EXCEPTION_THROWN(NULL);
}
+1 -1
View File
@@ -1072,7 +1072,7 @@ ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_
}
/* The compiler is not-reentrant. Make sure we __autoload() only during run-time
* (doesn't impact functionality of __autoload()
* (doesn't impact fuctionality of __autoload()
*/
if (!use_autoload || zend_is_compiling(TSRMLS_C)) {
if (!key) {
+1 -1
View File
@@ -306,7 +306,7 @@ struct _zend_php_scanner_globals {
unsigned char *script_filtered;
size_t script_filtered_size;
/* input/output filters */
/* input/ouput filters */
zend_encoding_filter input_filter;
zend_encoding_filter output_filter;
const zend_encoding *script_encoding;
+5 -7
View File
@@ -41,19 +41,17 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
#define YYERROR_VERBOSE
#define YYSTYPE znode
#ifdef ZTS
# define YYPARSE_PARAM tsrm_ls
# define YYLEX_PARAM tsrm_ls
#endif
%}
%pure_parser
%expect 3
%code requires {
#ifdef ZTS
# define YYPARSE_PARAM tsrm_ls
# define YYLEX_PARAM tsrm_ls
#endif
}
%token END 0 "end of file"
%left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE
%token T_INCLUDE "include (T_INCLUDE)"
+1 -1
View File
@@ -44,7 +44,7 @@ typedef struct _zend_lex_state {
unsigned char *script_filtered;
size_t script_filtered_size;
/* input/output filters */
/* input/ouput filters */
zend_encoding_filter input_filter;
zend_encoding_filter output_filter;
const zend_encoding *script_encoding;
-5
View File
@@ -57,11 +57,6 @@ ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TS
obj->dtor(obj->object, i TSRMLS_CC);
obj = &objects->object_buckets[i].bucket.obj;
obj->refcount--;
if (obj->refcount == 0) {
/* in case gc_collect_cycle is triggered before free_storage */
GC_REMOVE_ZOBJ_FROM_BUFFER(obj);
}
}
}
}
+4 -7
View File
@@ -2910,12 +2910,9 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
} else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
zend_error(E_NOTICE, "Only variable references should be returned by reference");
if (EG(return_value_ptr_ptr)) {
zval *ret;
ALLOC_ZVAL(ret);
INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
zval_copy_ctor(ret);
*EG(return_value_ptr_ptr) = ret;
retval_ptr = *retval_ptr_ptr;
*EG(return_value_ptr_ptr) = retval_ptr;
Z_ADDREF_P(retval_ptr);
}
break;
}
@@ -2984,7 +2981,7 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV)
#ifdef HAVE_DTRACE
if (DTRACE_EXCEPTION_CAUGHT_ENABLED()) {
DTRACE_EXCEPTION_CAUGHT((char *)ce->name);
DTRACE_EXCEPTION_CAUGHT(ce->name);
}
#endif /* HAVE_DTRACE */
+13 -25
View File
@@ -2324,12 +2324,9 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND
} else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
zend_error(E_NOTICE, "Only variable references should be returned by reference");
if (EG(return_value_ptr_ptr)) {
zval *ret;
ALLOC_ZVAL(ret);
INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
zval_copy_ctor(ret);
*EG(return_value_ptr_ptr) = ret;
retval_ptr = *retval_ptr_ptr;
*EG(return_value_ptr_ptr) = retval_ptr;
Z_ADDREF_P(retval_ptr);
}
break;
}
@@ -6279,7 +6276,7 @@ static int ZEND_FASTCALL ZEND_CATCH_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A
#ifdef HAVE_DTRACE
if (DTRACE_EXCEPTION_CAUGHT_ENABLED()) {
DTRACE_EXCEPTION_CAUGHT((char *)ce->name);
DTRACE_EXCEPTION_CAUGHT(ce->name);
}
#endif /* HAVE_DTRACE */
@@ -6746,12 +6743,9 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE
} else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
zend_error(E_NOTICE, "Only variable references should be returned by reference");
if (EG(return_value_ptr_ptr)) {
zval *ret;
ALLOC_ZVAL(ret);
INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
zval_copy_ctor(ret);
*EG(return_value_ptr_ptr) = ret;
retval_ptr = *retval_ptr_ptr;
*EG(return_value_ptr_ptr) = retval_ptr;
Z_ADDREF_P(retval_ptr);
}
break;
}
@@ -11061,12 +11055,9 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE
} else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
zend_error(E_NOTICE, "Only variable references should be returned by reference");
if (EG(return_value_ptr_ptr)) {
zval *ret;
ALLOC_ZVAL(ret);
INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
zval_copy_ctor(ret);
*EG(return_value_ptr_ptr) = ret;
retval_ptr = *retval_ptr_ptr;
*EG(return_value_ptr_ptr) = retval_ptr;
Z_ADDREF_P(retval_ptr);
}
break;
}
@@ -27039,12 +27030,9 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER
} else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
zend_error(E_NOTICE, "Only variable references should be returned by reference");
if (EG(return_value_ptr_ptr)) {
zval *ret;
ALLOC_ZVAL(ret);
INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
zval_copy_ctor(ret);
*EG(return_value_ptr_ptr) = ret;
retval_ptr = *retval_ptr_ptr;
*EG(return_value_ptr_ptr) = retval_ptr;
Z_ADDREF_P(retval_ptr);
}
break;
}
+4 -45
View File
@@ -2925,17 +2925,14 @@ dnl providerdesc
dnl header-file
ac_hdrobj=$2
dnl Add providerdesc.o or .lo into global objects when needed
dnl Add providerdesc.o into global objects when needed
case $host_alias in
*freebsd*)
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.o"
PHP_LDFLAGS="$PHP_LDFLAGS -lelf"
;;
*solaris*)
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.lo"
;;
*linux*)
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.lo"
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.o"
;;
esac
@@ -2962,53 +2959,15 @@ dnl DTrace objects
esac
dnl Generate Makefile.objects entries
dnl The empty $ac_provsrc command stops an implicit circular dependency
dnl in GNU Make which causes the .d file to be overwritten (Bug 61268)
cat>>Makefile.objects<<EOF
$abs_srcdir/$ac_provsrc:;
$ac_bdir[$]ac_hdrobj: $abs_srcdir/$ac_provsrc
CFLAGS="\$(CFLAGS_CLEAN)" dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@.bak && \$(SED) -e 's,PHP_,DTRACE_,g' \$[]@.bak > \$[]@
dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@ && \$(SED) -ibak 's,PHP_,DTRACE_,g' \$[]@
\$(PHP_DTRACE_OBJS): $ac_bdir[$]ac_hdrobj
EOF
case $host_alias in
*solaris*|*linux*)
dtrace_prov_name="`echo $ac_provsrc | $SED -e 's#\(.*\)\/##'`.o"
dtrace_lib_dir="`echo $ac_bdir[$]ac_provsrc | $SED -e 's#\(.*\)/[^/]*#\1#'`/.libs"
dtrace_d_obj="`echo $ac_bdir[$]ac_provsrc | $SED -e 's#\(.*\)/\([^/]*\)#\1/.libs/\2#'`.o"
dtrace_nolib_objs='$(PHP_DTRACE_OBJS:.lo=.o)'
for ac_lo in $PHP_DTRACE_OBJS; do
dtrace_lib_objs="[$]dtrace_lib_objs `echo $ac_lo | $SED -e 's,\.lo$,.o,' -e 's#\(.*\)\/#\1\/.libs\/#'`"
done;
dnl Always attempt to create both PIC and non-PIC DTrace objects (Bug 63692)
cat>>Makefile.objects<<EOF
$ac_bdir[$]ac_provsrc.lo: \$(PHP_DTRACE_OBJS)
echo "[#] Generated by Makefile for libtool" > \$[]@
@test -d "$dtrace_lib_dir" || mkdir $dtrace_lib_dir
if CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $dtrace_d_obj -s $abs_srcdir/$ac_provsrc $dtrace_lib_objs 2> /dev/null && test -f "$dtrace_d_obj"; then [\\]
echo "pic_object=['].libs/$dtrace_prov_name[']" >> \$[]@ [;\\]
else [\\]
echo "pic_object='none'" >> \$[]@ [;\\]
fi
if CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $ac_bdir[$]ac_provsrc.o -s $abs_srcdir/$ac_provsrc $dtrace_nolib_objs 2> /dev/null && test -f "$ac_bdir[$]ac_provsrc.o"; then [\\]
echo "non_pic_object=[']$dtrace_prov_name[']" >> \$[]@ [;\\]
else [\\]
echo "non_pic_object='none'" >> \$[]@ [;\\]
fi
EOF
;;
*)
cat>>Makefile.objects<<EOF
$ac_bdir[$]ac_provsrc.o: \$(PHP_DTRACE_OBJS)
CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o \$[]@ -s $abs_srcdir/$ac_provsrc $dtrace_objs
dtrace -G -o \$[]@ -s $abs_srcdir/$ac_provsrc $dtrace_objs
EOF
;;
esac
])
+3 -3
View File
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=5
PHP_MINOR_VERSION=4
PHP_RELEASE_VERSION=22
PHP_EXTRA_VERSION="RC1"
PHP_RELEASE_VERSION=18
PHP_EXTRA_VERSION="RC2"
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`
@@ -1582,7 +1582,7 @@ cat <<X
| see the file debug.log for error messages. |
| |
| If you are unable to fix this, send the file debug.log to the |
| php-install@lists.php.net mailing list and include appropriate |
| php-install@lists.php.net mailing list and include appropiate |
| information about your setup. |
X
fi
-1
View File
@@ -97,7 +97,6 @@ static php_stream_filter_status_t php_bz2_decompress_filter(
status = BZ2_bzDecompressInit(streamp, 0, data->small_footprint);
if (BZ_OK != status) {
php_stream_bucket_delref(bucket TSRMLS_CC);
return PSFS_ERR_FATAL;
}
+7 -9
View File
@@ -1068,6 +1068,7 @@ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double
{
php_curl *ch = (php_curl *) clientp;
php_curl_progress *t = ch->handlers->progress;
int length = -1;
size_t rval = 0;
#if PHP_CURL_DEBUG
@@ -1117,6 +1118,7 @@ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double
ch->in_callback = 0;
if (error == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_PROGRESSFUNCTION");
length = -1;
} else if (retval_ptr) {
if (Z_TYPE_P(retval_ptr) != IS_LONG) {
convert_to_long_ex(&retval_ptr);
@@ -1371,9 +1373,9 @@ static void curl_free_post(void **post)
/* {{{ curl_free_slist
*/
static void curl_free_slist(void *slist)
static void curl_free_slist(void **slist)
{
curl_slist_free_all(*((struct curl_slist **) slist));
curl_slist_free_all((struct curl_slist *) *slist);
}
/* }}} */
@@ -1441,10 +1443,8 @@ static void alloc_curl_handle(php_curl **ch)
(*ch)->handlers->read->stream = NULL;
zend_llist_init(&(*ch)->to_free->str, sizeof(char *), (llist_dtor_func_t) curl_free_string, 0);
zend_llist_init(&(*ch)->to_free->slist, sizeof(struct curl_slist), (llist_dtor_func_t) curl_free_slist, 0);
zend_llist_init(&(*ch)->to_free->post, sizeof(struct HttpPost), (llist_dtor_func_t) curl_free_post, 0);
(*ch)->to_free->slist = emalloc(sizeof(HashTable));
zend_hash_init((*ch)->to_free->slist, 4, NULL, curl_free_slist, 0);
}
/* }}} */
@@ -1675,7 +1675,6 @@ PHP_FUNCTION(curl_copy_handle)
curl_easy_setopt(dupch->cp, CURLOPT_WRITEHEADER, (void *) dupch);
curl_easy_setopt(dupch->cp, CURLOPT_PROGRESSDATA, (void *) dupch);
efree(dupch->to_free->slist);
efree(dupch->to_free);
dupch->to_free = ch->to_free;
@@ -2185,7 +2184,7 @@ string_copy:
return 1;
}
}
zend_hash_index_update(ch->to_free->slist, (ulong) option, &slist, sizeof(struct curl_slist *), NULL);
zend_llist_add_element(&ch->to_free->slist, &slist);
error = curl_easy_setopt(ch->cp, option, slist);
@@ -2681,9 +2680,8 @@ static void _php_curl_close_ex(php_curl *ch TSRMLS_DC)
/* cURL destructors should be invoked only by last curl handle */
if (Z_REFCOUNT_P(ch->clone) <= 1) {
zend_llist_clean(&ch->to_free->str);
zend_llist_clean(&ch->to_free->slist);
zend_llist_clean(&ch->to_free->post);
zend_hash_destroy(ch->to_free->slist);
efree(ch->to_free->slist);
efree(ch->to_free);
FREE_ZVAL(ch->clone);
} else {
+1 -1
View File
@@ -126,7 +126,7 @@ struct _php_curl_send_headers {
struct _php_curl_free {
zend_llist str;
zend_llist post;
HashTable *slist;
zend_llist slist;
};
typedef struct {
-25
View File
@@ -1,25 +0,0 @@
--TEST--
Bug #65458 (curl memory leak)
--SKIPIF--
<?php
if (!extension_loaded('curl')) exit("skip curl extension not loaded");
?>
--FILE--
<?php
$ch = curl_init();
$init = memory_get_usage();
for ($i = 0; $i < 10000; $i++) {
curl_setopt($ch, CURLOPT_HTTPHEADER, [ "SOAPAction: getItems" ]);
}
$preclose = memory_get_usage();
curl_close($ch);
// This is a slightly tricky heuristic, but basically, we want to ensure
// $preclose - $init has a delta in the order of bytes, not megabytes. Given
// the number of iterations in the loop, if we're wasting memory here, we
// should have megs and megs of extra allocations.
var_dump(($preclose - $init) < 10000);
?>
--EXPECT--
bool(true)
+101 -102
View File
@@ -1,4 +1,4 @@
/* Generated by re2c 0.13.5 on Sun Aug 25 14:46:08 2013 */
/* Generated by re2c 0.13.5 on Sun Sep 30 20:14:42 2012 */
#line 1 "ext/date/lib/parse_date.re"
/*
+----------------------------------------------------------------------+
@@ -651,8 +651,7 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr)
char *begin = *ptr, *end;
const timelib_relunit *tp, *value = NULL;
while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t' && **ptr != ';' && **ptr != ':' &&
**ptr != '/' && **ptr != '.' && **ptr != '-' && **ptr != '(' && **ptr != ')' ) {
while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t') {
++*ptr;
}
end = *ptr;
@@ -872,11 +871,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
std:
s->tok = cursor;
s->len = 0;
#line 998 "ext/date/lib/parse_date.re"
#line 997 "ext/date/lib/parse_date.re"
#line 880 "ext/date/lib/parse_date.c"
#line 879 "ext/date/lib/parse_date.c"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@@ -996,7 +995,7 @@ std:
}
yy2:
YYDEBUG(2, *YYCURSOR);
#line 1084 "ext/date/lib/parse_date.re"
#line 1083 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("firstdayof | lastdayof");
TIMELIB_INIT;
@@ -1012,7 +1011,7 @@ yy2:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 1016 "ext/date/lib/parse_date.c"
#line 1015 "ext/date/lib/parse_date.c"
yy3:
YYDEBUG(3, *YYCURSOR);
++YYCURSOR;
@@ -1035,7 +1034,7 @@ yy3:
}
yy4:
YYDEBUG(4, *YYCURSOR);
#line 1678 "ext/date/lib/parse_date.re"
#line 1677 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("tzcorrection | tz");
@@ -1048,7 +1047,7 @@ yy4:
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
}
#line 1052 "ext/date/lib/parse_date.c"
#line 1051 "ext/date/lib/parse_date.c"
yy5:
YYDEBUG(5, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1359,12 +1358,12 @@ yy12:
if (yych <= '9') goto yy1385;
yy13:
YYDEBUG(13, *YYCURSOR);
#line 1773 "ext/date/lib/parse_date.re"
#line 1772 "ext/date/lib/parse_date.re"
{
add_error(s, "Unexpected character");
goto std;
}
#line 1368 "ext/date/lib/parse_date.c"
#line 1367 "ext/date/lib/parse_date.c"
yy14:
YYDEBUG(14, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2421,11 +2420,11 @@ yy49:
if (yych <= '9') goto yy55;
yy50:
YYDEBUG(50, *YYCURSOR);
#line 1762 "ext/date/lib/parse_date.re"
#line 1761 "ext/date/lib/parse_date.re"
{
goto std;
}
#line 2429 "ext/date/lib/parse_date.c"
#line 2428 "ext/date/lib/parse_date.c"
yy51:
YYDEBUG(51, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2434,12 +2433,12 @@ yy52:
YYDEBUG(52, *YYCURSOR);
++YYCURSOR;
YYDEBUG(53, *YYCURSOR);
#line 1767 "ext/date/lib/parse_date.re"
#line 1766 "ext/date/lib/parse_date.re"
{
s->pos = cursor; s->line++;
goto std;
}
#line 2443 "ext/date/lib/parse_date.c"
#line 2442 "ext/date/lib/parse_date.c"
yy54:
YYDEBUG(54, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2826,7 +2825,7 @@ yy72:
if (yych == 's') goto yy74;
yy73:
YYDEBUG(73, *YYCURSOR);
#line 1746 "ext/date/lib/parse_date.re"
#line 1745 "ext/date/lib/parse_date.re"
{
timelib_ull i;
DEBUG_OUTPUT("relative");
@@ -2841,7 +2840,7 @@ yy73:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 2845 "ext/date/lib/parse_date.c"
#line 2844 "ext/date/lib/parse_date.c"
yy74:
YYDEBUG(74, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3603,7 +3602,7 @@ yy166:
}
yy167:
YYDEBUG(167, *YYCURSOR);
#line 1609 "ext/date/lib/parse_date.re"
#line 1608 "ext/date/lib/parse_date.re"
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("daytext");
@@ -3620,7 +3619,7 @@ yy167:
TIMELIB_DEINIT;
return TIMELIB_WEEKDAY;
}
#line 3624 "ext/date/lib/parse_date.c"
#line 3623 "ext/date/lib/parse_date.c"
yy168:
YYDEBUG(168, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4140,7 +4139,7 @@ yy193:
}
yy194:
YYDEBUG(194, *YYCURSOR);
#line 1668 "ext/date/lib/parse_date.re"
#line 1667 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("monthtext");
TIMELIB_INIT;
@@ -4149,7 +4148,7 @@ yy194:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 4153 "ext/date/lib/parse_date.c"
#line 4152 "ext/date/lib/parse_date.c"
yy195:
YYDEBUG(195, *YYCURSOR);
++YYCURSOR;
@@ -4200,7 +4199,7 @@ yy198:
}
yy199:
YYDEBUG(199, *YYCURSOR);
#line 1414 "ext/date/lib/parse_date.re"
#line 1413 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datetextual | datenoyear");
@@ -4213,7 +4212,7 @@ yy199:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 4217 "ext/date/lib/parse_date.c"
#line 4216 "ext/date/lib/parse_date.c"
yy200:
YYDEBUG(200, *YYCURSOR);
yyaccept = 6;
@@ -4482,7 +4481,7 @@ yy222:
}
yy223:
YYDEBUG(223, *YYCURSOR);
#line 1716 "ext/date/lib/parse_date.re"
#line 1715 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
@@ -4511,7 +4510,7 @@ yy223:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 4515 "ext/date/lib/parse_date.c"
#line 4514 "ext/date/lib/parse_date.c"
yy224:
YYDEBUG(224, *YYCURSOR);
yyaccept = 7;
@@ -5209,7 +5208,7 @@ yy278:
YYDEBUG(278, *YYCURSOR);
++YYCURSOR;
YYDEBUG(279, *YYCURSOR);
#line 1692 "ext/date/lib/parse_date.re"
#line 1691 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
TIMELIB_INIT;
@@ -5232,7 +5231,7 @@ yy278:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 5236 "ext/date/lib/parse_date.c"
#line 5235 "ext/date/lib/parse_date.c"
yy280:
YYDEBUG(280, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5410,7 +5409,7 @@ yy294:
++YYCURSOR;
yy295:
YYDEBUG(295, *YYCURSOR);
#line 1386 "ext/date/lib/parse_date.re"
#line 1385 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenoday");
@@ -5423,7 +5422,7 @@ yy295:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 5427 "ext/date/lib/parse_date.c"
#line 5426 "ext/date/lib/parse_date.c"
yy296:
YYDEBUG(296, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6643,7 +6642,7 @@ yy362:
if (yych <= '9') goto yy365;
yy364:
YYDEBUG(364, *YYCURSOR);
#line 1530 "ext/date/lib/parse_date.re"
#line 1529 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextshort");
@@ -6656,7 +6655,7 @@ yy364:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 6660 "ext/date/lib/parse_date.c"
#line 6659 "ext/date/lib/parse_date.c"
yy365:
YYDEBUG(365, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7294,7 +7293,7 @@ yy392:
}
yy393:
YYDEBUG(393, *YYCURSOR);
#line 1588 "ext/date/lib/parse_date.re"
#line 1587 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("ago");
TIMELIB_INIT;
@@ -7314,7 +7313,7 @@ yy393:
TIMELIB_DEINIT;
return TIMELIB_AGO;
}
#line 7318 "ext/date/lib/parse_date.c"
#line 7317 "ext/date/lib/parse_date.c"
yy394:
YYDEBUG(394, *YYCURSOR);
yyaccept = 5;
@@ -9064,7 +9063,7 @@ yy454:
++YYCURSOR;
yy455:
YYDEBUG(455, *YYCURSOR);
#line 1291 "ext/date/lib/parse_date.re"
#line 1290 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash");
TIMELIB_INIT;
@@ -9075,7 +9074,7 @@ yy455:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 9079 "ext/date/lib/parse_date.c"
#line 9078 "ext/date/lib/parse_date.c"
yy456:
YYDEBUG(456, *YYCURSOR);
yyaccept = 0;
@@ -9635,7 +9634,7 @@ yy475:
}
yy476:
YYDEBUG(476, *YYCURSOR);
#line 1428 "ext/date/lib/parse_date.re"
#line 1427 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenoyearrev");
TIMELIB_INIT;
@@ -9646,7 +9645,7 @@ yy476:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 9650 "ext/date/lib/parse_date.c"
#line 9649 "ext/date/lib/parse_date.c"
yy477:
YYDEBUG(477, *YYCURSOR);
yyaccept = 10;
@@ -9787,7 +9786,7 @@ yy488:
YYDEBUG(488, *YYCURSOR);
++YYCURSOR;
YYDEBUG(489, *YYCURSOR);
#line 1146 "ext/date/lib/parse_date.re"
#line 1145 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
TIMELIB_INIT;
@@ -9803,7 +9802,7 @@ yy488:
TIMELIB_DEINIT;
return TIMELIB_TIME12;
}
#line 9807 "ext/date/lib/parse_date.c"
#line 9806 "ext/date/lib/parse_date.c"
yy490:
YYDEBUG(490, *YYCURSOR);
yyaccept = 11;
@@ -9816,7 +9815,7 @@ yy490:
}
yy491:
YYDEBUG(491, *YYCURSOR);
#line 1183 "ext/date/lib/parse_date.re"
#line 1182 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long");
@@ -9841,7 +9840,7 @@ yy491:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 9845 "ext/date/lib/parse_date.c"
#line 9844 "ext/date/lib/parse_date.c"
yy492:
YYDEBUG(492, *YYCURSOR);
yyaccept = 11;
@@ -10151,7 +10150,7 @@ yy523:
YYDEBUG(523, *YYCURSOR);
++YYCURSOR;
YYDEBUG(524, *YYCURSOR);
#line 1163 "ext/date/lib/parse_date.re"
#line 1162 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("mssqltime");
TIMELIB_INIT;
@@ -10170,7 +10169,7 @@ yy523:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 10174 "ext/date/lib/parse_date.c"
#line 10173 "ext/date/lib/parse_date.c"
yy525:
YYDEBUG(525, *YYCURSOR);
yyaccept = 11;
@@ -10276,7 +10275,7 @@ yy534:
if (yych <= '9') goto yy541;
yy535:
YYDEBUG(535, *YYCURSOR);
#line 1345 "ext/date/lib/parse_date.re"
#line 1344 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datefull");
@@ -10290,7 +10289,7 @@ yy535:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL;
}
#line 10294 "ext/date/lib/parse_date.c"
#line 10293 "ext/date/lib/parse_date.c"
yy536:
YYDEBUG(536, *YYCURSOR);
yych = *++YYCURSOR;
@@ -11027,7 +11026,7 @@ yy605:
YYDEBUG(606, *YYCURSOR);
++YYCURSOR;
YYDEBUG(607, *YYCURSOR);
#line 1360 "ext/date/lib/parse_date.re"
#line 1359 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pointed date YYYY");
TIMELIB_INIT;
@@ -11038,7 +11037,7 @@ yy605:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 11042 "ext/date/lib/parse_date.c"
#line 11041 "ext/date/lib/parse_date.c"
yy608:
YYDEBUG(608, *YYCURSOR);
yyaccept = 11;
@@ -11074,7 +11073,7 @@ yy611:
if (yych <= '9') goto yy605;
yy612:
YYDEBUG(612, *YYCURSOR);
#line 1372 "ext/date/lib/parse_date.re"
#line 1371 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pointed date YY");
@@ -11087,7 +11086,7 @@ yy612:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 11091 "ext/date/lib/parse_date.c"
#line 11090 "ext/date/lib/parse_date.c"
yy613:
YYDEBUG(613, *YYCURSOR);
yyaccept = 11;
@@ -11728,7 +11727,7 @@ yy656:
}
yy657:
YYDEBUG(657, *YYCURSOR);
#line 1331 "ext/date/lib/parse_date.re"
#line 1330 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshort");
@@ -11741,7 +11740,7 @@ yy657:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 11745 "ext/date/lib/parse_date.c"
#line 11744 "ext/date/lib/parse_date.c"
yy658:
YYDEBUG(658, *YYCURSOR);
yyaccept = 13;
@@ -11847,7 +11846,7 @@ yy666:
}
yy667:
YYDEBUG(667, *YYCURSOR);
#line 1275 "ext/date/lib/parse_date.re"
#line 1274 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("americanshort | american");
@@ -11862,7 +11861,7 @@ yy667:
TIMELIB_DEINIT;
return TIMELIB_AMERICAN;
}
#line 11866 "ext/date/lib/parse_date.c"
#line 11865 "ext/date/lib/parse_date.c"
yy668:
YYDEBUG(668, *YYCURSOR);
yyaccept = 14;
@@ -12095,7 +12094,7 @@ yy700:
if (yych <= ':') goto yy704;
yy701:
YYDEBUG(701, *YYCURSOR);
#line 1558 "ext/date/lib/parse_date.re"
#line 1557 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("clf");
@@ -12115,7 +12114,7 @@ yy701:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 12119 "ext/date/lib/parse_date.c"
#line 12118 "ext/date/lib/parse_date.c"
yy702:
YYDEBUG(702, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12667,7 +12666,7 @@ yy763:
}
yy764:
YYDEBUG(764, *YYCURSOR);
#line 1303 "ext/date/lib/parse_date.re"
#line 1302 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("iso8601date2");
@@ -12680,7 +12679,7 @@ yy764:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 12684 "ext/date/lib/parse_date.c"
#line 12683 "ext/date/lib/parse_date.c"
yy765:
YYDEBUG(765, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12719,7 +12718,7 @@ yy771:
YYDEBUG(771, *YYCURSOR);
++YYCURSOR;
YYDEBUG(772, *YYCURSOR);
#line 1544 "ext/date/lib/parse_date.re"
#line 1543 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextreverse");
@@ -12732,7 +12731,7 @@ yy771:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 12736 "ext/date/lib/parse_date.c"
#line 12735 "ext/date/lib/parse_date.c"
yy773:
YYDEBUG(773, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12870,7 +12869,7 @@ yy783:
}
yy784:
YYDEBUG(784, *YYCURSOR);
#line 1579 "ext/date/lib/parse_date.re"
#line 1578 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
@@ -12878,7 +12877,7 @@ yy784:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 12882 "ext/date/lib/parse_date.c"
#line 12881 "ext/date/lib/parse_date.c"
yy785:
YYDEBUG(785, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13029,7 +13028,7 @@ yy793:
}
yy794:
YYDEBUG(794, *YYCURSOR);
#line 1400 "ext/date/lib/parse_date.re"
#line 1399 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenodayrev");
@@ -13042,7 +13041,7 @@ yy794:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 13046 "ext/date/lib/parse_date.c"
#line 13045 "ext/date/lib/parse_date.c"
yy795:
YYDEBUG(795, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13257,7 +13256,7 @@ yy814:
if (yych <= '7') goto yy817;
yy815:
YYDEBUG(815, *YYCURSOR);
#line 1511 "ext/date/lib/parse_date.re"
#line 1510 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
@@ -13275,7 +13274,7 @@ yy815:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 13279 "ext/date/lib/parse_date.c"
#line 13278 "ext/date/lib/parse_date.c"
yy816:
YYDEBUG(816, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13285,7 +13284,7 @@ yy817:
YYDEBUG(817, *YYCURSOR);
++YYCURSOR;
YYDEBUG(818, *YYCURSOR);
#line 1492 "ext/date/lib/parse_date.re"
#line 1491 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
@@ -13303,7 +13302,7 @@ yy817:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 13307 "ext/date/lib/parse_date.c"
#line 13306 "ext/date/lib/parse_date.c"
yy819:
YYDEBUG(819, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13367,7 +13366,7 @@ yy821:
}
yy822:
YYDEBUG(822, *YYCURSOR);
#line 1478 "ext/date/lib/parse_date.re"
#line 1477 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgydotd");
@@ -13380,7 +13379,7 @@ yy822:
TIMELIB_DEINIT;
return TIMELIB_PG_YEARDAY;
}
#line 13384 "ext/date/lib/parse_date.c"
#line 13383 "ext/date/lib/parse_date.c"
yy823:
YYDEBUG(823, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13483,7 +13482,7 @@ yy842:
++YYCURSOR;
yy843:
YYDEBUG(843, *YYCURSOR);
#line 1452 "ext/date/lib/parse_date.re"
#line 1451 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
@@ -13508,7 +13507,7 @@ yy843:
TIMELIB_DEINIT;
return TIMELIB_XMLRPC_SOAP;
}
#line 13512 "ext/date/lib/parse_date.c"
#line 13511 "ext/date/lib/parse_date.c"
yy844:
YYDEBUG(844, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13770,7 +13769,7 @@ yy848:
}
yy849:
YYDEBUG(849, *YYCURSOR);
#line 1440 "ext/date/lib/parse_date.re"
#line 1439 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenocolon");
TIMELIB_INIT;
@@ -13781,7 +13780,7 @@ yy849:
TIMELIB_DEINIT;
return TIMELIB_DATE_NOCOLON;
}
#line 13785 "ext/date/lib/parse_date.c"
#line 13784 "ext/date/lib/parse_date.c"
yy850:
YYDEBUG(850, *YYCURSOR);
yych = *++YYCURSOR;
@@ -14701,7 +14700,7 @@ yy973:
if (yych <= '9') goto yy996;
yy974:
YYDEBUG(974, *YYCURSOR);
#line 1317 "ext/date/lib/parse_date.re"
#line 1316 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshorter");
@@ -14714,7 +14713,7 @@ yy974:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 14718 "ext/date/lib/parse_date.c"
#line 14717 "ext/date/lib/parse_date.c"
yy975:
YYDEBUG(975, *YYCURSOR);
yyaccept = 22;
@@ -15723,7 +15722,7 @@ yy1066:
}
yy1068:
YYDEBUG(1068, *YYCURSOR);
#line 1209 "ext/date/lib/parse_date.re"
#line 1208 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("gnunocolon");
TIMELIB_INIT;
@@ -15745,7 +15744,7 @@ yy1068:
TIMELIB_DEINIT;
return TIMELIB_GNU_NOCOLON;
}
#line 15749 "ext/date/lib/parse_date.c"
#line 15748 "ext/date/lib/parse_date.c"
yy1069:
YYDEBUG(1069, *YYCURSOR);
yych = *++YYCURSOR;
@@ -15837,7 +15836,7 @@ yy1075:
}
yy1076:
YYDEBUG(1076, *YYCURSOR);
#line 1255 "ext/date/lib/parse_date.re"
#line 1254 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("iso8601nocolon");
@@ -15856,7 +15855,7 @@ yy1076:
TIMELIB_DEINIT;
return TIMELIB_ISO_NOCOLON;
}
#line 15860 "ext/date/lib/parse_date.c"
#line 15859 "ext/date/lib/parse_date.c"
yy1077:
YYDEBUG(1077, *YYCURSOR);
yyaccept = 25;
@@ -16754,7 +16753,7 @@ yy1117:
}
yy1118:
YYDEBUG(1118, *YYCURSOR);
#line 1651 "ext/date/lib/parse_date.re"
#line 1650 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -16770,7 +16769,7 @@ yy1118:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 16774 "ext/date/lib/parse_date.c"
#line 16773 "ext/date/lib/parse_date.c"
yy1119:
YYDEBUG(1119, *YYCURSOR);
++YYCURSOR;
@@ -16821,7 +16820,7 @@ yy1126:
YYDEBUG(1126, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1127, *YYCURSOR);
#line 1124 "ext/date/lib/parse_date.re"
#line 1123 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -16842,7 +16841,7 @@ yy1126:
TIMELIB_DEINIT;
return TIMELIB_WEEK_DAY_OF_MONTH;
}
#line 16846 "ext/date/lib/parse_date.c"
#line 16845 "ext/date/lib/parse_date.c"
yy1128:
YYDEBUG(1128, *YYCURSOR);
yyaccept = 26;
@@ -16950,7 +16949,7 @@ yy1141:
}
yy1142:
YYDEBUG(1142, *YYCURSOR);
#line 1627 "ext/date/lib/parse_date.re"
#line 1626 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -16973,7 +16972,7 @@ yy1142:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 16977 "ext/date/lib/parse_date.c"
#line 16976 "ext/date/lib/parse_date.c"
yy1143:
YYDEBUG(1143, *YYCURSOR);
yych = *++YYCURSOR;
@@ -19650,7 +19649,7 @@ yy1294:
goto yy1298;
yy1295:
YYDEBUG(1295, *YYCURSOR);
#line 1101 "ext/date/lib/parse_date.re"
#line 1100 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("backof | frontof");
TIMELIB_INIT;
@@ -19672,7 +19671,7 @@ yy1295:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 19676 "ext/date/lib/parse_date.c"
#line 19675 "ext/date/lib/parse_date.c"
yy1296:
YYDEBUG(1296, *YYCURSOR);
yyaccept = 28;
@@ -21363,7 +21362,7 @@ yy1385:
if (yych <= '9') goto yy1385;
yy1387:
YYDEBUG(1387, *YYCURSOR);
#line 1058 "ext/date/lib/parse_date.re"
#line 1057 "ext/date/lib/parse_date.re"
{
timelib_ull i;
@@ -21388,7 +21387,7 @@ yy1387:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 21392 "ext/date/lib/parse_date.c"
#line 21391 "ext/date/lib/parse_date.c"
yy1388:
YYDEBUG(1388, *YYCURSOR);
yych = *++YYCURSOR;
@@ -21824,7 +21823,7 @@ yy1416:
++YYCURSOR;
yy1417:
YYDEBUG(1417, *YYCURSOR);
#line 1046 "ext/date/lib/parse_date.re"
#line 1045 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("tomorrow");
TIMELIB_INIT;
@@ -21835,7 +21834,7 @@ yy1417:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 21839 "ext/date/lib/parse_date.c"
#line 21838 "ext/date/lib/parse_date.c"
yy1418:
YYDEBUG(1418, *YYCURSOR);
yych = *++YYCURSOR;
@@ -21870,7 +21869,7 @@ yy1419:
}
yy1420:
YYDEBUG(1420, *YYCURSOR);
#line 1036 "ext/date/lib/parse_date.re"
#line 1035 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("midnight | today");
TIMELIB_INIT;
@@ -21879,7 +21878,7 @@ yy1420:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 21883 "ext/date/lib/parse_date.c"
#line 21882 "ext/date/lib/parse_date.c"
yy1421:
YYDEBUG(1421, *YYCURSOR);
yych = *++YYCURSOR;
@@ -23891,7 +23890,7 @@ yy1499:
}
yy1500:
YYDEBUG(1500, *YYCURSOR);
#line 1015 "ext/date/lib/parse_date.re"
#line 1014 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("now");
TIMELIB_INIT;
@@ -23899,7 +23898,7 @@ yy1500:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 23903 "ext/date/lib/parse_date.c"
#line 23902 "ext/date/lib/parse_date.c"
yy1501:
YYDEBUG(1501, *YYCURSOR);
yych = *++YYCURSOR;
@@ -24038,7 +24037,7 @@ yy1507:
}
yy1508:
YYDEBUG(1508, *YYCURSOR);
#line 1024 "ext/date/lib/parse_date.re"
#line 1023 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("noon");
TIMELIB_INIT;
@@ -24049,7 +24048,7 @@ yy1508:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 24053 "ext/date/lib/parse_date.c"
#line 24052 "ext/date/lib/parse_date.c"
yy1509:
YYDEBUG(1509, *YYCURSOR);
yyaccept = 0;
@@ -24582,7 +24581,7 @@ yy1530:
++YYCURSOR;
yy1531:
YYDEBUG(1531, *YYCURSOR);
#line 1003 "ext/date/lib/parse_date.re"
#line 1002 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("yesterday");
TIMELIB_INIT;
@@ -24593,7 +24592,7 @@ yy1531:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 24597 "ext/date/lib/parse_date.c"
#line 24596 "ext/date/lib/parse_date.c"
yy1532:
YYDEBUG(1532, *YYCURSOR);
yyaccept = 0;
@@ -24766,7 +24765,7 @@ yy1537:
goto yy1531;
}
}
#line 1777 "ext/date/lib/parse_date.re"
#line 1776 "ext/date/lib/parse_date.re"
}
@@ -25036,7 +25035,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
TIMELIB_CHECK_NUMBER;
sec = timelib_get_nr_ex((char **) &ptr, 2, &length);
if (sec == TIMELIB_UNSET || length != 2) {
add_pbf_error(s, "A two digit second could not be found", string, begin);
add_pbf_error(s, "A two second minute could not be found", string, begin);
} else {
s->time->s = sec;
}
@@ -25124,7 +25123,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
break;
case '\\': /* escaped char */
fptr++;
*fptr++;
if (*ptr == *fptr) {
++ptr;
} else {
+3 -4
View File
@@ -649,8 +649,7 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr)
char *begin = *ptr, *end;
const timelib_relunit *tp, *value = NULL;
while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t' && **ptr != ';' && **ptr != ':' &&
**ptr != '/' && **ptr != '.' && **ptr != '-' && **ptr != '(' && **ptr != ')' ) {
while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t') {
++*ptr;
}
end = *ptr;
@@ -2043,7 +2042,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
TIMELIB_CHECK_NUMBER;
sec = timelib_get_nr_ex((char **) &ptr, 2, &length);
if (sec == TIMELIB_UNSET || length != 2) {
add_pbf_error(s, "A two digit second could not be found", string, begin);
add_pbf_error(s, "A two second minute could not be found", string, begin);
} else {
s->time->s = sec;
}
@@ -2131,7 +2130,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
break;
case '\\': /* escaped char */
fptr++;
*fptr++;
if (*ptr == *fptr) {
++ptr;
} else {
+930 -922
View File
File diff suppressed because it is too large. Load diff
+10 -15
View File
@@ -997,7 +997,7 @@ char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
static char *date_format(char *format, int format_len, timelib_time *t, int localtime)
{
smart_str string = {0};
int i, length = 0;
int i, length;
char buffer[97];
timelib_time_offset *offset = NULL;
timelib_sll isoweek, isoyear;
@@ -1352,7 +1352,7 @@ PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb)
}
/* }}} */
/* {{{ php_parse_date: Backwards compatibility function */
/* {{{ php_parse_date: Backwards compability function */
PHPAPI signed long php_parse_date(char *string, signed long *now)
{
timelib_time *parsed_time;
@@ -1362,7 +1362,6 @@ PHPAPI signed long php_parse_date(char *string, signed long *now)
parsed_time = timelib_strtotime(string, strlen(string), &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
if (error->error_count) {
timelib_time_dtor(parsed_time);
timelib_error_container_dtor(error);
return -1;
}
@@ -2114,13 +2113,13 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC)
/* first we add the date and time in ISO format */
MAKE_STD_ZVAL(zv);
ZVAL_STRING(zv, date_format("Y-m-d H:i:s", 12, dateobj->time, 1), 0);
zend_hash_update(props, "date", 5, &zv, sizeof(zv), NULL);
zend_hash_update(props, "date", 5, &zv, sizeof(zval), NULL);
/* then we add the timezone name (or similar) */
if (dateobj->time->is_localtime) {
MAKE_STD_ZVAL(zv);
ZVAL_LONG(zv, dateobj->time->zone_type);
zend_hash_update(props, "timezone_type", 14, &zv, sizeof(zv), NULL);
zend_hash_update(props, "timezone_type", 14, &zv, sizeof(zval), NULL);
MAKE_STD_ZVAL(zv);
switch (dateobj->time->zone_type) {
@@ -2143,7 +2142,7 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC)
ZVAL_STRING(zv, dateobj->time->tz_abbr, 1);
break;
}
zend_hash_update(props, "timezone", 9, &zv, sizeof(zv), NULL);
zend_hash_update(props, "timezone", 9, &zv, sizeof(zval), NULL);
}
return props;
@@ -2266,7 +2265,7 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC)
#define PHP_DATE_INTERVAL_ADD_PROPERTY(n,f) \
MAKE_STD_ZVAL(zv); \
ZVAL_LONG(zv, (long)intervalobj->diff->f); \
zend_hash_update(props, n, strlen(n) + 1, &zv, sizeof(zv), NULL);
zend_hash_update(props, n, strlen(n) + 1, &zv, sizeof(zval), NULL);
PHP_DATE_INTERVAL_ADD_PROPERTY("y", y);
PHP_DATE_INTERVAL_ADD_PROPERTY("m", m);
@@ -2283,7 +2282,7 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC)
} else {
MAKE_STD_ZVAL(zv);
ZVAL_FALSE(zv);
zend_hash_update(props, "days", 5, &zv, sizeof(zv), NULL);
zend_hash_update(props, "days", 5, &zv, sizeof(zval), NULL);
}
PHP_DATE_INTERVAL_ADD_PROPERTY("special_type", special.type);
PHP_DATE_INTERVAL_ADD_PROPERTY("special_amount", special.amount);
@@ -2410,8 +2409,8 @@ PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str,
timelib_time *now;
timelib_tzinfo *tzi = NULL;
timelib_error_container *err = NULL;
int type = TIMELIB_ZONETYPE_ID, new_dst = 0;
char *new_abbr = NULL;
int type = TIMELIB_ZONETYPE_ID, new_dst;
char *new_abbr;
timelib_sll new_offset;
if (dateobj->time) {
@@ -3569,11 +3568,7 @@ zval *date_interval_read_property(zval *object, zval *member, int type, const ze
ALLOC_INIT_ZVAL(retval);
Z_SET_REFCOUNT_P(retval, 0);
if (value != -99999) {
ZVAL_LONG(retval, value);
} else {
ZVAL_FALSE(retval);
}
ZVAL_LONG(retval, value);
if (member == &tmp_member) {
zval_dtor(member);
+1 -1
View File
@@ -165,7 +165,7 @@ ZEND_END_MODULE_GLOBALS(date)
#define DATEG(v) (date_globals.v)
#endif
/* Backwards compatibility wrapper */
/* Backwards compability wrapper */
PHPAPI signed long php_parse_date(char *string, signed long *now);
PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt);
PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC);
@@ -1,10 +0,0 @@
--TEST--
Wrong var_dump(DateInterval->days) value
--FILE--
<?php
$interval = new DateInterval('P2Y4DT6H8M');
var_dump($interval->days);
--EXPECT--
bool(false)
@@ -1,29 +0,0 @@
--TEST--
Test fix for DateTime when date have textual day with dot or other special char at end
--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('2012-11-29 17:00:00');
// String to parse
$string = "Thu., Nov. 29, 2012 5:00PM";
// Create a DateTime object from format
$fromFormat = DateTime::createFromFormat( "D., M# j, Y g:iA", $string );
echo "Format method: " . $orig->format("D., M. j, Y g:iA") . "\n";
echo "createFromFormat method: " . $fromFormat->format("D., M. j, Y g:iA") . "\n";
?>
===DONE===
--EXPECTF--
*** Testing clone on DateTime objects ***
Format method: Thu., Nov. 29, 2012 5:00PM
createFromFormat method: Thu., Nov. 29, 2012 5:00PM
===DONE===
-14
View File
@@ -1,14 +0,0 @@
--TEST--
Test for bug #64157: DateTime::createFromFormat() reports confusing error message
--CREDITS--
Boro Sitnikovski <buritomath@yahoo.com>
--INI--
date.timezone = UTC
--FILE--
<?php
DateTime::createFromFormat('s', '0');
$lastErrors = DateTime::getLastErrors();
print_r($lastErrors['errors'][0]);
?>
--EXPECT--
A two digit second could not be found
+10 -25
View File
@@ -226,17 +226,12 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS
*key_free = *key_str;
return len;
} else {
zval tmp = *key;
int len;
*key_free = NULL;
zval_copy_ctor(&tmp);
convert_to_string(&tmp);
convert_to_string(key);
*key_str = Z_STRVAL_P(key);
*key_free = *key_str = estrndup(Z_STRVAL(tmp), Z_STRLEN(tmp));
len = Z_STRLEN(tmp);
zval_dtor(&tmp);
return len;
return Z_STRLEN_P(key);
}
}
/* }}} */
@@ -302,14 +297,6 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS
RETURN_FALSE; \
}
/* the same check, but with a call to DBA_ID_DONE before returning */
#define DBA_WRITE_CHECK_WITH_ID \
if(info->mode != DBA_WRITER && info->mode != DBA_TRUNC && info->mode != DBA_CREAT) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "You cannot perform a modification to a database without proper access"); \
DBA_ID_DONE; \
RETURN_FALSE; \
}
/* }}} */
/* {{{ globals */
@@ -551,6 +538,7 @@ PHP_MINFO_FUNCTION(dba)
*/
static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode)
{
char *v;
int val_len;
zval *id;
dba_info *info = NULL;
@@ -570,7 +558,7 @@ static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode)
DBA_FETCH_RESOURCE(info, &id);
DBA_WRITE_CHECK_WITH_ID;
DBA_WRITE_CHECK;
if (info->hnd->update(info, key_str, key_len, val, val_len, mode TSRMLS_CC) == SUCCESS) {
DBA_ID_DONE;
@@ -625,8 +613,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
char *file_mode;
char mode[4], *pmode, *lock_file_mode = NULL;
int persistent_flag = persistent ? STREAM_OPEN_PERSISTENT : 0;
char *opened_path = NULL;
char *lock_name;
char *opened_path, *lock_name;
if(ac < 2) {
WRONG_PARAM_COUNT;
@@ -849,10 +836,8 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
if (!persistent) {
info->lock.name = opened_path;
} else {
if (opened_path) {
info->lock.name = pestrdup(opened_path, persistent);
efree(opened_path);
}
info->lock.name = pestrdup(opened_path, persistent);
efree(opened_path);
}
}
}
@@ -1126,7 +1111,7 @@ PHP_FUNCTION(dba_delete)
{
DBA_ID_GET2;
DBA_WRITE_CHECK_WITH_ID;
DBA_WRITE_CHECK;
if(info->hnd->delete(info, key_str, key_len TSRMLS_CC) == SUCCESS)
{
+1 -1
View File
@@ -460,7 +460,7 @@ static int inifile_filter(inifile *dba, inifile *from, const key_type *key TSRML
*/
static int inifile_delete_replace_append(inifile *dba, const key_type *key, const val_type *value, int append TSRMLS_DC)
{
size_t pos_grp_start = 0, pos_grp_next;
size_t pos_grp_start, pos_grp_next;
inifile *ini_tmp = NULL;
php_stream *fp_tmp = NULL;
int ret;
-38
View File
@@ -1,38 +0,0 @@
--TEST--
Bug #65708 (dba functions cast $key param to string in-place, bypassing copy on write)
--SKIPIF--
<?php
require_once(dirname(__FILE__) .'/skipif.inc');
?>
--FILE--
<?php
error_reporting(E_ALL);
require_once(dirname(__FILE__) .'/test.inc');
$db = dba_popen($db_filename, 'c');
$key = 1;
$copy = $key;
echo gettype($key)."\n";
echo gettype($copy)."\n";
dba_exists($key, $db);
echo gettype($key)."\n";
echo gettype($copy)."\n";
dba_close($db);
?>
--CLEAN--
<?php
require(dirname(__FILE__) .'/clean.inc');
?>
--EXPECT--
integer
integer
integer
integer
-4
View File
@@ -1089,11 +1089,7 @@ void dom_xpath_objects_free_storage(void *object TSRMLS_DC)
void dom_objects_free_storage(void *object TSRMLS_DC)
{
dom_object *intern = (dom_object *)object;
#if defined(__GNUC__) && __GNUC__ >= 3
int retcount __attribute__((unused)); /* keep compiler quiet */
#else
int retcount;
#endif
zend_object_std_dtor(&intern->std TSRMLS_CC);
+1 -1
View File
@@ -1,5 +1,5 @@
--TEST--
Bug #44648 (Attribute names not checked for well formedness)
Bug #44648 (Attribute names not checked for wellformedness)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
+1 -1
View File
@@ -74,7 +74,7 @@ const zend_function_entry php_dom_xpath_class_functions[] = {
static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int type) /* {{{ */
{
zval **args = NULL;
zval **args;
zval *retval;
int result, i, ret;
int error = 0;
+5 -7
View File
@@ -2643,7 +2643,6 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
} else {
decode = ImageInfo->decode_unicode_le;
}
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
if (zend_multibyte_encoding_converter(
(unsigned char**)pszInfoPtr,
&len,
@@ -2651,7 +2650,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
ByteCount,
zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC),
zend_multibyte_fetch_encoding(decode TSRMLS_CC)
TSRMLS_CC) == (size_t)-1) {
TSRMLS_CC) < 0) {
len = exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount);
}
return len;
@@ -2664,7 +2663,6 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
*pszEncoding = estrdup((const char*)szValuePtr);
szValuePtr = szValuePtr+8;
ByteCount -= 8;
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
if (zend_multibyte_encoding_converter(
(unsigned char**)pszInfoPtr,
&len,
@@ -2672,7 +2670,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
ByteCount,
zend_multibyte_fetch_encoding(ImageInfo->encode_jis TSRMLS_CC),
zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? ImageInfo->decode_jis_be : ImageInfo->decode_jis_le TSRMLS_CC)
TSRMLS_CC) == (size_t)-1) {
TSRMLS_CC) < 0) {
len = exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount);
}
return len;
@@ -2702,8 +2700,8 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
static int exif_process_unicode(image_info_type *ImageInfo, xp_field_type *xp_field, int tag, char *szValuePtr, int ByteCount TSRMLS_DC)
{
xp_field->tag = tag;
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
/* Copy the comment */
if (zend_multibyte_encoding_converter(
(unsigned char**)&xp_field->value,
&xp_field->size,
@@ -2711,7 +2709,7 @@ static int exif_process_unicode(image_info_type *ImageInfo, xp_field_type *xp_fi
ByteCount,
zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC),
zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? ImageInfo->decode_unicode_be : ImageInfo->decode_unicode_le TSRMLS_CC)
TSRMLS_CC) == (size_t)-1) {
TSRMLS_CC) < 0) {
xp_field->size = exif_process_string_raw(&xp_field->value, szValuePtr, ByteCount);
}
return xp_field->size;
-9
View File
@@ -1,9 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://www.getid3.org/temp/62523.jpg">here</a>.</p>
<hr>
<address>Apache Server at getid3.org Port 80</address>
</body></html>
-18
View File
@@ -1,18 +0,0 @@
--TEST--
Bug 62523 (php crashes with segfault when exif_read_data called)
--SKIPIF--
<?php
extension_loaded("exif") or die("skip need exif");
?>
--FILE--
<?php
echo "Test\n";
var_dump(count(exif_read_data(__DIR__."/bug62523_1.jpg")));
?>
Done
--EXPECTF--
Test
Warning: exif_read_data(bug62523_1.jpg): File not supported in %sbug62523_1.php on line %d
int(1)
Done
Binary file not shown.

Before

Width:  |  Height:  |  Size: 504 KiB

-16
View File
@@ -1,16 +0,0 @@
--TEST--
Bug 62523 (php crashes with segfault when exif_read_data called)
--SKIPIF--
<?php
extension_loaded("exif") or die("skip need exif");
?>
--FILE--
<?php
echo "Test\n";
var_dump(count(exif_read_data(__DIR__."/bug62523_2.jpg")));
?>
Done
--EXPECT--
Test
int(76)
Done
-12
View File
@@ -1,12 +0,0 @@
<html>
<head><title>Found</title></head>
<body>
<h1>Found</h1>
<p>The resource was found at <a href="http://dl.dropboxusercontent.com/u/7562584/Bugs/Php/bad_exif.jpeg">http://dl.dropboxusercontent.com/u/7562584/Bugs/Php/bad_exif.jpeg</a>;
you should be redirected automatically.
<!-- --></p>
<hr noshade>
<div align="right">WSGI Server</div>
</body>
</html>
-18
View File
@@ -1,18 +0,0 @@
--TEST--
Bug 62523 (php crashes with segfault when exif_read_data called)
--SKIPIF--
<?php
extension_loaded("exif") or die("skip need exif");
?>
--FILE--
<?php
echo "Test\n";
var_dump(count(exif_read_data(__DIR__."/bug62523_3.jpg")));
?>
Done
--EXPECTF--
Test
Warning: exif_read_data(bug62523_3.jpg): File not supported in %sbug62523_3.php on line %d
int(1)
Done
Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

-14
View File
@@ -1,14 +0,0 @@
--TEST--
PHP crash when zend_multibyte_encoding_converter returns (size_t)-1)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
$infile = dirname(__FILE__).'/exif_encoding_crash.jpg';
$exif_data = exif_read_data($infile);
echo "*** no core dump ***\n";
?>
===DONE===
--EXPECT--
*** no core dump ***
===DONE===
+1 -1
View File
@@ -11969,7 +11969,7 @@
#>65 string ZSYS (Pre-System 7 system file)
#>65 string acf3 (Aldus FreeHand)
#>65 string cdev (control panel)
#>65 string dfil (Desk Accessory suitcase)
#>65 string dfil (Desk Acessory suitcase)
#>65 string libr (library)
#>65 string nX^d (WriteNow word processor)
#>65 string nX^w (WriteNow dictionary)
+4 -1
View File
@@ -484,6 +484,10 @@ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
}
s++;
}
if (*(e - 1) == '.') {
goto bad_url;
}
}
if (
@@ -714,7 +718,6 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
if (flags & FILTER_FLAG_NO_RES_RANGE) {
if (
(ip[0] == 0) ||
(ip[0] == 100 && (ip[1] >= 64 && ip[1] <= 127)) ||
(ip[0] == 128 && ip[1] == 0) ||
(ip[0] == 191 && ip[1] == 255) ||
(ip[0] == 169 && ip[1] == 254) ||
-4
View File
@@ -15,8 +15,6 @@ var_dump(filter_var("192.168.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE
var_dump(filter_var("192.0.34.166", FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE));
var_dump(filter_var("127.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var("192.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var("100.64.0.0", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var("100.127.255.255", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var("192.0.34.166", FILTER_VALIDATE_IP));
var_dump(filter_var("256.1237.123.1", FILTER_VALIDATE_IP));
var_dump(filter_var("255.255.255.255", FILTER_VALIDATE_IP));
@@ -42,8 +40,6 @@ bool(false)
string(12) "192.0.34.166"
bool(false)
string(9) "192.0.0.1"
bool(false)
bool(false)
string(12) "192.0.34.166"
bool(false)
string(15) "255.255.255.255"
-11
View File
@@ -1,11 +0,0 @@
--TEST--
bug 64441, FILTER_VALIDATE_URL will invalidate a hostname that ended by dot
--SKIPIF--
<?php if (!extension_loaded("filter")) die("skip"); ?>
--FILE--
<?php
var_dump(filter_var('http://example.com./', FILTER_VALIDATE_URL));
var_dump(filter_var('http://example.com/', FILTER_VALIDATE_URL));
--EXPECT--
string(20) "http://example.com./"
string(19) "http://example.com/"
+41 -23
View File
@@ -39,7 +39,7 @@
#ifdef PHP_WIN32
#include <winsock2.h>
#elif defined(NETWARE)
#ifdef USE_WINSOCK /* Modified to use Winsock (NOVSOCK2.H), at least for now */
#ifdef USE_WINSOCK /* Modified to use Winsock (NOVSOCK2.H), atleast for now */
#include <novsock2.h>
#else
#include <sys/socket.h>
@@ -612,7 +612,7 @@ ftp_chmod(ftpbuf_t *ftp, const int mode, const char *filename, const int filenam
/* {{{ ftp_alloc
*/
int
ftp_alloc(ftpbuf_t *ftp, const long size, char **response)
ftp_alloc(ftpbuf_t *ftp, const int size, char **response)
{
char buffer[64];
@@ -620,8 +620,8 @@ ftp_alloc(ftpbuf_t *ftp, const long size, char **response)
return 0;
}
snprintf(buffer, sizeof(buffer) - 1, "%ld", size);
snprintf(buffer, sizeof(buffer) - 1, "%d", size);
if (!ftp_putcmd(ftp, "ALLO", buffer)) {
return 0;
}
@@ -630,7 +630,7 @@ ftp_alloc(ftpbuf_t *ftp, const long size, char **response)
return 0;
}
if (response) {
if (response && ftp->inbuf) {
*response = estrdup(ftp->inbuf);
}
@@ -787,7 +787,7 @@ ftp_pasv(ftpbuf_t *ftp, int pasv)
/* {{{ ftp_get
*/
int
ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC)
ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC)
{
databuf_t *data = NULL;
int lastch;
@@ -808,7 +808,11 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
ftp->data = data;
if (resumepos > 0) {
snprintf(arg, sizeof(arg), "%ld", resumepos);
if (resumepos > 2147483647) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater than 2147483647 bytes.");
goto bail;
}
snprintf(arg, sizeof(arg), "%u", resumepos);
if (!ftp_putcmd(ftp, "REST", arg)) {
goto bail;
}
@@ -881,10 +885,10 @@ bail:
/* {{{ ftp_put
*/
int
ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC)
ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC)
{
databuf_t *data = NULL;
long size;
int size;
char *ptr;
int ch;
char arg[11];
@@ -901,7 +905,11 @@ ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, l
ftp->data = data;
if (startpos > 0) {
snprintf(arg, sizeof(arg), "%ld", startpos);
if (startpos > 2147483647) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater than 2147483647 bytes.");
goto bail;
}
snprintf(arg, sizeof(arg), "%u", startpos);
if (!ftp_putcmd(ftp, "REST", arg)) {
goto bail;
}
@@ -958,7 +966,7 @@ bail:
/* {{{ ftp_size
*/
long
int
ftp_size(ftpbuf_t *ftp, const char *path)
{
if (ftp == NULL) {
@@ -973,7 +981,7 @@ ftp_size(ftpbuf_t *ftp, const char *path)
if (!ftp_getresp(ftp) || ftp->resp != 213) {
return -1;
}
return atol(ftp->inbuf);
return atoi(ftp->inbuf);
}
/* }}} */
@@ -1135,7 +1143,7 @@ ftp_putcmd(ftpbuf_t *ftp, const char *cmd, const char *args)
int
ftp_readline(ftpbuf_t *ftp)
{
long size, rcvd;
int size, rcvd;
char *data, *eol;
/* shift the extra to the front */
@@ -1228,8 +1236,7 @@ ftp_getresp(ftpbuf_t *ftp)
int
my_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len)
{
long size, sent;
int n;
int n, size, sent;
size = len;
while (size) {
@@ -1643,7 +1650,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
if (ftp->resp == 226) {
ftp->data = data_close(ftp, data);
php_stream_close(tmpstream);
return ecalloc(1, sizeof(char*));
return ecalloc(1, sizeof(char**));
}
/* pull data buffer into tmpfile */
@@ -1671,11 +1678,11 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
}
}
ftp->data = data_close(ftp, data);
ftp->data = data = data_close(ftp, data);
php_stream_rewind(tmpstream);
ret = safe_emalloc((lines + 1), sizeof(char*), size);
ret = safe_emalloc((lines + 1), sizeof(char**), size * sizeof(char*));
entry = ret;
text = (char*) (ret + lines + 1);
@@ -1712,7 +1719,7 @@ bail:
/* {{{ ftp_nb_get
*/
int
ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC)
ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC)
{
databuf_t *data = NULL;
char arg[11];
@@ -1730,7 +1737,14 @@ ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t typ
}
if (resumepos>0) {
snprintf(arg, sizeof(arg), "%ld", resumepos);
/* We are working on an architecture that supports 64-bit integers
* since php is 32 bit by design, we bail out with warning
*/
if (resumepos > 2147483647) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater than 2147483648 bytes.");
goto bail;
}
snprintf(arg, sizeof(arg), "%u", resumepos);
if (!ftp_putcmd(ftp, "REST", arg)) {
goto bail;
}
@@ -1829,7 +1843,7 @@ bail:
/* {{{ ftp_nb_put
*/
int
ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC)
ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC)
{
databuf_t *data = NULL;
char arg[11];
@@ -1844,7 +1858,11 @@ ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type
goto bail;
}
if (startpos > 0) {
snprintf(arg, sizeof(arg), "%ld", startpos);
if (startpos > 2147483647) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater than 2147483647 bytes.");
goto bail;
}
snprintf(arg, sizeof(arg), "%u", startpos);
if (!ftp_putcmd(ftp, "REST", arg)) {
goto bail;
}
@@ -1881,7 +1899,7 @@ bail:
int
ftp_nb_continue_write(ftpbuf_t *ftp TSRMLS_DC)
{
long size;
int size;
char *ptr;
int ch;
+6 -6
View File
@@ -146,7 +146,7 @@ int ftp_chmod(ftpbuf_t *ftp, const int mode, const char *filename, const int fi
* however some servers will not accept STOR or APPE until ALLO is confirmed.
* If response is passed, it is estrdup()ed from ftp->inbuf and must be freed
* or assigned to a zval returned to the user */
int ftp_alloc(ftpbuf_t *ftp, const long size, char **response);
int ftp_alloc(ftpbuf_t *ftp, const int size, char **response);
/* returns a NULL-terminated array of filenames in the given path
* or NULL on error. the return array must be freed (but don't
@@ -169,15 +169,15 @@ int ftp_pasv(ftpbuf_t *ftp, int pasv);
/* retrieves a file and saves its contents to outfp
* returns true on success, false on error
*/
int ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC);
int ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC);
/* stores the data from a file, socket, or process as a file on the remote server
* returns true on success, false on error
*/
int ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC);
int ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC);
/* returns the size of the given file, or -1 on error */
long ftp_size(ftpbuf_t *ftp, const char *path);
int ftp_size(ftpbuf_t *ftp, const char *path);
/* returns the last modified time of the given file, or -1 on error */
time_t ftp_mdtm(ftpbuf_t *ftp, const char *path);
@@ -194,12 +194,12 @@ int ftp_site(ftpbuf_t *ftp, const char *cmd);
/* retrieves part of a file and saves its contents to outfp
* returns true on success, false on error
*/
int ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC);
int ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC);
/* stores the data from a file, socket, or process as a file on the remote server
* returns true on success, false on error
*/
int ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC);
int ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC);
/* continues a previous nb_(f)get command
*/
+7 -7
View File
@@ -784,8 +784,8 @@ PHP_FUNCTION(ftp_nb_fget)
ftptype_t xtype;
php_stream *stream;
char *file;
int file_len;
long mode, resumepos=0, ret;
int file_len, ret;
long mode, resumepos=0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsl|l", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) {
return;
@@ -968,7 +968,7 @@ PHP_FUNCTION(ftp_nb_get)
RETURN_LONG(PHP_FTP_FAILED);
}
if (ret == PHP_FTP_FINISHED){
if (ret == PHP_FTP_FINISHED) {
php_stream_close(outstream);
}
@@ -982,7 +982,7 @@ PHP_FUNCTION(ftp_nb_continue)
{
zval *z_ftp;
ftpbuf_t *ftp;
long ret;
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_ftp) == FAILURE) {
return;
@@ -1120,7 +1120,7 @@ PHP_FUNCTION(ftp_put)
ftpbuf_t *ftp;
ftptype_t xtype;
char *remote, *local;
long remote_len, local_len;
int remote_len, local_len;
long mode, startpos=0;
php_stream *instream;
@@ -1173,8 +1173,8 @@ PHP_FUNCTION(ftp_nb_put)
ftpbuf_t *ftp;
ftptype_t xtype;
char *remote, *local;
int remote_len, local_len;
long mode, startpos=0, ret;
int remote_len, local_len, ret;
long mode, startpos=0;
php_stream *instream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) {
-23
View File
@@ -1,23 +0,0 @@
--TEST--
Verify php can handle filesizes >32bit
--SKIPIF--
<?php
require 'skipif.inc';
if (2147483647 == PHP_INT_MAX) {
die('skip 64-bit only');
}
?>
--FILE--
<?php
require 'server.inc';
$ftp = ftp_connect('127.0.0.1', $port);
if (!$ftp) die("Couldn't connect to the server");
ftp_login($ftp, 'user', 'pass');
var_dump(ftp_size($ftp, 'largefile'));
ftp_close($ftp);
?>
--EXPECT--
int(5368709120)
-182
View File
@@ -1,182 +0,0 @@
--TEST--
Testing whether ftp_nb_continue() fetches more data
--SKIPIF--
<?php
require 'skipif.inc';
?>
--FILE--
<?php
require 'server.inc';
$file = "mediumfile.txt";
$ftp = ftp_connect('127.0.0.1', $port);
ftp_login($ftp, 'user', 'pass');
if (!$ftp) die("Couldn't connect to the server");
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . $file;
touch($local_file);
$r = ftp_nb_get($ftp, $local_file, $file, FTP_BINARY);
while ($r == FTP_MOREDATA) {
$r = ftp_nb_continue($ftp);
}
ftp_close($ftp);
echo file_get_contents($local_file);
?>
--CLEAN--
<?php
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "mediumfile.txt");
?>
--EXPECT--
This is line 0 of the test data.
This is line 1 of the test data.
This is line 2 of the test data.
This is line 3 of the test data.
This is line 4 of the test data.
This is line 5 of the test data.
This is line 6 of the test data.
This is line 7 of the test data.
This is line 8 of the test data.
This is line 9 of the test data.
This is line 10 of the test data.
This is line 11 of the test data.
This is line 12 of the test data.
This is line 13 of the test data.
This is line 14 of the test data.
This is line 15 of the test data.
This is line 16 of the test data.
This is line 17 of the test data.
This is line 18 of the test data.
This is line 19 of the test data.
This is line 20 of the test data.
This is line 21 of the test data.
This is line 22 of the test data.
This is line 23 of the test data.
This is line 24 of the test data.
This is line 25 of the test data.
This is line 26 of the test data.
This is line 27 of the test data.
This is line 28 of the test data.
This is line 29 of the test data.
This is line 30 of the test data.
This is line 31 of the test data.
This is line 32 of the test data.
This is line 33 of the test data.
This is line 34 of the test data.
This is line 35 of the test data.
This is line 36 of the test data.
This is line 37 of the test data.
This is line 38 of the test data.
This is line 39 of the test data.
This is line 40 of the test data.
This is line 41 of the test data.
This is line 42 of the test data.
This is line 43 of the test data.
This is line 44 of the test data.
This is line 45 of the test data.
This is line 46 of the test data.
This is line 47 of the test data.
This is line 48 of the test data.
This is line 49 of the test data.
This is line 50 of the test data.
This is line 51 of the test data.
This is line 52 of the test data.
This is line 53 of the test data.
This is line 54 of the test data.
This is line 55 of the test data.
This is line 56 of the test data.
This is line 57 of the test data.
This is line 58 of the test data.
This is line 59 of the test data.
This is line 60 of the test data.
This is line 61 of the test data.
This is line 62 of the test data.
This is line 63 of the test data.
This is line 64 of the test data.
This is line 65 of the test data.
This is line 66 of the test data.
This is line 67 of the test data.
This is line 68 of the test data.
This is line 69 of the test data.
This is line 70 of the test data.
This is line 71 of the test data.
This is line 72 of the test data.
This is line 73 of the test data.
This is line 74 of the test data.
This is line 75 of the test data.
This is line 76 of the test data.
This is line 77 of the test data.
This is line 78 of the test data.
This is line 79 of the test data.
This is line 80 of the test data.
This is line 81 of the test data.
This is line 82 of the test data.
This is line 83 of the test data.
This is line 84 of the test data.
This is line 85 of the test data.
This is line 86 of the test data.
This is line 87 of the test data.
This is line 88 of the test data.
This is line 89 of the test data.
This is line 90 of the test data.
This is line 91 of the test data.
This is line 92 of the test data.
This is line 93 of the test data.
This is line 94 of the test data.
This is line 95 of the test data.
This is line 96 of the test data.
This is line 97 of the test data.
This is line 98 of the test data.
This is line 99 of the test data.
This is line 100 of the test data.
This is line 101 of the test data.
This is line 102 of the test data.
This is line 103 of the test data.
This is line 104 of the test data.
This is line 105 of the test data.
This is line 106 of the test data.
This is line 107 of the test data.
This is line 108 of the test data.
This is line 109 of the test data.
This is line 110 of the test data.
This is line 111 of the test data.
This is line 112 of the test data.
This is line 113 of the test data.
This is line 114 of the test data.
This is line 115 of the test data.
This is line 116 of the test data.
This is line 117 of the test data.
This is line 118 of the test data.
This is line 119 of the test data.
This is line 120 of the test data.
This is line 121 of the test data.
This is line 122 of the test data.
This is line 123 of the test data.
This is line 124 of the test data.
This is line 125 of the test data.
This is line 126 of the test data.
This is line 127 of the test data.
This is line 128 of the test data.
This is line 129 of the test data.
This is line 130 of the test data.
This is line 131 of the test data.
This is line 132 of the test data.
This is line 133 of the test data.
This is line 134 of the test data.
This is line 135 of the test data.
This is line 136 of the test data.
This is line 137 of the test data.
This is line 138 of the test data.
This is line 139 of the test data.
This is line 140 of the test data.
This is line 141 of the test data.
This is line 142 of the test data.
This is line 143 of the test data.
This is line 144 of the test data.
This is line 145 of the test data.
This is line 146 of the test data.
This is line 147 of the test data.
This is line 148 of the test data.
This is line 149 of the test data.
-36
View File
@@ -1,36 +0,0 @@
--TEST--
Testing ftp_nb_fget can handle large files incl. resume
--SKIPIF--
<?php
require 'skipif.inc';
if (2147483647 == PHP_INT_MAX) {
die('skip ot supported on this system');
}
if (disk_free_space(__DIR__) < 10*1024*1024*1024) {
die('not enough disk space');
}
?>
--FILE--
<?php
require 'server.inc';
$ftp = ftp_connect('127.0.0.1', $port);
ftp_login($ftp, 'user', 'pass');
if (!$ftp) die("Couldn't connect to the server");
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
touch($local_file);
ftp_nb_get($ftp, $local_file, 'fget_large.txt', FTP_BINARY, 5368709119);
$fp = fopen($local_file, 'r');
fseek($fp, 5368709119);
var_dump(fread($fp, 1));
var_dump(filesize($local_file));
fclose($fp);
?>
--CLEAN--
<?php
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
?>
--EXPECT--
string(1) "X"
int(5368709120)
+6 -24
View File
@@ -357,24 +357,7 @@ if ($pid) {
$transfer_type = $ascii? 'ASCII' : 'BINARY' ;
fputs($fs, "Bar\r\n");
fputs($s, "226 Closing data Connection.\r\n");
break;
case "fget_large":
fputs($s, "150 File status okay; about to open data connection.\r\n");
$transfer_type = $ascii? 'ASCII' : 'BINARY' ;
if ($GLOBALS['rest_pos'] == '5368709119') {
fputs($fs, "X");
} else {
fputs($fs, "Y");
}
fputs($s, "226 Closing data Connection.\r\n");
break;
case "mediumfile":
fputs($s, "150 File status okay; about to open data connection.\r\n");
for($i = 0; $i < 150; $i++){
fputs($fs, "This is line $i of the test data.\n");
}
fputs($s, "226 Closing data Connection.\r\n");
break;
default:
fputs($s, "550 {$matches[1]}: No such file or directory \r\n");
break;
@@ -410,12 +393,11 @@ if ($pid) {
}elseif (preg_match('/^LIST no_exists\//', $buf, $matches)) {
fputs($s, "425 Error establishing connection\r\n");
}elseif (preg_match('/^REST (\d+)/', $buf, $matches)) {
$GLOBALS['rest_pos'] = $matches[1];
}elseif (preg_match('/^REST \d+/', $buf, $matches)) {
fputs($s, "350 OK\r\n");
}elseif (preg_match('/^SIZE largefile/', $buf)) {
fputs($s, "213 5368709120\r\n");
}else {
}
else {
fputs($s, "500 Syntax error, command unrecognized.\r\n");
dump_and_exit($buf);
}
@@ -425,4 +407,4 @@ if ($pid) {
}
fclose($socket);
?>
?>
+1 -1
View File
@@ -61,7 +61,7 @@
PHPAPI extern const char php_sig_gif[3];
PHPAPI extern const char php_sig_jpg[3];
PHPAPI extern const char php_sig_png[8];
PHPAPI extern const char php_sig_png[3];
extern zend_module_entry gd_module_entry;
#define phpext_gd_ptr &gd_module_entry
+1 -1
View File
@@ -1069,7 +1069,7 @@ ZEND_FUNCTION(gmp_powm)
zval **base_arg, **exp_arg, **mod_arg;
mpz_t *gmpnum_base, *gmpnum_exp, *gmpnum_mod, *gmpnum_result;
int use_ui = 0;
int temp_base = 0, temp_exp = 0, temp_mod;
int temp_base, temp_exp, temp_mod;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZZ", &base_arg, &exp_arg, &mod_arg) == FAILURE){
return;
+2 -2
View File
@@ -198,9 +198,9 @@ if test "$PHP_IMAP" != "no"; then
AC_MSG_ERROR(Cannot find rfc822.h. Please check your c-client installation.)
fi
if test ! -r "$IMAP_DIR/c-client/libc-client.a" && test -r "$IMAP_DIR/c-client/c-client.a" ; then
if test -r "$IMAP_DIR/c-client/c-client.a"; then
ln -s "$IMAP_DIR/c-client/c-client.a" "$IMAP_DIR/c-client/libc-client.a" >/dev/null 2>&1
elif test ! -r "$IMAP_DIR/$PHP_LIBDIR/libc-client.a" && test -r "$IMAP_DIR/$PHP_LIBDIR/c-client.a"; then
elif test -r "$IMAP_DIR/$PHP_LIBDIR/c-client.a"; then
ln -s "$IMAP_DIR/$PHP_LIBDIR/c-client.a" "$IMAP_DIR/$PHP_LIBDIR/libc-client.a" >/dev/null 2>&1
fi
+1 -1
View File
@@ -130,7 +130,7 @@ void grapheme_substr_ascii(char *str, int str_len, int f, int l, int argc, char
/* {{{ grapheme_strpos_utf16 - strrpos using utf16*/
int grapheme_strpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned char*needle, int32_t needle_len, int32_t offset, int32_t *puchar_pos, int f_ignore_case, int last TSRMLS_DC)
{
UChar *uhaystack = NULL, *uneedle = NULL;
UChar *uhaystack = NULL, *puhaystack, *uneedle = NULL;
int32_t uhaystack_len = 0, uneedle_len = 0, char_pos, ret_pos, offset_pos = 0;
unsigned char u_break_iterator_buffer[U_BRK_SAFECLONE_BUFFERSIZE];
UBreakIterator* bi = NULL;
-3
View File
@@ -127,9 +127,6 @@ static char* getPreferredTag(char* gf_tag)
int grOffset = 0;
grOffset = findOffset( LOC_GRANDFATHERED ,gf_tag);
if(grOffset < 0) {
return NULL;
}
if( grOffset < LOC_PREFERRED_GRANDFATHERED_LEN ){
/* return preferred tag */
result = estrdup( LOC_PREFERRED_GRANDFATHERED[grOffset] );
+1 -1
View File
@@ -41,7 +41,7 @@ void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *so
case URES_STRING:
ufield = ures_getString( source->child, &ilen, &INTL_DATA_ERROR_CODE(source) );
INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve string value");
INTL_METHOD_RETVAL_UTF8(source, (UChar *)ufield, ilen, 0);
INTL_METHOD_RETVAL_UTF8(source, ufield, ilen, 0);
break;
case URES_BINARY:
@@ -162,8 +162,8 @@ PHP_FUNCTION( resourcebundle_create )
/* {{{ resourcebundle_array_fetch */
static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_value, int fallback TSRMLS_DC)
{
int32_t meindex = 0;
char * mekey = NULL;
int32_t meindex;
char * mekey;
long mekeylen;
zend_bool is_numeric = 0;
char *pbuf;
-1
View File
@@ -2107,7 +2107,6 @@ PHP_FUNCTION(ldap_set_rebind_proc)
/* unregister rebind procedure */
if (ld->rebindproc != NULL) {
zval_dtor(ld->rebindproc);
FREE_ZVAL(ld->rebindproc);
ld->rebindproc = NULL;
ldap_set_rebind_proc(ld->link, NULL, NULL);
}
+4 -16
View File
@@ -217,26 +217,14 @@ array(2) {
[1]=>
resource(%d) of type (ldap result)
}
array(1) {
["count"]=>
int(0)
}
array(1) {
["count"]=>
int(0)
}
NULL
NULL
array(2) {
[0]=>
resource(%d) of type (ldap result)
[1]=>
resource(%d) of type (ldap result)
}
array(1) {
["count"]=>
int(0)
}
array(1) {
["count"]=>
int(0)
}
NULL
NULL
===DONE===
@@ -142,7 +142,7 @@ const struct mbfl_convert_vtbl vtbl_wchar_2022jp_kddi = {
int
mbfl_filt_conv_2022jp_mobile_wchar(int c, mbfl_convert_filter *filter)
{
int c1, s, w, snd = 0;
int c1, s, w, snd;
retry:
switch (filter->status & 0xf) {
@@ -134,7 +134,7 @@ int
mbfl_filt_conv_jis2004_wchar(int c, mbfl_convert_filter *filter)
{
int k;
int c1, c2, s, s1 = 0, s2 = 0, w = 0, w1;
int c1, c2, s, s1, s2, w = 0, w1;
retry:
switch (filter->status & 0xf) {
@@ -605,7 +605,7 @@ mbfilter_unicode2sjis_emoji_sb(int c, int *s1, mbfl_convert_filter *filter)
int
mbfl_filt_conv_sjis_mobile_wchar(int c, mbfl_convert_filter *filter)
{
int c1, s, s1 = 0, s2 = 0, w;
int c1, s, s1, s2, w;
int snd = 0;
retry:
+92 -96
View File
@@ -79,7 +79,7 @@ const struct mbfl_convert_vtbl vtbl_utf8_wchar = {
mbfl_filt_conv_common_ctor,
mbfl_filt_conv_common_dtor,
mbfl_filt_conv_utf8_wchar,
mbfl_filt_conv_utf8_wchar_flush
mbfl_filt_conv_common_flush
};
const struct mbfl_convert_vtbl vtbl_wchar_utf8 = {
@@ -93,17 +93,6 @@ const struct mbfl_convert_vtbl vtbl_wchar_utf8 = {
#define CK(statement) do { if ((statement) < 0) return (-1); } while (0)
int mbfl_filt_put_invalid_char(int c, mbfl_convert_filter *filter)
{
int w;
w = c & MBFL_WCSGROUP_MASK;
w |= MBFL_WCSGROUP_THROUGH;
filter->status = 0;
filter->cache = 0;
CK((*filter->output_function)(w, filter->data));
}
/*
* UTF-8 => wchar
*/
@@ -111,104 +100,111 @@ int mbfl_filt_conv_utf8_wchar(int c, mbfl_convert_filter *filter)
{
int s, c1, w = 0, flag = 0;
retry:
switch (filter->status & 0xff) {
case 0x00:
if (c < 0x80) {
CK((*filter->output_function)(c, filter->data));
} else if (c >= 0xc2 && c <= 0xdf) { /* 2byte code first char: 0xc2-0xdf */
filter->status = 0x10;
filter->cache = c & 0x1f;
} else if (c >= 0xe0 && c <= 0xef) { /* 3byte code first char: 0xe0-0xef */
filter->status = 0x20;
filter->cache = c & 0xf;
} else if (c >= 0xf0 && c <= 0xf4) { /* 3byte code first char: 0xf0-0xf4 */
filter->status = 0x30;
filter->cache = c & 0x7;
} else {
mbfl_filt_put_invalid_char(c, filter);
}
break;
case 0x10: /* 2byte code 2nd char: 0x80-0xbf */
case 0x21: /* 3byte code 3rd char: 0x80-0xbf */
case 0x32: /* 4byte code 4th char: 0x80-0xbf */
filter->status = 0;
if (c >= 0x80 && c <= 0xbf) {
s = (filter->cache<<6) | (c & 0x3f);
if (c < 0x80) {
if (filter->status != 0) {
w = (filter->cache & MBFL_WCSGROUP_MASK) | MBFL_WCSGROUP_THROUGH;
CK((*filter->output_function)(w, filter->data));
filter->status = 0;
filter->cache = 0;
CK((*filter->output_function)(s, filter->data));
} else {
mbfl_filt_put_invalid_char(filter->cache, filter);
goto retry;
}
break;
case 0x20: /* 3byte code 2nd char: 0:0xa0-0xbf,D:0x80-9F,1-C,E-F:0x80-0x9f */
s = (filter->cache<<6) | (c & 0x3f);
c1 = filter->cache & 0xf;
if ((c >= 0x80 && c <= 0xbf) &&
((c1 == 0x0 && c >= 0xa0) ||
(c1 == 0xd && c < 0xa0) ||
(c1 > 0x0 && c1 != 0xd))) {
filter->cache = s;
if (c >= 0) {
CK((*filter->output_function)(c, filter->data));
}
} else if (c < 0xc0) {
int status = filter->status & 0xff;
switch (status) {
case 0x10: /* 2byte code 2nd char: 0x80-0xbf */
case 0x21: /* 3byte code 3rd char: 0x80-0xbf */
case 0x32: /* 4byte code 4th char: 0x80-0xbf */
filter->status = 0;
s = filter->cache | (c & 0x3f);
filter->cache = 0;
if ((status == 0x10 && s >= 0x80) ||
(status == 0x21 && s >= 0x800 && (s < 0xd800 || s > 0xdfff)) ||
(status == 0x32 && s >= 0x10000 && s < 0x110000)) {
CK((*filter->output_function)(s, filter->data));
} else {
w = s & MBFL_WCSGROUP_MASK;
flag = 1;
}
break;
case 0x20: /* 3byte code 2nd char: 0:0xa0-0xbf,D:0x80-9F,1-C,E-F:0x80-0x9f */
s = filter->cache | ((c & 0x3f) << 6);
c1 = (s >> 12) & 0xf;
if ((c1 == 0x0 && c >= 0xa0) ||
(c1 == 0xd && c < 0xa0) ||
(c1 > 0x0 && c1 != 0xd)) {
filter->cache = s;
filter->status++;
} else {
w = s & MBFL_WCSGROUP_MASK;
flag = 1;
}
break;
case 0x31: /* 4byte code 3rd char: 0x80-0xbf */
filter->cache |= ((c & 0x3f) << 6);
filter->status++;
} else {
mbfl_filt_put_invalid_char(filter->cache, filter);
goto retry;
break;
case 0x30: /* 4byte code 2nd char: 0:0x90-0xbf,1-3:0x80-0xbf,4:0x80-0x8f */
s = filter->cache | ((c & 0x3f) << 12);
c1 = (s >> 18) & 0x7;
if ((c1 == 0x0 && c >= 0x90) ||
(c1 > 0x0 && c1 < 0x4) ||
(c1 == 0x4 && c < 0x90)) {
filter->cache = s;
filter->status++;
} else {
w = s & MBFL_WCSGROUP_MASK;
flag = 1;
}
break;
default:
w = c & MBFL_WCSGROUP_MASK;
flag = 1;
break;
}
break;
case 0x30: /* 4byte code 2nd char: 0:0x90-0xbf,1-3:0x80-0xbf,4:0x80-0x8f */
s = (filter->cache<<6) | (c & 0x3f);
c1 = filter->cache & 0x7;
if ((c >= 0x80 && c <= 0xbf) &&
((c1 == 0x0 && c >= 0x90) ||
(c1 == 0x4 && c < 0x90) ||
(c1 > 0x0 && c1 != 0x4))) {
filter->cache = s;
filter->status++;
} else if (c < 0xc2) { /* invalid: 0xc0,0xc1 */
w = c & MBFL_WCSGROUP_MASK;
flag = 1;
} else if (c < 0xe0) { /* 2byte code first char: 0xc2-0xdf */
if (filter->status == 0x0) {
filter->status = 0x10;
filter->cache = (c & 0x1f) << 6;
} else {
mbfl_filt_put_invalid_char(filter->cache, filter);
goto retry;
w = c & MBFL_WCSGROUP_MASK;
flag = 1;
}
break;
case 0x31: /* 4byte code 3rd char: 0x80-0xbf */
if (c >= 0x80 && c <= 0xbf) {
filter->cache = (filter->cache<<6) | (c & 0x3f);
filter->status++;
} else if (c < 0xf0) { /* 3byte code first char: 0xe0-0xef */
if (filter->status == 0x0) {
filter->status = 0x20;
filter->cache = (c & 0xf) << 12;
} else {
mbfl_filt_put_invalid_char(filter->cache, filter);
goto retry;
w = c & MBFL_WCSGROUP_MASK;
flag = 1;
}
break;
default:
} else if (c < 0xf5) { /* 4byte code first char: 0xf0-0xf4 */
if (filter->status == 0x0) {
filter->status = 0x30;
filter->cache = (c & 0x7) << 18;
} else {
w = c & MBFL_WCSGROUP_MASK;
flag = 1;
}
} else {
w = c & MBFL_WCSGROUP_MASK;
flag = 1;
}
if (flag) {
w |= MBFL_WCSGROUP_THROUGH;
CK((*filter->output_function)(w, filter->data));
filter->status = 0;
break;
filter->cache = 0;
}
return c;
}
int mbfl_filt_conv_utf8_wchar_flush(mbfl_convert_filter *filter)
{
int status, cache;
status = filter->status;
cache = filter->cache;
filter->status = 0;
filter->cache = 0;
if (status != 0) {
mbfl_filt_put_invalid_char(cache, filter);
}
if (filter->flush_function != NULL) {
(*filter->flush_function)(filter->data);
}
return 0;
}
/*
* wchar => UTF-8
*/
@@ -37,6 +37,5 @@ extern const struct mbfl_convert_vtbl vtbl_wchar_utf8;
int mbfl_filt_conv_utf8_wchar(int c, mbfl_convert_filter *filter);
int mbfl_filt_conv_wchar_utf8(int c, mbfl_convert_filter *filter);
int mbfl_filt_conv_utf8_wchar_flush(mbfl_convert_filter *filter);
#endif /* MBFL_MBFILTER_UTF8_H */
@@ -37,7 +37,6 @@
#include "mbfilter_sjis_mobile.h"
extern int mbfl_filt_ident_utf8(int c, mbfl_identify_filter *filter);
extern int mbfl_filt_conv_utf8_wchar_flush(mbfl_convert_filter *filter);
extern const unsigned char mblen_table_utf8[];
@@ -116,7 +115,7 @@ const struct mbfl_convert_vtbl vtbl_utf8_docomo_wchar = {
mbfl_filt_conv_common_ctor,
mbfl_filt_conv_common_dtor,
mbfl_filt_conv_utf8_mobile_wchar,
mbfl_filt_conv_utf8_wchar_flush
mbfl_filt_conv_common_flush
};
const struct mbfl_convert_vtbl vtbl_wchar_utf8_docomo = {
@@ -134,7 +133,7 @@ const struct mbfl_convert_vtbl vtbl_utf8_kddi_a_wchar = {
mbfl_filt_conv_common_ctor,
mbfl_filt_conv_common_dtor,
mbfl_filt_conv_utf8_mobile_wchar,
mbfl_filt_conv_utf8_wchar_flush
mbfl_filt_conv_common_flush
};
const struct mbfl_convert_vtbl vtbl_wchar_utf8_kddi_a = {
@@ -152,7 +151,7 @@ const struct mbfl_convert_vtbl vtbl_utf8_kddi_b_wchar = {
mbfl_filt_conv_common_ctor,
mbfl_filt_conv_common_dtor,
mbfl_filt_conv_utf8_mobile_wchar,
mbfl_filt_conv_utf8_wchar_flush
mbfl_filt_conv_common_flush
};
const struct mbfl_convert_vtbl vtbl_wchar_utf8_kddi_b = {
@@ -170,7 +169,7 @@ const struct mbfl_convert_vtbl vtbl_utf8_sb_wchar = {
mbfl_filt_conv_common_ctor,
mbfl_filt_conv_common_dtor,
mbfl_filt_conv_utf8_mobile_wchar,
mbfl_filt_conv_utf8_wchar_flush
mbfl_filt_conv_common_flush
};
const struct mbfl_convert_vtbl vtbl_wchar_utf8_sb = {
@@ -192,97 +191,119 @@ int mbfl_filt_conv_utf8_mobile_wchar(int c, mbfl_convert_filter *filter)
int s, w = 0, flag = 0;
int s1 = 0, c1 = 0, snd = 0;
retry:
switch (filter->status & 0xff) {
case 0x00:
if (c < 0x80) {
if (c < 0x80) {
if (c >= 0) {
CK((*filter->output_function)(c, filter->data));
} else if (c >= 0xc2 && c <= 0xdf) { /* 2byte code first char: 0xc2-0xdf */
filter->status = 0x10;
filter->cache = c & 0x1f;
} else if (c >= 0xe0 && c <= 0xef) { /* 3byte code first char: 0xe0-0xef */
filter->status = 0x20;
filter->cache = c & 0xf;
} else if (c >= 0xf0 && c <= 0xf4) { /* 3byte code first char: 0xf0-0xf4 */
filter->status = 0x30;
filter->cache = c & 0x7;
} else {
mbfl_filt_put_invalid_char(c, filter);
}
break;
case 0x10: /* 2byte code 2nd char: 0x80-0xbf */
case 0x21: /* 3byte code 3rd char: 0x80-0xbf */
case 0x32: /* 4byte code 4th char: 0x80-0xbf */
filter->status = 0;
if (c >= 0x80 && c <= 0xbf) {
s = (filter->cache<<6) | (c & 0x3f);
} else if (c < 0xc0) {
int status = filter->status & 0xff;
switch (status) {
case 0x10: /* 2byte code 2nd char: 0x80-0xbf */
case 0x21: /* 3byte code 3rd char: 0x80-0xbf */
case 0x32: /* 4byte code 4th char: 0x80-0xbf */
filter->status = 0;
s = filter->cache | (c & 0x3f);
filter->cache = 0;
if ((status == 0x10 && s >= 0x80) ||
(status == 0x21 && s >= 0x800 && (s < 0xd800 || s > 0xdfff)) ||
(status == 0x32 && s >= 0x10000 && s < 0x110000)) {
if (filter->from->no_encoding == mbfl_no_encoding_utf8_docomo &&
mbfilter_conv_r_map_tbl(s, &s1, mbfl_docomo2uni_pua, 4) > 0) {
s = mbfilter_sjis_emoji_docomo2unicode(s1, &snd);
} else if (filter->from->no_encoding == mbfl_no_encoding_utf8_kddi_a &&
mbfilter_conv_r_map_tbl(s, &s1, mbfl_kddi2uni_pua, 7) > 0) {
s = mbfilter_sjis_emoji_kddi2unicode(s1, &snd);
} else if (filter->from->no_encoding == mbfl_no_encoding_utf8_kddi_b &&
mbfilter_conv_r_map_tbl(s, &s1, mbfl_kddi2uni_pua_b, 8) > 0) {
s = mbfilter_sjis_emoji_kddi2unicode(s1, &snd);
} else if (filter->from->no_encoding == mbfl_no_encoding_utf8_sb &&
mbfilter_conv_r_map_tbl(s, &s1, mbfl_sb2uni_pua, 6) > 0) {
s = mbfilter_sjis_emoji_sb2unicode(s1, &snd);
}
if (filter->from->no_encoding == mbfl_no_encoding_utf8_docomo &&
mbfilter_conv_r_map_tbl(s, &s1, mbfl_docomo2uni_pua, 4) > 0) {
s = mbfilter_sjis_emoji_docomo2unicode(s1, &snd);
} else if (filter->from->no_encoding == mbfl_no_encoding_utf8_kddi_a &&
mbfilter_conv_r_map_tbl(s, &s1, mbfl_kddi2uni_pua, 7) > 0) {
s = mbfilter_sjis_emoji_kddi2unicode(s1, &snd);
} else if (filter->from->no_encoding == mbfl_no_encoding_utf8_kddi_b &&
mbfilter_conv_r_map_tbl(s, &s1, mbfl_kddi2uni_pua_b, 8) > 0) {
s = mbfilter_sjis_emoji_kddi2unicode(s1, &snd);
} else if (filter->from->no_encoding == mbfl_no_encoding_utf8_sb &&
mbfilter_conv_r_map_tbl(s, &s1, mbfl_sb2uni_pua, 6) > 0) {
s = mbfilter_sjis_emoji_sb2unicode(s1, &snd);
if (snd > 0) {
CK((*filter->output_function)(snd, filter->data));
}
CK((*filter->output_function)(s, filter->data));
} else {
w = s & MBFL_WCSGROUP_MASK;
flag = 1;
}
if (snd > 0) {
CK((*filter->output_function)(snd, filter->data));
break;
case 0x20: /* 3byte code 2nd char: 0:0xa0-0xbf,D:0x80-9F,1-C,E-F:0x80-0x9f */
s = filter->cache | ((c & 0x3f) << 6);
c1 = (s >> 12) & 0xf;
if ((c1 == 0x0 && c >= 0xa0) ||
(c1 == 0xd && c < 0xa0) ||
(c1 > 0x0 && c1 != 0xd)) {
filter->cache = s;
filter->status++;
} else {
w = s & MBFL_WCSGROUP_MASK;
flag = 1;
}
CK((*filter->output_function)(s, filter->data));
} else {
mbfl_filt_put_invalid_char(filter->cache, filter);
goto retry;
}
break;
case 0x20: /* 3byte code 2nd char: 0:0xa0-0xbf,D:0x80-9F,1-C,E-F:0x80-0x9f */
s = (filter->cache<<6) | (c & 0x3f);
c1 = filter->cache & 0xf;
if ((c >= 0x80 && c <= 0xbf) &&
((c1 == 0x0 && c >= 0xa0) ||
(c1 == 0xd && c < 0xa0) ||
(c1 > 0x0 && c1 != 0xd))) {
filter->cache = s;
break;
case 0x31: /* 4byte code 3rd char: 0x80-0xbf */
filter->cache |= ((c & 0x3f) << 6);
filter->status++;
} else {
mbfl_filt_put_invalid_char(filter->cache, filter);
goto retry;
break;
case 0x30: /* 4byte code 2nd char: 0:0x90-0xbf,1-3:0x80-0xbf,4:0x80-0x8f */
s = filter->cache | ((c & 0x3f) << 12);
c1 = (s >> 18) & 0x7;
if ((c1 == 0x0 && c >= 0x90) ||
(c1 > 0x0 && c1 < 0x4) ||
(c1 == 0x4 && c < 0x90)) {
filter->cache = s;
filter->status++;
} else {
w = s & MBFL_WCSGROUP_MASK;
flag = 1;
}
break;
default:
w = c & MBFL_WCSGROUP_MASK;
flag = 1;
break;
}
break;
case 0x30: /* 4byte code 2nd char: 0:0x90-0xbf,1-3:0x80-0xbf,4:0x80-0x8f */
s = (filter->cache<<6) | (c & 0x3f);
c1 = filter->cache & 0x7;
if ((c >= 0x80 && c <= 0xbf) &&
((c1 == 0x0 && c >= 0x90) ||
(c1 == 0x4 && c < 0x90) ||
(c1 > 0x0 && c1 != 0x4))) {
filter->cache = s;
filter->status++;
} else if (c < 0xc2) { /* invalid: 0xc0,0xc1 */
w = c & MBFL_WCSGROUP_MASK;
flag = 1;
} else if (c < 0xe0) { /* 2byte code first char: 0xc2-0xdf */
if (filter->status == 0x0) {
filter->status = 0x10;
filter->cache = (c & 0x1f) << 6;
} else {
mbfl_filt_put_invalid_char(filter->cache, filter);
goto retry;
w = c & MBFL_WCSGROUP_MASK;
flag = 1;
}
break;
case 0x31: /* 4byte code 3rd char: 0x80-0xbf */
if (c >= 0x80 && c <= 0xbf) {
filter->cache = (filter->cache<<6) | (c & 0x3f);
filter->status++;
} else if (c < 0xf0) { /* 3byte code first char: 0xe0-0xef */
if (filter->status == 0x0) {
filter->status = 0x20;
filter->cache = (c & 0xf) << 12;
} else {
mbfl_filt_put_invalid_char(filter->cache, filter);
goto retry;
w = c & MBFL_WCSGROUP_MASK;
flag = 1;
}
break;
default:
} else if (c < 0xf5) { /* 4byte code first char: 0xf0-0xf4 */
if (filter->status == 0x0) {
filter->status = 0x30;
filter->cache = (c & 0x7) << 18;
} else {
w = c & MBFL_WCSGROUP_MASK;
flag = 1;
}
} else {
w = c & MBFL_WCSGROUP_MASK;
flag = 1;
}
if (flag) {
w |= MBFL_WCSGROUP_THROUGH;
CK((*filter->output_function)(w, filter->data));
filter->status = 0;
break;
filter->cache = 0;
}
return c;
+1 -1
View File
@@ -985,7 +985,7 @@ mbfl_strpos(
{
int result;
mbfl_string _haystack_u8, _needle_u8;
const mbfl_string *haystack_u8, *needle_u8 = NULL;
const mbfl_string *haystack_u8, *needle_u8;
const unsigned char *u8_tbl;
if (haystack == NULL || haystack->val == NULL || needle == NULL || needle->val == NULL) {
+1 -1
View File
@@ -673,7 +673,7 @@ History
2004/10/18: [impl] (thanks Imai Yasumasa)
enclose #include <sys/types.h> by #ifndef __BORLANDC__.
2004/10/18: [bug] (thanks Imai Yasumasa)
memory access violation in select_opt_exact_info().
memory acess violation in select_opt_exact_info().
2004/09/25: [dist] fix doc/API and doc/API.ja.
2004/09/25: [bug] fix OP_SEMI_END_BUF process in match_at() for
the case USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE
-29
View File
@@ -1,29 +0,0 @@
--TEST--
Bug #65045: mb_convert_encoding breaks well-formed character
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--FILE--
<?php
//declare(encoding = 'UTF-8');
mb_internal_encoding('UTF-8');
$str = "\xF0\xA4\xAD". "\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2";
$expected = "\xEF\xBF\xBD"."\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2";
$str2 = "\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD";
$expected2 = "\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2"."\xEF\xBF\xBD";
mb_substitute_character(0xFFFD);
var_dump(
$expected === htmlspecialchars_decode(htmlspecialchars($str, ENT_SUBSTITUTE, 'UTF-8')),
$expected2 === htmlspecialchars_decode(htmlspecialchars($str2, ENT_SUBSTITUTE, 'UTF-8')),
$expected === mb_convert_encoding($str, 'UTF-8', 'UTF-8'),
$expected2 === mb_convert_encoding($str2, 'UTF-8', 'UTF-8')
);
--EXPECT--
bool(true)
bool(true)
bool(true)
bool(true)
@@ -25,28 +25,28 @@ var_dump(chk_enc("\x31\x32\x33", 0));
var_dump(chk_enc("\x41\x42\x43", 0));
var_dump(chk_enc("\xc0\xb1\xc0\xb2\xc0\xb3", 6));
var_dump(chk_enc("\xc1\x81\xc1\x82\xc1\x83", 6));
var_dump(chk_enc("\xe0\x80\xb1\xe0\x80\xb2\xe0\x80\xb3", 9));
var_dump(chk_enc("\xe0\x81\x81\xe0\x81\x82\xe0\x81\x83", 9));
var_dump(chk_enc("\xf0\x80\x80\xb1\xf0\x80\x80\xb2\xf0\x80\x80\xb3", 12));
var_dump(chk_enc("\xf0\x80\x81\x81\xf0\x80\x81\x82\xf0\x81\x83", 11));
var_dump(chk_enc("\xe0\x80\xb1\xe0\x80\xb2\xe0\x80\xb3", 6));
var_dump(chk_enc("\xe0\x81\x81\xe0\x81\x82\xe0\x81\x83", 6));
var_dump(chk_enc("\xf0\x80\x80\xb1\xf0\x80\x80\xb2\xf0\x80\x80\xb3", 9));
var_dump(chk_enc("\xf0\x80\x81\x81\xf0\x80\x81\x82\xf0\x81\x83", 8));
var_dump(chk_enc("\xf8\x80\x80\x80\xb1\xf8\x80\x80\x80\xb2\xf8\x80\x80\x80\xb3", 15));
var_dump(chk_enc("\xf8\x80\x80\x81\x81\xf8\x80\x80\x81\x82\xf8\x80\x80\x81\x83", 15));
var_dump(chk_enc("\xfc\x80\x80\x80\x80\xb1\xfc\x80\x80\x80\x80\xb2\xfc\x80\x80\x80\x80\xb3", 18));
var_dump(chk_enc("\xfc\x80\x80\x80\x81\x81\xfc\x80\x80\x80\x81\x82\xfc\x80\x80\x80\x81\x83", 18));
var_dump(chk_enc("\xc2\xa2\xc2\xa3\xc2\xa5", 0));
var_dump(chk_enc("\xe0\x82\xa2\xe0\x82\xa3\xe0\x82\xa5", 9));
var_dump(chk_enc("\xf0\x80\x82\xa2\xf0\x80\x82\xa3\xf0\x80\x82\xa5", 12));
var_dump(chk_enc("\xe0\x82\xa2\xe0\x82\xa3\xe0\x82\xa5", 6));
var_dump(chk_enc("\xf0\x80\x82\xa2\xf0\x80\x82\xa3\xf0\x80\x82\xa5", 9));
var_dump(chk_enc("\xf8\x80\x80\x82\xa2\xf8\x80\x80\x82\xa3\xf8\x80\x80\x82\xa5", 15));
var_dump(chk_enc("\xfc\x80\x80\x80\x82\xa2\xfc\x80\x80\x80\x82\xa3\xfc\x80\x80\x80\x82\xa5", 18));
var_dump(chk_enc("\xc1\xbf", 2));
var_dump(chk_enc("\xc2\x80", 0));
var_dump(chk_enc("\xdf\xbf", 0));
var_dump(chk_enc("\xe0\x9f\xff", 3));
var_dump(chk_enc("\xe0\x9f\xff", 2));
var_dump(chk_enc("\xe0\xa0\x80", 2));
var_dump(chk_enc("\xef\xbf\xbf", 0));
var_dump(chk_enc("\xf0\x8f\xbf\xbf", 4));
var_dump(chk_enc("\xf0\x8f\xbf\xbf", 3));
var_dump(chk_enc("\xf0\x90\x80\x80", 0));
var_dump(chk_enc("\xf7\xbf\xbf\xbf", 4));
var_dump(chk_enc("\xf8\x87\xbf\xbf\xbf", 5));
@@ -61,7 +61,7 @@ echo "UTF-8 and surrogates area\n";
$out = '';
$cnt = 0;
for ($i = 0xd7ff; $i <= 0xe000; ++$i) {
$s = chk_enc(pack('C3', 0xe0 | ($i >> 12), 0x80 | ($i >> 6) & 0x3f, 0x80 | $i & 0x3f), 3);
$s = chk_enc(pack('C3', 0xe0 | ($i >> 12), 0x80 | ($i >> 6) & 0x3f, 0x80 | $i & 0x3f), 2);
if ($s === false) {
$cnt++;
} else {
+1 -1
View File
@@ -4,7 +4,7 @@ mb_http_output()
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--FILE--
<?php
//TODO: Add more encoding. Wrong parameter type test.
//TODO: Add more encoding. Wrong paramter type test.
//$debug = true;
ini_set('include_path', dirname(__FILE__));
include_once('common.inc');
+1 -1
View File
@@ -45,7 +45,7 @@ PHP_ARG_WITH(mysql, for MySQL support,
mysqlnd the MySQL native driver will be used])
PHP_ARG_WITH(mysql-sock, for specified location of the MySQL UNIX socket,
[ --with-mysql-sock[=SOCKPATH] MySQL/MySQLi/PDO_MYSQL: Location of the MySQL unix socket pointer.
[ --with-mysql-sock[=DIR] MySQL/MySQLi/PDO_MYSQL: Location of the MySQL unix socket pointer.
If unspecified, the default locations are searched], no, no)
if test -z "$PHP_ZLIB_DIR"; then
+1 -1
View File
@@ -1918,7 +1918,7 @@ PHP_FUNCTION(mysql_result)
/*
johannes TODO:
Do 2 zend_parse_parameters calls instead of type "z" and switch below
Do 2 zend_parse_paramters calls instead of type "z" and switch below
Q: String or long first?
*/
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z", &result, &row, &field) == FAILURE) {
@@ -166,7 +166,7 @@ mysqlnd.collect_memory_statistics=1
mysqli_get_client_stats_assert_gt('bytes_sent', $info, $expected, $test_counter);
mysqli_get_client_stats_assert_gt('bytes_received', $info, $expected, $test_counter);
// real_data_* get incremented after mysqli_*fetch*()
// real_data_* get incremeneted after mysqli_*fetch*()
mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, "0", $test_counter);
mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter);
+2 -6
View File
@@ -1142,7 +1142,6 @@ MYSQLND ** mysqlnd_stream_array_check_for_readiness(MYSQLND ** conn_array TSRMLS
static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, php_socket_t * max_fd TSRMLS_DC)
{
php_socket_t this_fd;
php_stream *stream = NULL;
int cnt = 0;
MYSQLND **p = conn_array;
@@ -1152,8 +1151,7 @@ static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, p
* when casting. It is only used here so that the buffered data warning
* is not displayed.
* */
stream = (*p)->data->net->stream;
if (stream != NULL && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
if (SUCCESS == php_stream_cast((*p)->data->net->stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
(void*)&this_fd, 1) && this_fd >= 0) {
PHP_SAFE_FD_SET(this_fd, fds);
@@ -1171,7 +1169,6 @@ static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, p
static int mysqlnd_stream_array_from_fd_set(MYSQLND ** conn_array, fd_set * fds TSRMLS_DC)
{
php_socket_t this_fd;
php_stream *stream = NULL;
int ret = 0;
zend_bool disproportion = FALSE;
@@ -1179,8 +1176,7 @@ static int mysqlnd_stream_array_from_fd_set(MYSQLND ** conn_array, fd_set * fds
MYSQLND **fwd = conn_array, **bckwd = conn_array;
while (*fwd) {
stream = (*fwd)->data->net->stream;
if (stream != NULL && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
if (SUCCESS == php_stream_cast((*fwd)->data->net->stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
(void*)&this_fd, 1) && this_fd >= 0) {
if (PHP_SAFE_FD_ISSET(this_fd, fds)) {
if (disproportion) {
+1 -1
View File
@@ -758,7 +758,7 @@ MYSQLND_METHOD(mysqlnd_net, consume_uneaten_data)(MYSQLND_NET * const net, enum
/*
Switch to non-blocking mode and try to consume something from
the line, if possible, then continue. This saves us from looking for
the actual place where out-of-order packets have been sent.
the actuall place where out-of-order packets have been sent.
If someone is completely sure that everything is fine, he can switch it
off.
*/
+11 -26
View File
@@ -370,33 +370,18 @@ PHP_ARG_WITH(iodbc,,
if test "$PHP_IODBC" != "no"; then
AC_MSG_CHECKING(for iODBC support)
if test -z "$PKG_CONFIG"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libiodbc ; then
PHP_ADD_LIBRARY_WITH_PATH(iodbc, $PHP_IODBC/$PHP_LIBDIR)
ODBC_TYPE=iodbc
ODBC_INCLUDE=`$PKG_CONFIG --cflags-only-I libiodbc`
ODBC_LFLAGS=`$PKG_CONFIG --libs-only-L libiodbc`
ODBC_LIBS=`$PKG_CONFIG --libs-only-l libiodbc`
PHP_EVAL_INCLINE($ODBC_INCLUDE)
AC_DEFINE(HAVE_IODBC,1,[ ])
AC_DEFINE(HAVE_ODBC2,1,[ ])
AC_MSG_RESULT([$ext_output])
else
if test "$PHP_IODBC" = "yes"; then
PHP_IODBC=/usr/local
fi
PHP_ADD_LIBRARY_WITH_PATH(iodbc, $PHP_IODBC/$PHP_LIBDIR)
PHP_ADD_INCLUDE($PHP_IODBC/include, 1)
ODBC_TYPE=iodbc
ODBC_INCLUDE=-I$PHP_IODBC/include
ODBC_LFLAGS=-L$PHP_IODBC/$PHP_LIBDIR
ODBC_LIBS=-liodbc
AC_DEFINE(HAVE_IODBC,1,[ ])
AC_DEFINE(HAVE_ODBC2,1,[ ])
AC_MSG_RESULT([$ext_output])
if test "$PHP_IODBC" = "yes"; then
PHP_IODBC=/usr/local
fi
PHP_ADD_LIBRARY_WITH_PATH(iodbc, $PHP_IODBC/$PHP_LIBDIR)
PHP_ADD_INCLUDE($PHP_IODBC/include, 1)
ODBC_TYPE=iodbc
ODBC_INCLUDE=-I$PHP_IODBC/include
ODBC_LFLAGS=-L$PHP_IODBC/$PHP_LIBDIR
ODBC_LIBS=-liodbc
AC_DEFINE(HAVE_IODBC,1,[ ])
AC_DEFINE(HAVE_ODBC2,1,[ ])
AC_MSG_RESULT([$ext_output])
fi
fi
+1 -1
View File
@@ -232,7 +232,7 @@ typedef struct odbc_connection {
} odbc_connection;
typedef struct odbc_result_value {
char name[256];
char name[32];
char *value;
SQLLEN vallen;
SQLLEN coltype;
+46 -121
View File
@@ -561,7 +561,6 @@ static EVP_PKEY * php_openssl_generate_private_key(struct php_x509_request * req
static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int shortname TSRMLS_DC) /* {{{ */
{
zval **data;
zval *subitem, *subentries;
int i, j = -1, last = -1, obj_cnt = 0;
char *sname;
@@ -579,7 +578,7 @@ static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int s
for (i = 0; i < X509_NAME_entry_count(name); i++) {
unsigned char *to_add;
int to_add_len = 0;
int to_add_len;
ne = X509_NAME_get_entry(name, i);
@@ -593,27 +592,39 @@ static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int s
sname = (char *) OBJ_nid2ln(nid);
}
str = X509_NAME_ENTRY_get_data(ne);
if (ASN1_STRING_type(str) != V_ASN1_UTF8STRING) {
to_add_len = ASN1_STRING_to_UTF8(&to_add, str);
} else {
to_add = ASN1_STRING_data(str);
to_add_len = ASN1_STRING_length(str);
}
MAKE_STD_ZVAL(subentries);
array_init(subentries);
if (to_add_len != -1) {
if (zend_hash_find(Z_ARRVAL_P(subitem), sname, strlen(sname)+1, (void**)&data) == SUCCESS) {
if (Z_TYPE_PP(data) == IS_ARRAY) {
subentries = *data;
add_next_index_stringl(subentries, (char *)to_add, to_add_len, 1);
} else if (Z_TYPE_PP(data) == IS_STRING) {
MAKE_STD_ZVAL(subentries);
array_init(subentries);
add_next_index_stringl(subentries, Z_STRVAL_PP(data), Z_STRLEN_PP(data), 1);
add_next_index_stringl(subentries, (char *)to_add, to_add_len, 1);
zend_hash_update(Z_ARRVAL_P(subitem), sname, strlen(sname)+1, &subentries, sizeof(zval*), NULL);
}
last = -1;
for (;;) {
j = X509_NAME_get_index_by_OBJ(name, obj, last);
if (j < 0) {
if (last != -1) break;
} else {
obj_cnt++;
ne = X509_NAME_get_entry(name, j);
str = X509_NAME_ENTRY_get_data(ne);
if (ASN1_STRING_type(str) != V_ASN1_UTF8STRING) {
to_add_len = ASN1_STRING_to_UTF8(&to_add, str);
if (to_add_len != -1) {
add_next_index_stringl(subentries, (char *)to_add, to_add_len, 1);
}
} else {
to_add = ASN1_STRING_data(str);
to_add_len = ASN1_STRING_length(str);
add_next_index_stringl(subentries, (char *)to_add, to_add_len, 1);
}
}
last = j;
}
i = last;
if (obj_cnt > 1) {
add_assoc_zval_ex(subitem, sname, strlen(sname) + 1, subentries);
} else {
zval_dtor(subentries);
FREE_ZVAL(subentries);
if (obj_cnt && str && to_add_len > -1) {
add_assoc_stringl(subitem, sname, (char *)to_add, to_add_len, 1);
}
}
@@ -1387,74 +1398,6 @@ PHP_FUNCTION(openssl_x509_check_private_key)
}
/* }}} */
/* Special handling of subjectAltName, see CVE-2013-4073
* Christian Heimes
*/
static int openssl_x509v3_subjectAltName(BIO *bio, X509_EXTENSION *extension)
{
GENERAL_NAMES *names;
const X509V3_EXT_METHOD *method = NULL;
long i, length, num;
const unsigned char *p;
method = X509V3_EXT_get(extension);
if (method == NULL) {
return -1;
}
p = extension->value->data;
length = extension->value->length;
if (method->it) {
names = (GENERAL_NAMES*)(ASN1_item_d2i(NULL, &p, length,
ASN1_ITEM_ptr(method->it)));
} else {
names = (GENERAL_NAMES*)(method->d2i(NULL, &p, length));
}
if (names == NULL) {
return -1;
}
num = sk_GENERAL_NAME_num(names);
for (i = 0; i < num; i++) {
GENERAL_NAME *name;
ASN1_STRING *as;
name = sk_GENERAL_NAME_value(names, i);
switch (name->type) {
case GEN_EMAIL:
BIO_puts(bio, "email:");
as = name->d.rfc822Name;
BIO_write(bio, ASN1_STRING_data(as),
ASN1_STRING_length(as));
break;
case GEN_DNS:
BIO_puts(bio, "DNS:");
as = name->d.dNSName;
BIO_write(bio, ASN1_STRING_data(as),
ASN1_STRING_length(as));
break;
case GEN_URI:
BIO_puts(bio, "URI:");
as = name->d.uniformResourceIdentifier;
BIO_write(bio, ASN1_STRING_data(as),
ASN1_STRING_length(as));
break;
default:
/* use builtin print for GEN_OTHERNAME, GEN_X400,
* GEN_EDIPARTY, GEN_DIRNAME, GEN_IPADD and GEN_RID
*/
GENERAL_NAME_print(bio, name);
}
/* trailing ', ' except for last element */
if (i < (num - 1)) {
BIO_puts(bio, ", ");
}
}
sk_GENERAL_NAME_pop_free(names, GENERAL_NAME_free);
return 0;
}
/* {{{ proto array openssl_x509_parse(mixed x509 [, bool shortnames=true])
Returns an array of the fields/values of the CERT */
PHP_FUNCTION(openssl_x509_parse)
@@ -1551,30 +1494,15 @@ PHP_FUNCTION(openssl_x509_parse)
for (i = 0; i < X509_get_ext_count(cert); i++) {
int nid;
extension = X509_get_ext(cert, i);
nid = OBJ_obj2nid(X509_EXTENSION_get_object(extension));
if (nid != NID_undef) {
if (OBJ_obj2nid(X509_EXTENSION_get_object(extension)) != NID_undef) {
extname = (char *)OBJ_nid2sn(OBJ_obj2nid(X509_EXTENSION_get_object(extension)));
} else {
OBJ_obj2txt(buf, sizeof(buf)-1, X509_EXTENSION_get_object(extension), 1);
extname = buf;
}
bio_out = BIO_new(BIO_s_mem());
if (nid == NID_subject_alt_name) {
if (openssl_x509v3_subjectAltName(bio_out, extension) == 0) {
BIO_get_mem_ptr(bio_out, &bio_buf);
add_assoc_stringl(subitem, extname, bio_buf->data, bio_buf->length, 1);
} else {
zval_dtor(return_value);
if (certresource == -1 && cert) {
X509_free(cert);
}
BIO_free(bio_out);
RETURN_FALSE;
}
}
else if (X509V3_EXT_print(bio_out, extension, 0, 0)) {
if (X509V3_EXT_print(bio_out, extension, 0, 0)) {
BIO_get_mem_ptr(bio_out, &bio_buf);
add_assoc_stringl(subitem, extname, bio_buf->data, bio_buf->length, 1);
} else {
@@ -4613,6 +4541,9 @@ SSL *php_SSL_new_from_context(SSL_CTX *ctx, php_stream *stream TSRMLS_DC) /* {{{
GET_VER_OPT_STRING("local_cert", certfile);
if (certfile) {
X509 *cert = NULL;
EVP_PKEY *key = NULL;
SSL *tmpssl;
char resolved_path_buff[MAXPATHLEN];
const char * private_key = NULL;
@@ -4639,22 +4570,16 @@ SSL *php_SSL_new_from_context(SSL_CTX *ctx, php_stream *stream TSRMLS_DC) /* {{{
}
}
#if OPENSSL_VERSION_NUMBER < 0x10001001L
do {
/* Unnecessary as of OpenSSLv1.0.1 (will segfault if used with >= 10001001 ) */
X509 *cert = NULL;
EVP_PKEY *key = NULL;
SSL *tmpssl = SSL_new(ctx);
cert = SSL_get_certificate(tmpssl);
tmpssl = SSL_new(ctx);
cert = SSL_get_certificate(tmpssl);
if (cert) {
key = X509_get_pubkey(cert);
EVP_PKEY_copy_parameters(key, SSL_get_privatekey(tmpssl));
EVP_PKEY_free(key);
}
SSL_free(tmpssl);
if (cert) {
key = X509_get_pubkey(cert);
EVP_PKEY_copy_parameters(key, SSL_get_privatekey(tmpssl));
EVP_PKEY_free(key);
}
SSL_free(tmpssl);
} while (0);
#endif
if (!SSL_CTX_check_private_key(ctx)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Private key does not match certificate!");
}
-37
View File
@@ -1,37 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIGfzCCBWegAwIBAgIQSVCinGH6MkvjJZjRyjK9nTANBgkqhkiG9w0BAQUFADCB
jjELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G
A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxNDAyBgNV
BAMTK0NPTU9ETyBFeHRlbmRlZCBWYWxpZGF0aW9uIFNlY3VyZSBTZXJ2ZXIgQ0Ew
HhcNMTIwMjI5MDAwMDAwWhcNMTQwMjI4MjM1OTU5WjCCAW8xEjAQBgNVBAMTCXd3
dy5yZC5pbzERMA8GA1UEAxMIcmRpby5jb20xDjAMBgNVBAMTBXJkLmlvMRUwEwYD
VQQDEwxhcGkucmRpby5jb20xEjAQBgNVBAMTCWFwaS5yZC5pbzEQMA4GA1UEBRMH
NDU4NjAwNzETMBEGCysGAQQBgjc8AgEDEwJVUzEZMBcGCysGAQQBgjc8AgECEwhE
ZWxhd2FyZTEdMBsGA1UEDxMUUHJpdmF0ZSBPcmdhbml6YXRpb24xCzAJBgNVBAYT
AlVTMQ4wDAYDVQQREwU5NDEwMzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDVNhbiBG
cmFuY2lzY28xFzAVBgNVBAkTDjE1NTAgQnJ5YW50IHN0MRMwEQYDVQQKEwpSZGlv
LCBJbmMuMSMwIQYDVQQLExpDT01PRE8gRVYgTXVsdGktRG9tYWluIFNTTDEVMBMG
A1UEAxMMd3d3LnJkaW8uY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
AQEAt0AgYOe8EBJNVBAuSJFLKHRKZn0/ObCLBFG4xVH/5fb1rfYHBT1XSjjOqR3t
iGC/A3esF8YC7TuHQcTLVephx0DtJv1ASxRg3zPM8ebBRsuul18N0W+sY1aNXpkd
36quxvjg5UdBrAweuekJ7OTSZcCe2Ry/SKBeZSWWtkWsI4krCLv7JaKUwxw2h+Hn
TAZSBLVxz/mixF0WYdepYwnq2Hm7XvvVEIQ7wxOQ9bA7iCevLojZOnb39BT2QII7
cy8AB47RZdfYg7UwaO3bST2rauA4MKar7/Ozqc0aemNFpLatJfgv07cydiuj9fsd
5aE/c8is8C9M9+7MmSMkcNEgGwIDAQABo4IB8zCCAe8wHwYDVR0jBBgwFoAUiERR
/1AqaV4tiPQhutkM8s7L6nwwHQYDVR0OBBYEFCrYw8bfrYJ61NS2yYx6/CnhjzT4
MA4GA1UdDwEB/wQEAwIFoDAMBgNVHRMBAf8EAjAAMB0GA1UdJQQWMBQGCCsGAQUF
BwMBBggrBgEFBQcDAjBGBgNVHSAEPzA9MDsGDCsGAQQBsjEBAgEFATArMCkGCCsG
AQUFBwIBFh1odHRwczovL3NlY3VyZS5jb21vZG8uY29tL0NQUzBTBgNVHR8ETDBK
MEigRqBEhkJodHRwOi8vY3JsLmNvbW9kb2NhLmNvbS9DT01PRE9FeHRlbmRlZFZh
bGlkYXRpb25TZWN1cmVTZXJ2ZXJDQS5jcmwwgYQGCCsGAQUFBwEBBHgwdjBOBggr
BgEFBQcwAoZCaHR0cDovL2NydC5jb21vZG9jYS5jb20vQ09NT0RPRXh0ZW5kZWRW
YWxpZGF0aW9uU2VjdXJlU2VydmVyQ0EuY3J0MCQGCCsGAQUFBzABhhhodHRwOi8v
b2NzcC5jb21vZG9jYS5jb20wTAYDVR0RBEUwQ4IMd3d3LnJkaW8uY29tgglhcGku
cmQuaW+CDGFwaS5yZGlvLmNvbYIFcmQuaW+CCHJkaW8uY29tggl3d3cucmQuaW8w
DQYJKoZIhvcNAQEFBQADggEBAKFd4bPVFRyrlqIKPtrtMuqGqid6685ohxf0cv52
sjdRYwLVTjnZOrmkDdNaF3R2A1ZlVMRN+67rK+qfY5sTeijFcudV3/i0PDtOFRwP
6yYVD2uZmYkxfPiW309HPmDF+EzhxpVjWlTQEOwkfFLTmJmwl3Qu2Kffp8F1ENXW
OTVNvj5VtMghvzu68PpzKl1VjlOR4Ej9NCwh1dUjNKEoTPzvpehXsIZ7jHSpX/T1
wSSt9ckiechDdpgZXTzHgbxHNibK0Uhh+QhkBgYMj5F8qj5BlBhWAWqQa/VnEdmr
Pfo7U+QmadoqQd7qt06hE2hG1nfZ0vPJDbWV3oVSwG2Yt7I=
-----END CERTIFICATE-----
Loaded 100 of 251 files, more files were not shown because too many files have changed in this diff. Show more