mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-18 14:36:38 +00:00
Compare commits
127
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a1e877c66 | ||
|
|
b5446194ec | ||
|
|
6e2add04ea | ||
|
|
4a162b71a2 | ||
|
|
7a5306598a | ||
|
|
436d75c376 | ||
|
|
6fea033c6e | ||
|
|
806bc4e164 | ||
|
|
2604f21fa6 | ||
|
|
3fcfdf573d | ||
|
|
27c327b97e | ||
|
|
38540337a9 | ||
|
|
dd48748f5a | ||
|
|
286a9db9df | ||
|
|
01ea35a078 | ||
|
|
54032dee04 | ||
|
|
0680cc4360 | ||
|
|
3b2fa0ce82 | ||
|
|
da09526eac | ||
|
|
e5ab519397 | ||
|
|
6e0915b631 | ||
|
|
d1202b7986 | ||
|
|
03c7bbd33b | ||
|
|
ebbfc21a15 | ||
|
|
f0fd70fadb | ||
|
|
bb2d53e768 | ||
|
|
7800711d34 | ||
|
|
7e17f8591a | ||
|
|
1a6cd5162e | ||
|
|
7b588b5bcd | ||
|
|
bb9a9f2b98 | ||
|
|
6415ef51e9 | ||
|
|
4bb51d165a | ||
|
|
93c8a45083 | ||
|
|
6a1b4c99c7 | ||
|
|
f4a75d91d2 | ||
|
|
f3ae2fea43 | ||
|
|
d6ee9d4810 | ||
|
|
0a1f5d12a1 | ||
|
|
5a9f40a46a | ||
|
|
65c046b200 | ||
|
|
6d040bf67a | ||
|
|
567a4785b3 | ||
|
|
f739a43906 | ||
|
|
7e3c017e5a | ||
|
|
334c36ac7c | ||
|
|
4dd2a598f3 | ||
|
|
0ce31d14f5 | ||
|
|
b6a5941b97 | ||
|
|
73161f33d4 | ||
|
|
bc8377a81c | ||
|
|
9fa594c2dd | ||
|
|
618e62325e | ||
|
|
299af46146 | ||
|
|
42d4e3533e | ||
|
|
935b0c88e9 | ||
|
|
0222d506c2 | ||
|
|
7c5119c5a9 | ||
|
|
413de3f4a5 | ||
|
|
ef4ff6fe9e | ||
|
|
3879a66876 | ||
|
|
6dbe4adbc6 | ||
|
|
194230c3a6 | ||
|
|
6c18da0d2a | ||
|
|
0c8042dc49 | ||
|
|
d577b8058c | ||
|
|
51fbffba2f | ||
|
|
5c6f438319 | ||
|
|
267b0e9b03 | ||
|
|
b860e9a3c2 | ||
|
|
b0c4150967 | ||
|
|
7e563e9215 | ||
|
|
01ee23d980 | ||
|
|
7f2cf9b373 | ||
|
|
88b59df262 | ||
|
|
36505f802c | ||
|
|
f11c99638e | ||
|
|
cb5ad145ab | ||
|
|
3f0f73beba | ||
|
|
8e86a189ec | ||
|
|
e85a378770 | ||
|
|
c55eda9f3b | ||
|
|
b772a83282 | ||
|
|
eee95ef3f0 | ||
|
|
ad58ad265b | ||
|
|
37635d93e6 | ||
|
|
7d7f84562c | ||
|
|
47713b1eb7 | ||
|
|
b9351ab4b1 | ||
|
|
76d748f372 | ||
|
|
0c3c55edac | ||
|
|
5d6f6783ae | ||
|
|
afb8af1f5f | ||
|
|
bd5e8f77bd | ||
|
|
229137cad4 | ||
|
|
aa6593f984 | ||
|
|
dc8895ed82 | ||
|
|
c57bfd9a66 | ||
|
|
52d0f82dc3 | ||
|
|
dadc6b8a3b | ||
|
|
4cff5db8f4 | ||
|
|
3ec9141f91 | ||
|
|
aebc2fff07 | ||
|
|
ef058cdd9a | ||
|
|
8c53ff1e80 | ||
|
|
c622ded866 | ||
|
|
731b68fbc5 | ||
|
|
ae77214f7f | ||
|
|
fc60217820 | ||
|
|
87eaaf494b | ||
|
|
8166284cfd | ||
|
|
75876d57be | ||
|
|
a5107c1803 | ||
|
|
4427552b60 | ||
|
|
73c5259362 | ||
|
|
532f577fe9 | ||
|
|
2203492799 | ||
|
|
688efae2d0 | ||
|
|
eca5331a81 | ||
|
|
eb958c080e | ||
|
|
948d84fd67 | ||
|
|
5737b1e925 | ||
|
|
0f6f089698 | ||
|
|
c8b2f761f6 | ||
|
|
8251f8b8d0 | ||
|
|
dc2bb45440 | ||
|
|
73eba86360 |
No files matched your search
+4
-1
@@ -29,7 +29,7 @@ php_lcov.info: lcov-test
|
||||
@rm -rf lcov_data/
|
||||
@$(mkinstalldirs) lcov_data/
|
||||
@echo
|
||||
-@find . -name \*.gcda -o -name \*.gcno -o -name \*.da | sed -e 's/^\.\///' | sed -e 's/\.gcda//g' -e 's/\.gcno//g' -e 's/\.da//g' | uniq | while read x; do \
|
||||
-@find . -name \*.gcda -o -name \*.gcno -o -name \*.da -o -name \*.h | sed -e 's/^\.\///' | sed -e 's/\.gcda//g' -e 's/\.gcno//g' -e 's/\.da//g' | uniq | while read x; do \
|
||||
echo -n . ;\
|
||||
y=`echo $$x | sed -e 's!\.libs/!!'`; \
|
||||
dir=lcov_data/`dirname $$x`; \
|
||||
@@ -49,6 +49,9 @@ php_lcov.info: lcov-test
|
||||
if test -f "$(top_srcdir)/$$y.l"; then \
|
||||
ln -f -s $(top_srcdir)/$$y.l lcov_data/$$y.l; \
|
||||
fi; \
|
||||
if test -f "$(top_srcdir)/$$y"; then \
|
||||
ln -f -s $(top_srcdir)/$$y lcov_data/$$y; \
|
||||
fi; \
|
||||
if test -f "$(top_builddir)/$$y.c"; then \
|
||||
ln -f -s $(top_builddir)/$$y.c lcov_data/$$y.c; \
|
||||
fi; \
|
||||
|
||||
@@ -1,5 +1,31 @@
|
||||
PHP NEWS
|
||||
'PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
14 Sep 2006, PHP 5.2.0RC4
|
||||
- Added DSA key generation support to openssl_pkey_new(), FR #38731
|
||||
(marci at balabit dot hu, Tony)
|
||||
- Removed current working directory from the php.ini search path for CLI and
|
||||
readded it for other SAPIs (restore to pre 5.1.x behavior). (Edin)
|
||||
- Fixed bug #38813 (DOMEntityReference->__construct crashes when called
|
||||
explicitly). (Rob)
|
||||
- Fixed bug #38779 (engine crashes when require()'ing file with syntax error
|
||||
through userspace stream wrapper). (Tony, Dmitry)
|
||||
- Fixed bug #38772 (inconsistent overriding of methods in different visibility
|
||||
contexts). (Dmitry)
|
||||
- Fixed bug #38759 (PDO sqlite2 empty query causes segfault). (Tony)
|
||||
- Fixed bug #38721 (Invalid memory read in date_parse()). (Tony, Derick)
|
||||
- Fixed bug #38700 (SoapClient::__getTypes never returns). (Dmitry)
|
||||
- Fixed bug #38693 (curl_multi_add_handle() set curl handle to null). (Ilia)
|
||||
- Fixed bug #38687 (sockaddr local storage insufficient for all sock
|
||||
families). (Sara)
|
||||
- Fixed bug #38661 (mixed-case URL breaks url-wrappers). (Ilia)
|
||||
- Fixed bug #38464 (array_count_values() mishandles numeric strings).
|
||||
(Matthew Wilmas, Ilia)
|
||||
- Fixed bug #38096 (large timeout values ignored on 32bit machines in
|
||||
stream_socket_accept() and stream_socket_client()). (Ilia)
|
||||
- Fixed bug #37923 (Display constant value in reflection::export). (Johannes)
|
||||
- Fixed bug #37779 (empty include_path leads to search for files inside /).
|
||||
(jr at terragate dot net, Ilia)
|
||||
|
||||
31 Aug 2006, PHP 5.2.0RC3
|
||||
- Updated PCRE to version 6.7. (Ilia)
|
||||
- Added SoapServer::setObject() method (it is a simplified version of
|
||||
@@ -67,8 +93,9 @@ PHP NEWS
|
||||
. Added support for all supported algorithms in openssl_verify
|
||||
. Added openssl_pkey_get_details, returns the details of a key
|
||||
. Added x509 v3 extensions support
|
||||
. Added a new constant OPENSSL_KEYTYPE_EC
|
||||
. Added openssl_csr_get_subject() and openssl_csr_get_public_key()
|
||||
. Added 3 new contants OPENSSL_VERSION_TEXT and OPENSSL_VERSION_NUMBER
|
||||
and OPENSSL_KEYTYPE_EC
|
||||
|
||||
- Fixed overflow on 64bit systems in str_repeat() and wordwrap(). (Stefan E.)
|
||||
- Disabled CURLOPT_FOLLOWLOCATION in curl when open_basedir or safe_mode are
|
||||
|
||||
+151
-41
@@ -1,60 +1,170 @@
|
||||
PHP 5.2 Update info or NEWS explained
|
||||
PHP 5.2 UPDATE INFO
|
||||
|
||||
- Changed E_ALL error reporting mode to includes E_RECOVERABLE_ERROR. (Marcus)
|
||||
===============================
|
||||
Changes in PHP datetime support
|
||||
===============================
|
||||
|
||||
This changes means that the value of the E_ALL constant had changed to 6143
|
||||
from its previous value of 2047. If you are setting your error reporting mode
|
||||
inside the Apache config file or the .htaccess files you will need to adjust
|
||||
the value of error_reporting INI setting accordingly.
|
||||
Since PHP 5.1, there has been an extension named 'date' in the PHP core. This
|
||||
is the new implementation of PHP's datetime support. Although it will attempt
|
||||
to guess your system's timezone setting, you should set the timezone manually.
|
||||
You can do this in any of three ways:
|
||||
|
||||
1) in your php.ini using the date.timezone INI directive
|
||||
2) on your system using the TZ environmental variable
|
||||
3) from your script using the convenience function date_default_timezone_set()
|
||||
|
||||
All supported timezones are listed in the PHP Manual at
|
||||
http://www.php.net/manual/timezones.php.
|
||||
|
||||
With the advent of PHP 5.2, there are object representations of the date and
|
||||
timezone, named DateTime and DateTimeZone respectively. You can see the methods
|
||||
and constants available to the new classes by running
|
||||
|
||||
php --rc DateTime
|
||||
php --rc DateTimeZone
|
||||
|
||||
under PHP CLI. All methods map to existing procedural date functions.
|
||||
|
||||
==================================
|
||||
Items from the NEWS file explained
|
||||
==================================
|
||||
|
||||
- Added new error mode E_RECOVERABLE_ERROR. (Derick, Marcus, Tony)
|
||||
|
||||
This changes a few E_ERROR conditions to something that you can now catch
|
||||
using a user error handler. If the user error handler does not grab these
|
||||
kind of error they behave as fatal errors just like in any PHP version prior
|
||||
to 5.2. Errors of this type are logged as 'Catchable fatal error'.
|
||||
Some of the existing E_ERROR conditions have been converted to something that
|
||||
you can catch with a user-defined error handler. If an E_RECOVERABLE_ERROR is
|
||||
not handled, it will behave in the same way as E_ERROR behaves in all versions
|
||||
of PHP. Errors of this type are logged as 'Catchable fatal error'.
|
||||
|
||||
|
||||
- Changed E_ALL error reporting mode to include E_RECOVERABLE_ERROR. (Marcus)
|
||||
|
||||
This change means that the value of the E_ALL error_reporting constant is now
|
||||
6143, where its previous value was 2047. If you are setting the error_reporting
|
||||
mode from either the Apache config file or the .htaccess files, you will need
|
||||
to adjust the value accordingly. The same applies if you use the numeric value
|
||||
rather than the constant in your PHP scripts.
|
||||
|
||||
|
||||
- Added support for constructors in interfaces to force constructor signature
|
||||
checks in implementations. (Marcus)
|
||||
|
||||
Starting with PHP 5.2 interfaces can have constructors. If you use this
|
||||
feature then all implementing classes must implement constructors with a
|
||||
matching signature, while normally constructors do not need to follow any
|
||||
base class or interface constructor signature. (Signature is the name for
|
||||
the parameter and return type definition which captures count, reference or
|
||||
not and any type hints).
|
||||
|
||||
- Changed __toString to be called whereever applicable. (Marcus)
|
||||
Starting with PHP 5.2, interfaces can have constructors. However, if you choose
|
||||
to declare a constructor in an interface, each class implementing that interface
|
||||
MUST include a constructor with a signature matching that of the base interface
|
||||
constructor. By 'signature' we mean the parameter and return type definitions,
|
||||
including any type hints and including whether the data is passed by reference
|
||||
or by value.
|
||||
|
||||
|
||||
- Changed __toString to be called wherever applicable. (Marcus)
|
||||
|
||||
The magic method __toString() will now be called in a string context, that
|
||||
is, anywhere an object is used as a string. When implementing your __toString()
|
||||
method in a class, you should be aware that the script will terminate if
|
||||
your function throws an exception.
|
||||
|
||||
The PHP 5.0/5.1 fallback - returning a string that contains the object
|
||||
identifier - has been dropped in PHP 5.2. It became problematic because
|
||||
an object identifier cannot be considered unique. This change will mean
|
||||
that your application is flawed if you have relied on the object identifier
|
||||
as a return value. An attempt to use that value as a string will now result
|
||||
in a catchable fatal error (see above).
|
||||
|
||||
Even with __toString(), objects cannot be used as array indices or keys. We
|
||||
may add built-in hash support for this at a later date, but for PHP 5.2 you
|
||||
will need to either provide your own hashing or use the new SPL function
|
||||
spl_object_hash().
|
||||
|
||||
The magic object method __toString() is now called whenever an object is used
|
||||
as a string. The function must not throw an exception or the script will be
|
||||
terminated. The PHP 5.0/5.1 fallback to return a string containing the object
|
||||
idetifier has been dropped. Note that the object identifier is never unique.
|
||||
That measn that if you have used this feature your application has been
|
||||
flawed. Nonetheless it will now be a catchable fatal error (see above).
|
||||
|
||||
Even with __toString objects cannot be used as keys to arrays. We might add
|
||||
built-in hash support for this. But for 5.2 you would need to either provide
|
||||
your own hashing or use new function spl_object_hash()
|
||||
|
||||
- Added RFC2397 (data: stream) support. (Marcus)
|
||||
|
||||
Under windows this can mean a very rare change of behavior. If you are using
|
||||
NTFS filesystem and making use of meta streams in your application this does
|
||||
no longer work for a file with the name 'data' accessed without any path. IF
|
||||
you need to do so you have to prefix the filename with the "file:" protocol.
|
||||
For the functionality itself look here http://www.faqs.org/rfcs/rfc2397.html.
|
||||
The introduction of the 'data' URL scheme has the potential to lead to a
|
||||
change of behaviour under Windows. If you are working with an NTFS
|
||||
filesystem and making use of meta streams in your application, and if you
|
||||
just happen to be using a file with the name 'data:' that is accessed without
|
||||
any path information - it won't work any more. The fix is to use the 'file:'
|
||||
protocol when accessing it.
|
||||
|
||||
There is information about the RFC at http://www.faqs.org/rfcs/rfc2397.html.
|
||||
|
||||
|
||||
- Added allow_url_include ini directive to complement allow_url_fopen. (Rasmus)
|
||||
|
||||
With this option one can now distinguish between standard file operations on
|
||||
remote files and inclusion of remote files. While the former is usually
|
||||
desired, the latter implies security risks if used naivly. Starting with
|
||||
PHP-5.2 it is now possible to allow standard file operations while
|
||||
dissalowing inclusion of remote files, which will also be the default
|
||||
configuration.
|
||||
This useful option makes it possible to differentiate between standard
|
||||
file operations on remote files, and the inclusion of remote files. While the
|
||||
former is usually desirable, the latter can be a security risk if used naively.
|
||||
Starting with PHP 5.2, you can allow remote file operations while
|
||||
disallowing the inclusion of remote files in local scripts. In fact, this
|
||||
is the default configuration.
|
||||
|
||||
|
||||
- Dropped abstract static class functions. (Marcus)
|
||||
|
||||
Due to an oversight PHP 5.0, 5.1 allowed abstract static functions. In PHP
|
||||
5.2 only interfaces can have abstract static functions.
|
||||
Due to an oversight, PHP 5.0 and 5.1 allowed abstract static functions in
|
||||
classes. In PHP 5.2, only interfaces can have them.
|
||||
|
||||
|
||||
- Removed extensions (Derick, Tony)
|
||||
|
||||
The filepro and hwapi extensions have been moved to PECL and are no longer
|
||||
part of the PHP distribution. The PECL package version of these extensions
|
||||
will be created on the basis of user demand.
|
||||
|
||||
|
||||
- Added extensions (Rasmus, Derick, Pierre)
|
||||
|
||||
The JSON extension implements the JavaScript Object Notation (JSON)
|
||||
data interchange format. This extension is enabled by default.
|
||||
|
||||
The Filter extension validates and filters data, and is designed for
|
||||
use with insecure data such as user input. This extension is enabled
|
||||
by default; the default mode RAW does not impact input data in any way.
|
||||
|
||||
The Zip extension enables you to transparently read or write ZIP
|
||||
compressed archives and the files inside them.
|
||||
|
||||
Please refer to the PHP Manual for details.
|
||||
|
||||
|
||||
- Improved memory manager and increased default memory limit (Dmitry)
|
||||
|
||||
The new memory manager allocates less memory and works faster than the
|
||||
previous incarnation. It allocates memory from the system in large blocks,
|
||||
and then manages the heap by itself. The memory_limit value in php.ini is
|
||||
checked, not for each emalloc() call (as before), but for actual blocks
|
||||
requested from the system. This means that memory_limit is far more
|
||||
accurate than it used to be, since the old memory manager didn't calculate
|
||||
all the memory overhead used by the malloc library.
|
||||
|
||||
Thanks to this new-found accuracy memory usage may appear to have increased,
|
||||
although actually it has not. To accommodate this apparent increase, the
|
||||
default memory_limit setting was also increased - from 8 to 16 megabytes.
|
||||
|
||||
|
||||
- Changed priority of PHPRC environment variable on win32 (Dmitry)
|
||||
|
||||
The PHPRC environment variable now takes priority over the path stored
|
||||
in the Windows registry.
|
||||
|
||||
|
||||
- Added notice when accessing return value from __get() in write mode (Marcus)
|
||||
|
||||
The reason for this is that __get() only returns variables in read mode, and
|
||||
it is therefore not possible to write to the returned variable. In previous
|
||||
releases there was no effective way to detect incorrect usage. Starting from
|
||||
PHP 5.2, an E_NOTICE will be emitted in this situation.
|
||||
|
||||
WARNING: foreach() and functions that modify the internal array pointer will
|
||||
now also trigger the same E_NOTICE, since modification requires that the
|
||||
variable be accessed in write mode. To work around this, you should either
|
||||
cast the returned value from __get() to an array, or use SPL's ArrayObject
|
||||
instead of an array.
|
||||
|
||||
- CLI SAPI no longer checks cwd for php.ini or the php-cli.ini file (Edin)
|
||||
|
||||
In PHP 5.1.X an undocumented feature was added that made the CLI binary
|
||||
check the current directory for PHP configuration file possibly leading to
|
||||
unpredictable behavior due to an un-expected configuration file being
|
||||
read. This functionality was removed in 5.2 and PHP will no longer search
|
||||
CWD for the presence of the php.ini or the php-cli.ini files.
|
||||
@@ -37,8 +37,14 @@
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#ifdef ZTS
|
||||
#define VIRTUAL_DIR
|
||||
#endif
|
||||
|
||||
#ifndef TSRM_WIN32
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
#if defined(__osf__) || defined(_AIX)
|
||||
|
||||
@@ -168,9 +168,6 @@ AC_ARG_ENABLE(zend-multibyte,
|
||||
AC_MSG_CHECKING([virtual machine dispatch method])
|
||||
AC_MSG_RESULT($PHP_ZEND_VM)
|
||||
|
||||
AC_MSG_CHECKING(whether to enable the Zend memory manager)
|
||||
AC_MSG_RESULT($ZEND_USE_ZEND_ALLOC)
|
||||
|
||||
AC_MSG_CHECKING(whether to enable thread-safety)
|
||||
AC_MSG_RESULT($ZEND_MAINTAINER_ZTS)
|
||||
|
||||
@@ -214,12 +211,6 @@ fi
|
||||
|
||||
test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"
|
||||
|
||||
if test "$ZEND_USE_ZEND_ALLOC" = "yes"; then
|
||||
AC_DEFINE(USE_ZEND_ALLOC,1,[Use Zend memory manager])
|
||||
else
|
||||
AC_DEFINE(USE_ZEND_ALLOC,0,[Use Zend memory manager])
|
||||
fi
|
||||
|
||||
if test "$ZEND_MAINTAINER_ZTS" = "yes"; then
|
||||
AC_DEFINE(ZTS,1,[ ])
|
||||
CFLAGS="$CFLAGS -DZTS"
|
||||
|
||||
@@ -23,6 +23,6 @@ $test = new Test();
|
||||
$test2 = $test->__copy();
|
||||
var_dump($test2);
|
||||
?>
|
||||
--EXPECT--
|
||||
object(Test)#2 (0) {
|
||||
--EXPECTF--
|
||||
object(Test)#%d (0) {
|
||||
}
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
--TEST--
|
||||
Bug #38772 (inconsistent overriding of methods in different visibility contexts)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
|
||||
public function __construct() {
|
||||
$this -> foo();
|
||||
}
|
||||
|
||||
private function foo() {
|
||||
echo __METHOD__ . "\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
public function foo() {
|
||||
echo __METHOD__ . "\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
class C extends A {
|
||||
protected function foo() {
|
||||
echo __METHOD__ . "\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
class D extends A {
|
||||
private function foo() {
|
||||
echo __METHOD__ . "\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
$a = new A();
|
||||
$b = new B();
|
||||
$c = new C();
|
||||
$d = new D();
|
||||
--EXPECT--
|
||||
A::foo
|
||||
A::foo
|
||||
A::foo
|
||||
A::foo
|
||||
@@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
Bug #38779 (engine crashes when require()'ing file with syntax error through userspace stream wrapper)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Loader {
|
||||
private $position;
|
||||
private $data;
|
||||
public function stream_open($path, $mode, $options, &$opened_path) {
|
||||
$this->data = '<' . "?php \n\"\";ll l\n ?" . '>';
|
||||
$this->position = 0;
|
||||
return true;
|
||||
}
|
||||
function stream_read($count) {
|
||||
$ret = substr($this->data, $this->position, $count);
|
||||
$this->position += strlen($ret);
|
||||
return $ret;
|
||||
}
|
||||
function stream_eof() {
|
||||
return $this->position >= strlen($this->data);
|
||||
}
|
||||
}
|
||||
stream_wrapper_register('Loader', 'Loader');
|
||||
require 'Loader://qqq.php';
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Parse error: %s error%sin Loader://qqq.php on line %d
|
||||
@@ -0,0 +1,45 @@
|
||||
--TEST--
|
||||
Bug #38779 (engine crashes when require()'ing file with syntax error through userspace stream wrapper)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Loader {
|
||||
private $position;
|
||||
private $data;
|
||||
public function stream_open($path, $mode, $options, &$opened_path) {
|
||||
$this->data = '<' . "?php \n\"\";ll l\n ?" . '>';
|
||||
$this->position = 0;
|
||||
return true;
|
||||
}
|
||||
function stream_read($count) {
|
||||
$ret = substr($this->data, $this->position, $count);
|
||||
$this->position += strlen($ret);
|
||||
return $ret;
|
||||
}
|
||||
function stream_eof() {
|
||||
return $this->position >= strlen($this->data);
|
||||
}
|
||||
function stream_flush() {
|
||||
@unlink(dirname(__FILE__)."/bug38779.txt");
|
||||
var_dump("flush!");
|
||||
}
|
||||
function stream_close() {
|
||||
var_dump("close!");
|
||||
}
|
||||
}
|
||||
stream_wrapper_register('Loader', 'Loader');
|
||||
$fp = fopen ('Loader://qqq.php', 'r');
|
||||
|
||||
$filename = dirname(__FILE__)."/bug38779.txt";
|
||||
$fp1 = fopen($filename, "w");
|
||||
fwrite($fp1, "<"."?php blah blah?".">");
|
||||
fclose($fp1);
|
||||
|
||||
include $filename;
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Parse error: %s error%sin %s on line %d
|
||||
string(6) "flush!"
|
||||
string(6) "close!"
|
||||
@@ -503,6 +503,7 @@ static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS
|
||||
EG(current_execute_data) = NULL;
|
||||
EG(current_module) = NULL;
|
||||
EG(exit_status) = 0;
|
||||
EG(active) = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+6
-6
@@ -448,17 +448,17 @@ END_EXTERN_C()
|
||||
|
||||
#define zend_try \
|
||||
{ \
|
||||
jmp_buf *orig_bailout = EG(bailout); \
|
||||
jmp_buf bailout; \
|
||||
jmp_buf *__orig_bailout = EG(bailout); \
|
||||
jmp_buf __bailout; \
|
||||
\
|
||||
EG(bailout) = &bailout; \
|
||||
if (setjmp(bailout)==0) {
|
||||
EG(bailout) = &__bailout; \
|
||||
if (setjmp(__bailout)==0) {
|
||||
#define zend_catch \
|
||||
} else { \
|
||||
EG(bailout) = orig_bailout;
|
||||
EG(bailout) = __orig_bailout;
|
||||
#define zend_end_try() \
|
||||
} \
|
||||
EG(bailout) = orig_bailout; \
|
||||
EG(bailout) = __orig_bailout; \
|
||||
}
|
||||
#define zend_first_try EG(bailout)=NULL; zend_try
|
||||
|
||||
|
||||
@@ -1619,6 +1619,15 @@ static int alloc_globals_id;
|
||||
static zend_alloc_globals alloc_globals;
|
||||
#endif
|
||||
|
||||
ZEND_API int is_zend_mm(TSRMLS_D)
|
||||
{
|
||||
#if ZEND_USE_MALLOC_MM
|
||||
return AG(mm_heap)->use_zend_alloc;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
@@ -95,6 +95,7 @@ ZEND_API int zend_set_memory_limit(unsigned int memory_limit);
|
||||
|
||||
ZEND_API void start_memory_manager(TSRMLS_D);
|
||||
ZEND_API void shutdown_memory_manager(int silent, int full_shutdown TSRMLS_DC);
|
||||
ZEND_API int is_zend_mm(TSRMLS_D);
|
||||
|
||||
#if ZEND_DEBUG
|
||||
ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
|
||||
|
||||
+3
-1
@@ -2025,7 +2025,9 @@ static zend_bool do_inherit_method_check(HashTable *child_function_table, zend_f
|
||||
}
|
||||
}
|
||||
|
||||
if (parent_flags & ZEND_ACC_ABSTRACT) {
|
||||
if (parent_flags & ZEND_ACC_PRIVATE) {
|
||||
child->common.prototype = NULL;
|
||||
} else if (parent_flags & ZEND_ACC_ABSTRACT) {
|
||||
child->common.fn_flags |= ZEND_ACC_IMPLEMENTED_ABSTRACT;
|
||||
child->common.prototype = parent;
|
||||
} else if (!(parent->common.fn_flags & ZEND_ACC_CTOR) || (parent->common.prototype && (parent->common.prototype->common.scope->ce_flags & ZEND_ACC_INTERFACE))) {
|
||||
|
||||
@@ -188,6 +188,8 @@ void init_executor(TSRMLS_D)
|
||||
EG(scope) = NULL;
|
||||
|
||||
EG(This) = NULL;
|
||||
|
||||
EG(active) = 1;
|
||||
}
|
||||
|
||||
static int zval_call_destructor(zval **zv TSRMLS_DC)
|
||||
@@ -316,6 +318,7 @@ void shutdown_executor(TSRMLS_D)
|
||||
FREE_HASHTABLE(EG(in_autoload));
|
||||
}
|
||||
} zend_end_try();
|
||||
EG(active) = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -613,6 +616,10 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
char *fname, *colon;
|
||||
int fname_len;
|
||||
|
||||
if (!EG(active)) {
|
||||
return FAILURE; /* executor is already inactive */
|
||||
}
|
||||
|
||||
if (EG(exception)) {
|
||||
return FAILURE; /* we would result in an instable executor otherwise */
|
||||
}
|
||||
|
||||
@@ -237,6 +237,8 @@ struct _zend_executor_globals {
|
||||
|
||||
zend_property_info std_property_info;
|
||||
|
||||
zend_bool active;
|
||||
|
||||
void *reserved[ZEND_MAX_RESERVED_RESOURCES];
|
||||
};
|
||||
|
||||
|
||||
+2
-1
@@ -274,7 +274,8 @@ ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage)
|
||||
zend_ini_entry *ini_entry;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==FAILURE) {
|
||||
if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==FAILURE ||
|
||||
(stage == ZEND_INI_STAGE_RUNTIME && (ini_entry->modifiable & ZEND_INI_USER) == 0)) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
|
||||
+17
-16
@@ -783,7 +783,17 @@ static union _zend_function *zend_std_get_method(zval **object_ptr, char *method
|
||||
}
|
||||
|
||||
/* Check access level */
|
||||
if (fbc->op_array.fn_flags & ZEND_ACC_PUBLIC) {
|
||||
if (fbc->op_array.fn_flags & ZEND_ACC_PRIVATE) {
|
||||
zend_function *updated_fbc;
|
||||
|
||||
/* Ensure that if we're calling a private function, we're allowed to do so.
|
||||
*/
|
||||
updated_fbc = zend_check_private_int(fbc, Z_OBJ_HANDLER_P(object, get_class_entry)(object TSRMLS_CC), lc_method_name, method_len TSRMLS_CC);
|
||||
if (!updated_fbc) {
|
||||
zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : "");
|
||||
}
|
||||
fbc = updated_fbc;
|
||||
} else {
|
||||
/* Ensure that we haven't overridden a private function and end up calling
|
||||
* the overriding public function...
|
||||
*/
|
||||
@@ -796,21 +806,12 @@ static union _zend_function *zend_std_get_method(zval **object_ptr, char *method
|
||||
fbc = priv_fbc;
|
||||
}
|
||||
}
|
||||
} else if (fbc->op_array.fn_flags & ZEND_ACC_PRIVATE) {
|
||||
zend_function *updated_fbc;
|
||||
|
||||
/* Ensure that if we're calling a private function, we're allowed to do so.
|
||||
*/
|
||||
updated_fbc = zend_check_private_int(fbc, Z_OBJ_HANDLER_P(object, get_class_entry)(object TSRMLS_CC), lc_method_name, method_len TSRMLS_CC);
|
||||
if (!updated_fbc) {
|
||||
zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : "");
|
||||
}
|
||||
fbc = updated_fbc;
|
||||
} else if ((fbc->common.fn_flags & ZEND_ACC_PROTECTED)) {
|
||||
/* Ensure that if we're calling a protected function, we're allowed to do so.
|
||||
*/
|
||||
if (!zend_check_protected(zend_get_function_root_class(fbc), EG(scope))) {
|
||||
zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : "");
|
||||
if ((fbc->common.fn_flags & ZEND_ACC_PROTECTED)) {
|
||||
/* Ensure that if we're calling a protected function, we're allowed to do so.
|
||||
*/
|
||||
if (!zend_check_protected(zend_get_function_root_class(fbc), EG(scope))) {
|
||||
zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1385,7 +1385,7 @@ ZEND_VM_HANDLER(136, ZEND_ASSIGN_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
ZEND_VM_HANDLER(147, ZEND_ASSIGN_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|UNUSED|CV)
|
||||
ZEND_VM_HANDLER(147, ZEND_ASSIGN_DIM, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
zend_op *op_data = opline+1;
|
||||
@@ -1394,7 +1394,7 @@ ZEND_VM_HANDLER(147, ZEND_ASSIGN_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|UNUSED|CV)
|
||||
|
||||
if (OP1_TYPE == IS_CV || EX_T(opline->op1.u.var).var.ptr_ptr) {
|
||||
/* not an array offset */
|
||||
object_ptr = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_W);
|
||||
object_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
|
||||
} else {
|
||||
object_ptr = NULL;
|
||||
}
|
||||
|
||||
+5
-172
@@ -15255,39 +15255,6 @@ static int ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_ASSIGN_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
zend_op *op_data = opline+1;
|
||||
|
||||
zval **object_ptr;
|
||||
|
||||
if (IS_UNUSED == IS_CV || EX_T(opline->op1.u.var).var.ptr_ptr) {
|
||||
/* not an array offset */
|
||||
object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
|
||||
} else {
|
||||
object_ptr = NULL;
|
||||
}
|
||||
|
||||
if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) {
|
||||
zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC);
|
||||
} else {
|
||||
zend_free_op free_op_data1;
|
||||
zval *value;
|
||||
zval *dim = &opline->op2.u.constant;
|
||||
|
||||
zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), object_ptr, dim, 0, BP_VAR_W TSRMLS_CC);
|
||||
|
||||
value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R);
|
||||
zend_assign_to_variable(&opline->result, &op_data->op2, &op_data->op1, value, (IS_TMP_FREE(free_op_data1)?IS_TMP_VAR:op_data->op1.op_type), EX(Ts) TSRMLS_CC);
|
||||
FREE_OP_IF_VAR(free_op_data1);
|
||||
}
|
||||
|
||||
/* assign_dim has two opcodes! */
|
||||
ZEND_VM_INC_OPCODE();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
@@ -16368,40 +16335,6 @@ static int ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_ASSIGN_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
zend_op *op_data = opline+1;
|
||||
|
||||
zval **object_ptr;
|
||||
|
||||
if (IS_UNUSED == IS_CV || EX_T(opline->op1.u.var).var.ptr_ptr) {
|
||||
/* not an array offset */
|
||||
object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
|
||||
} else {
|
||||
object_ptr = NULL;
|
||||
}
|
||||
|
||||
if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) {
|
||||
zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC);
|
||||
} else {
|
||||
zend_free_op free_op2, free_op_data1;
|
||||
zval *value;
|
||||
zval *dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
|
||||
|
||||
zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), object_ptr, dim, 1, BP_VAR_W TSRMLS_CC);
|
||||
zval_dtor(free_op2.var);
|
||||
|
||||
value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R);
|
||||
zend_assign_to_variable(&opline->result, &op_data->op2, &op_data->op1, value, (IS_TMP_FREE(free_op_data1)?IS_TMP_VAR:op_data->op1.op_type), EX(Ts) TSRMLS_CC);
|
||||
FREE_OP_IF_VAR(free_op_data1);
|
||||
}
|
||||
|
||||
/* assign_dim has two opcodes! */
|
||||
ZEND_VM_INC_OPCODE();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
@@ -17442,40 +17375,6 @@ static int ZEND_ASSIGN_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_ASSIGN_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
zend_op *op_data = opline+1;
|
||||
|
||||
zval **object_ptr;
|
||||
|
||||
if (IS_UNUSED == IS_CV || EX_T(opline->op1.u.var).var.ptr_ptr) {
|
||||
/* not an array offset */
|
||||
object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
|
||||
} else {
|
||||
object_ptr = NULL;
|
||||
}
|
||||
|
||||
if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) {
|
||||
zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC);
|
||||
} else {
|
||||
zend_free_op free_op2, free_op_data1;
|
||||
zval *value;
|
||||
zval *dim = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
|
||||
|
||||
zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), object_ptr, dim, 0, BP_VAR_W TSRMLS_CC);
|
||||
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
|
||||
|
||||
value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R);
|
||||
zend_assign_to_variable(&opline->result, &op_data->op2, &op_data->op1, value, (IS_TMP_FREE(free_op_data1)?IS_TMP_VAR:op_data->op1.op_type), EX(Ts) TSRMLS_CC);
|
||||
FREE_OP_IF_VAR(free_op_data1);
|
||||
}
|
||||
|
||||
/* assign_dim has two opcodes! */
|
||||
ZEND_VM_INC_OPCODE();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
@@ -18130,39 +18029,6 @@ static int ZEND_ASSIGN_BW_XOR_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARG
|
||||
return zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(bitwise_xor_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
|
||||
static int ZEND_ASSIGN_DIM_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
zend_op *op_data = opline+1;
|
||||
|
||||
zval **object_ptr;
|
||||
|
||||
if (IS_UNUSED == IS_CV || EX_T(opline->op1.u.var).var.ptr_ptr) {
|
||||
/* not an array offset */
|
||||
object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
|
||||
} else {
|
||||
object_ptr = NULL;
|
||||
}
|
||||
|
||||
if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) {
|
||||
zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC);
|
||||
} else {
|
||||
zend_free_op free_op_data1;
|
||||
zval *value;
|
||||
zval *dim = NULL;
|
||||
|
||||
zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), object_ptr, dim, 0, BP_VAR_W TSRMLS_CC);
|
||||
|
||||
value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R);
|
||||
zend_assign_to_variable(&opline->result, &op_data->op2, &op_data->op1, value, (IS_TMP_FREE(free_op_data1)?IS_TMP_VAR:op_data->op1.op_type), EX(Ts) TSRMLS_CC);
|
||||
FREE_OP_IF_VAR(free_op_data1);
|
||||
}
|
||||
|
||||
/* assign_dim has two opcodes! */
|
||||
ZEND_VM_INC_OPCODE();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
@@ -18890,39 +18756,6 @@ static int ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_ASSIGN_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
zend_op *op_data = opline+1;
|
||||
|
||||
zval **object_ptr;
|
||||
|
||||
if (IS_UNUSED == IS_CV || EX_T(opline->op1.u.var).var.ptr_ptr) {
|
||||
/* not an array offset */
|
||||
object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
|
||||
} else {
|
||||
object_ptr = NULL;
|
||||
}
|
||||
|
||||
if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) {
|
||||
zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC);
|
||||
} else {
|
||||
zend_free_op free_op_data1;
|
||||
zval *value;
|
||||
zval *dim = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
|
||||
|
||||
zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), object_ptr, dim, 0, BP_VAR_W TSRMLS_CC);
|
||||
|
||||
value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R);
|
||||
zend_assign_to_variable(&opline->result, &op_data->op2, &op_data->op1, value, (IS_TMP_FREE(free_op_data1)?IS_TMP_VAR:op_data->op1.op_type), EX(Ts) TSRMLS_CC);
|
||||
FREE_OP_IF_VAR(free_op_data1);
|
||||
}
|
||||
|
||||
/* assign_dim has two opcodes! */
|
||||
ZEND_VM_INC_OPCODE();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
|
||||
static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
@@ -30623,11 +30456,11 @@ void zend_init_opcodes_handlers()
|
||||
ZEND_ASSIGN_DIM_SPEC_VAR_VAR_HANDLER,
|
||||
ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_HANDLER,
|
||||
ZEND_ASSIGN_DIM_SPEC_VAR_CV_HANDLER,
|
||||
ZEND_ASSIGN_DIM_SPEC_UNUSED_CONST_HANDLER,
|
||||
ZEND_ASSIGN_DIM_SPEC_UNUSED_TMP_HANDLER,
|
||||
ZEND_ASSIGN_DIM_SPEC_UNUSED_VAR_HANDLER,
|
||||
ZEND_ASSIGN_DIM_SPEC_UNUSED_UNUSED_HANDLER,
|
||||
ZEND_ASSIGN_DIM_SPEC_UNUSED_CV_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_NULL_HANDLER,
|
||||
ZEND_ASSIGN_DIM_SPEC_CV_CONST_HANDLER,
|
||||
ZEND_ASSIGN_DIM_SPEC_CV_TMP_HANDLER,
|
||||
ZEND_ASSIGN_DIM_SPEC_CV_VAR_HANDLER,
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ AC_CONFIG_HEADER(main/php_config.h)
|
||||
MAJOR_VERSION=5
|
||||
MINOR_VERSION=2
|
||||
RELEASE_VERSION=0
|
||||
EXTRA_VERSION="RC3"
|
||||
EXTRA_VERSION="RC4"
|
||||
PHP_VERSION="$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION$EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]MAJOR_VERSION \* 10000 + [$]MINOR_VERSION \* 100 + [$]RELEASE_VERSION`
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ static PHP_INI_MH(OnTypeLibFileUpdate)
|
||||
char *strtok_buf = NULL;
|
||||
int cached;
|
||||
|
||||
if (!new_value || (typelib_file = VCWD_FOPEN(new_value, "r"))==NULL) {
|
||||
if (!new_value || !new_value[0] || (typelib_file = VCWD_FOPEN(new_value, "r"))==NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -2,18 +2,18 @@ dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
|
||||
PHP_ARG_WITH(curl, for CURL support,
|
||||
[ --with-curl[=DIR] Include CURL support])
|
||||
PHP_ARG_WITH(curl, for cURL support,
|
||||
[ --with-curl[=DIR] Include cURL support])
|
||||
|
||||
dnl Temporary option while we develop this aspect of the extension
|
||||
PHP_ARG_WITH(curlwrappers, if we should use CURL for url streams,
|
||||
[ --with-curlwrappers Use CURL for url streams], no, no)
|
||||
PHP_ARG_WITH(curlwrappers, if we should use cURL for url streams,
|
||||
[ --with-curlwrappers Use cURL for url streams], no, no)
|
||||
|
||||
if test "$PHP_CURL" != "no"; then
|
||||
if test -r $PHP_CURL/include/curl/easy.h; then
|
||||
CURL_DIR=$PHP_CURL
|
||||
else
|
||||
AC_MSG_CHECKING(for CURL in default path)
|
||||
AC_MSG_CHECKING(for cURL in default path)
|
||||
for i in /usr/local /usr; do
|
||||
if test -r $i/include/curl/easy.h; then
|
||||
CURL_DIR=$i
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
// $Id$
|
||||
// vim:ft=javascript
|
||||
|
||||
ARG_WITH("curl", "CURL support", "no");
|
||||
ARG_WITH("curl", "cURL support", "no");
|
||||
|
||||
if (PHP_CURL != "no") {
|
||||
if (CHECK_LIB("libcurl.lib", "curl", PHP_CURL) &&
|
||||
@@ -11,8 +11,8 @@ if (PHP_CURL != "no") {
|
||||
CHECK_LIB("zlib.lib", "curl", PHP_CURL) &&
|
||||
CHECK_LIB("winmm.lib", "curl", PHP_CURL)) {
|
||||
EXTENSION("curl", "interface.c multi.c streams.c");
|
||||
AC_DEFINE('HAVE_CURL', 1, 'Have CURL library');
|
||||
AC_DEFINE('HAVE_CURL_SSL', 1, 'Have SSL suppurt in CURL');
|
||||
AC_DEFINE('HAVE_CURL', 1, 'Have cURL library');
|
||||
AC_DEFINE('HAVE_CURL_SSL', 1, 'Have SSL suppurt in cURL');
|
||||
// TODO: check for curl_version_info
|
||||
// AC_DEFINE('PHP_CURL_URL_WRAPPERS', 0, 'Use curl for URL wrappers [experimental]');
|
||||
} else {
|
||||
|
||||
@@ -332,8 +332,8 @@ ZEND_GET_MODULE (curl)
|
||||
PHP_MINFO_FUNCTION(curl)
|
||||
{
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_row(2, "CURL support", "enabled");
|
||||
php_info_print_table_row(2, "CURL Information", curl_version());
|
||||
php_info_print_table_row(2, "cURL support", "enabled");
|
||||
php_info_print_table_row(2, "cURL Information", curl_version());
|
||||
php_info_print_table_end();
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1054,7 +1054,7 @@ static void alloc_curl_handle(php_curl **ch)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource curl_init([string url])
|
||||
Initialize a CURL session */
|
||||
Initialize a cURL session */
|
||||
PHP_FUNCTION(curl_init)
|
||||
{
|
||||
zval **url;
|
||||
@@ -1557,7 +1557,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
|
||||
}
|
||||
|
||||
/* {{{ proto bool curl_setopt(resource ch, int option, mixed value)
|
||||
Set an option for a CURL transfer */
|
||||
Set an option for a cURL transfer */
|
||||
PHP_FUNCTION(curl_setopt)
|
||||
{
|
||||
zval **zid, **zoption, **zvalue;
|
||||
@@ -1580,7 +1580,7 @@ PHP_FUNCTION(curl_setopt)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool curl_setopt_array(resource ch, array options)
|
||||
Set an array of option for a CURL transfer */
|
||||
Set an array of option for a cURL transfer */
|
||||
PHP_FUNCTION(curl_setopt_array)
|
||||
{
|
||||
zval *zid, *arr, **entry;
|
||||
@@ -1629,7 +1629,7 @@ void _php_curl_cleanup_handle(php_curl *ch)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool curl_exec(resource ch)
|
||||
Perform a CURL session */
|
||||
Perform a cURL session */
|
||||
PHP_FUNCTION(curl_exec)
|
||||
{
|
||||
zval **zid;
|
||||
@@ -1850,7 +1850,7 @@ PHP_FUNCTION(curl_errno)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto void curl_close(resource ch)
|
||||
Close a CURL session */
|
||||
Close a cURL session */
|
||||
PHP_FUNCTION(curl_close)
|
||||
{
|
||||
zval **zid;
|
||||
@@ -1863,7 +1863,7 @@ PHP_FUNCTION(curl_close)
|
||||
ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
|
||||
|
||||
if (ch->in_callback) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempt to close CURL handle from a callback");
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempt to close cURL handle from a callback");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+11
-10
@@ -62,7 +62,7 @@ PHP_FUNCTION(curl_multi_init)
|
||||
mh = ecalloc(1, sizeof(php_curlm));
|
||||
mh->multi = curl_multi_init();
|
||||
|
||||
zend_llist_init(&mh->easyh, sizeof(zval *), (llist_dtor_func_t) ZVAL_PTR_DTOR, 0);
|
||||
zend_llist_init(&mh->easyh, sizeof(zval *), (llist_dtor_func_t) NULL, 0);
|
||||
|
||||
ZEND_REGISTER_RESOURCE(return_value, mh, le_curl_multi_handle);
|
||||
}
|
||||
@@ -76,6 +76,7 @@ PHP_FUNCTION(curl_multi_add_handle)
|
||||
zval *z_ch;
|
||||
php_curlm *mh;
|
||||
php_curl *ch;
|
||||
zval tmp_val;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr", &z_mh, &z_ch) == FAILURE) {
|
||||
return;
|
||||
@@ -87,11 +88,11 @@ PHP_FUNCTION(curl_multi_add_handle)
|
||||
_php_curl_cleanup_handle(ch);
|
||||
ch->uses++;
|
||||
|
||||
/* we want to create a copy of this zval that we store in the multihandle
|
||||
structure element "easyh" - so we separate it from the original
|
||||
input zval to this function using SEPARATE_ZVAL */
|
||||
SEPARATE_ZVAL( &z_ch );
|
||||
zend_llist_add_element(&mh->easyh, &z_ch);
|
||||
/* we want to create a copy of this zval that we store in the multihandle structure element "easyh" */
|
||||
tmp_val = *z_ch;
|
||||
zval_copy_ctor(&tmp_val);
|
||||
|
||||
zend_llist_add_element(&mh->easyh, &tmp_val);
|
||||
|
||||
RETURN_LONG((long) curl_multi_add_handle(mh->multi, ch->cp));
|
||||
}
|
||||
@@ -99,11 +100,11 @@ PHP_FUNCTION(curl_multi_add_handle)
|
||||
|
||||
|
||||
/* Used internally as comparison routine passed to zend_list_del_element */
|
||||
static int curl_compare_resources( zval **z1, zval **z2 )
|
||||
static int curl_compare_resources( zval *z1, zval **z2 )
|
||||
{
|
||||
return (Z_TYPE_PP( z1 ) == Z_TYPE_PP( z2 ) &&
|
||||
Z_TYPE_PP( z1 ) == IS_RESOURCE &&
|
||||
Z_LVAL_PP( z1 ) == Z_LVAL_PP( z2 ) );
|
||||
return (Z_TYPE_P( z1 ) == Z_TYPE_PP( z2 ) &&
|
||||
Z_TYPE_P( z1 ) == IS_RESOURCE &&
|
||||
Z_LVAL_P( z1 ) == Z_LVAL_PP( z2 ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
+18883
-18444
File diff suppressed because it is too large.
Load diff
@@ -849,8 +849,8 @@ wddx = year4 "-" month "-" day "T" hour24 ":" minute ":" second;
|
||||
pgydotd = year4 "."? dayofyear;
|
||||
pgtextshort = monthabbr "-" daylz "-" year;
|
||||
pgtextreverse = year "-" monthabbr "-" daylz;
|
||||
isoweekday = year4 "W" weekofyear [0-7];
|
||||
isoweek = year4 "W" weekofyear;
|
||||
isoweekday = year4 "-"? "W" weekofyear "-"? [0-7];
|
||||
isoweek = year4 "-"? "W" weekofyear;
|
||||
exif = year4 ":" monthlz ":" daylz " " hour24lz ":" minutelz ":" secondlz;
|
||||
|
||||
/* Common Log Format: 10/Oct/2000:13:55:36 -0700 */
|
||||
@@ -1522,11 +1522,13 @@ timelib_time* timelib_strtotime(char *s, int len, struct timelib_error_container
|
||||
in.errors->error_count = 0;
|
||||
in.errors->error_messages = NULL;
|
||||
|
||||
while (isspace(*s) && s < e) {
|
||||
s++;
|
||||
}
|
||||
while (isspace(*e) && e > s) {
|
||||
e--;
|
||||
if (len > 0) {
|
||||
while (isspace(*s) && s < e) {
|
||||
s++;
|
||||
}
|
||||
while (isspace(*e) && e > s) {
|
||||
e--;
|
||||
}
|
||||
}
|
||||
if (e - s < 1) {
|
||||
in.time = timelib_time_ctor();
|
||||
|
||||
@@ -217,7 +217,7 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const
|
||||
{
|
||||
int pos;
|
||||
|
||||
pos = tz_search(timezone, 0, tzdb->index_size, tzdb);
|
||||
pos = tz_search(timezone, 0, tzdb->index_size - 1, tzdb);
|
||||
|
||||
if (pos == -1) {
|
||||
return 0;
|
||||
|
||||
Executable
+1
@@ -0,0 +1 @@
|
||||
# include "config.w32.h"
|
||||
+62
-8
@@ -1366,7 +1366,7 @@ PHP_FUNCTION(time)
|
||||
PHP_FUNCTION(localtime)
|
||||
{
|
||||
long timestamp = (long)time(NULL);
|
||||
int associative = 0;
|
||||
zend_bool associative = 0;
|
||||
timelib_tzinfo *tzi;
|
||||
timelib_time *ts;
|
||||
|
||||
@@ -1477,7 +1477,7 @@ static void date_register_classes(TSRMLS_D)
|
||||
date_object_handlers_timezone.clone_obj = date_object_clone_timezone;
|
||||
}
|
||||
|
||||
inline zend_object_value date_object_new_date_ex(zend_class_entry *class_type, php_date_obj **ptr TSRMLS_DC)
|
||||
static inline zend_object_value date_object_new_date_ex(zend_class_entry *class_type, php_date_obj **ptr TSRMLS_DC)
|
||||
{
|
||||
php_date_obj *intern;
|
||||
zend_object_value retval;
|
||||
@@ -1524,7 +1524,7 @@ static zend_object_value date_object_clone_date(zval *this_ptr TSRMLS_DC)
|
||||
return new_ov;
|
||||
}
|
||||
|
||||
inline zend_object_value date_object_new_timezone_ex(zend_class_entry *class_type, php_timezone_obj **ptr TSRMLS_DC)
|
||||
static inline zend_object_value date_object_new_timezone_ex(zend_class_entry *class_type, php_timezone_obj **ptr TSRMLS_DC)
|
||||
{
|
||||
php_timezone_obj *intern;
|
||||
zend_object_value retval;
|
||||
@@ -1652,6 +1652,8 @@ static void date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, int
|
||||
timelib_time_dtor(now);
|
||||
}
|
||||
|
||||
/* {{{ proto DateTime date_create([string time[, DateTimeZone object]])
|
||||
*/
|
||||
PHP_FUNCTION(date_create)
|
||||
{
|
||||
zval *timezone_object = NULL;
|
||||
@@ -1665,7 +1667,10 @@ PHP_FUNCTION(date_create)
|
||||
date_instantiate(date_ce_date, return_value TSRMLS_CC);
|
||||
date_initialize(zend_object_store_get_object(return_value TSRMLS_CC), time_str, time_str_len, timezone_object TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto DateTime::__construct([string time[, DateTimeZone object]])
|
||||
*/
|
||||
PHP_METHOD(DateTime, __construct)
|
||||
{
|
||||
zval *timezone_object = NULL;
|
||||
@@ -1678,7 +1683,10 @@ PHP_METHOD(DateTime, __construct)
|
||||
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array date_parse(string date)
|
||||
*/
|
||||
PHP_FUNCTION(date_parse)
|
||||
{
|
||||
char *date;
|
||||
@@ -1775,6 +1783,8 @@ PHP_FUNCTION(date_parse)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string date_format(DateTime object, string format)
|
||||
*/
|
||||
PHP_FUNCTION(date_format)
|
||||
{
|
||||
zval *object;
|
||||
@@ -1789,7 +1799,10 @@ PHP_FUNCTION(date_format)
|
||||
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
|
||||
RETURN_STRING(date_format(format, format_len, dateobj->time, dateobj->time->is_localtime), 0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto void date_modify(DateTime object, string modify)
|
||||
*/
|
||||
PHP_FUNCTION(date_modify)
|
||||
{
|
||||
zval *object;
|
||||
@@ -1820,7 +1833,10 @@ PHP_FUNCTION(date_modify)
|
||||
timelib_update_ts(dateobj->time, NULL);
|
||||
timelib_update_from_sse(dateobj->time);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto DateTimeZone date_timezone_get(DateTime object)
|
||||
*/
|
||||
PHP_FUNCTION(date_timezone_get)
|
||||
{
|
||||
zval *object;
|
||||
@@ -1840,7 +1856,10 @@ PHP_FUNCTION(date_timezone_get)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto void date_timezone_set(DateTime object, DateTimeZone object)
|
||||
*/
|
||||
PHP_FUNCTION(date_timezone_set)
|
||||
{
|
||||
zval *object;
|
||||
@@ -1848,7 +1867,7 @@ PHP_FUNCTION(date_timezone_set)
|
||||
php_date_obj *dateobj;
|
||||
php_timezone_obj *tzobj;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|O", &object, date_ce_date, &timezone_object, date_ce_timezone) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &object, date_ce_date, &timezone_object, date_ce_timezone) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
|
||||
@@ -1860,7 +1879,10 @@ PHP_FUNCTION(date_timezone_set)
|
||||
timelib_set_timezone(dateobj->time, timelib_tzinfo_clone(tzobj->tz));
|
||||
timelib_unixtime2local(dateobj->time, dateobj->time->sse);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto long date_offset_get(DateTime object)
|
||||
*/
|
||||
PHP_FUNCTION(date_offset_get)
|
||||
{
|
||||
zval *object;
|
||||
@@ -1881,7 +1903,10 @@ PHP_FUNCTION(date_offset_get)
|
||||
RETURN_LONG(0);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto void date_time_set(DateTime object, long hour, long minute[, long second])
|
||||
*/
|
||||
PHP_FUNCTION(date_time_set)
|
||||
{
|
||||
zval *object;
|
||||
@@ -1898,7 +1923,10 @@ PHP_FUNCTION(date_time_set)
|
||||
dateobj->time->s = s;
|
||||
timelib_update_ts(dateobj->time, NULL);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto void date_date_set(DateTime object, long year, long month, long day)
|
||||
*/
|
||||
PHP_FUNCTION(date_date_set)
|
||||
{
|
||||
zval *object;
|
||||
@@ -1915,7 +1943,10 @@ PHP_FUNCTION(date_date_set)
|
||||
dateobj->time->d = d;
|
||||
timelib_update_ts(dateobj->time, NULL);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto void date_isodate_set(DateTime object, long year, long week[, long day])
|
||||
*/
|
||||
PHP_FUNCTION(date_isodate_set)
|
||||
{
|
||||
zval *object;
|
||||
@@ -1935,7 +1966,7 @@ PHP_FUNCTION(date_isodate_set)
|
||||
|
||||
timelib_update_ts(dateobj->time, NULL);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
static int timezone_initialize(timelib_tzinfo **tzi, /*const*/ char *tz TSRMLS_DC)
|
||||
{
|
||||
@@ -1957,6 +1988,8 @@ static int timezone_initialize(timelib_tzinfo **tzi, /*const*/ char *tz TSRMLS_D
|
||||
}
|
||||
}
|
||||
|
||||
/* {{{ proto DateTimeZone timezone_open(string timezone)
|
||||
*/
|
||||
PHP_FUNCTION(timezone_open)
|
||||
{
|
||||
char *tz;
|
||||
@@ -1971,22 +2004,28 @@ PHP_FUNCTION(timezone_open)
|
||||
}
|
||||
((php_timezone_obj *) zend_object_store_get_object(date_instantiate(date_ce_timezone, return_value TSRMLS_CC) TSRMLS_CC))->tz = tzi;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto DateTimeZone::__construct(string timezone)
|
||||
*/
|
||||
PHP_METHOD(DateTimeZone, __construct)
|
||||
{
|
||||
char *tz;
|
||||
int tz_len;
|
||||
timelib_tzinfo *tzi = NULL;
|
||||
|
||||
php_set_error_handling(EH_THROW, NULL TSRMLS_CC);
|
||||
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len)) {
|
||||
php_set_error_handling(EH_THROW, NULL TSRMLS_CC);
|
||||
if (SUCCESS == timezone_initialize(&tzi, tz TSRMLS_CC)) {
|
||||
((php_timezone_obj *) zend_object_store_get_object(getThis() TSRMLS_CC))->tz = tzi;
|
||||
}
|
||||
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
|
||||
}
|
||||
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string timezone_name_get(DateTimeZone object)
|
||||
*/
|
||||
PHP_FUNCTION(timezone_name_get)
|
||||
{
|
||||
zval *object;
|
||||
@@ -2000,7 +2039,10 @@ PHP_FUNCTION(timezone_name_get)
|
||||
|
||||
RETURN_STRING(tzobj->tz->name, 1);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string timezone_name_from_abbr(string abbr[, long gmtOffset[, long isdst]])
|
||||
*/
|
||||
PHP_FUNCTION(timezone_name_from_abbr)
|
||||
{
|
||||
char *abbr;
|
||||
@@ -2020,7 +2062,10 @@ PHP_FUNCTION(timezone_name_from_abbr)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto long timezone_offset_get(DateTimeZone object, DateTime object)
|
||||
*/
|
||||
PHP_FUNCTION(timezone_offset_get)
|
||||
{
|
||||
zval *object, *dateobject;
|
||||
@@ -2040,7 +2085,10 @@ PHP_FUNCTION(timezone_offset_get)
|
||||
RETVAL_LONG(offset->offset);
|
||||
timelib_time_offset_dtor(offset);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array timezone_transitions_get(DateTimeZone object)
|
||||
*/
|
||||
PHP_FUNCTION(timezone_transitions_get)
|
||||
{
|
||||
zval *object, *element;
|
||||
@@ -2066,7 +2114,10 @@ PHP_FUNCTION(timezone_transitions_get)
|
||||
add_next_index_zval(return_value, element);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array timezone_identifiers_list()
|
||||
*/
|
||||
PHP_FUNCTION(timezone_identifiers_list)
|
||||
{
|
||||
const timelib_tzdb *tzdb;
|
||||
@@ -2083,7 +2134,10 @@ PHP_FUNCTION(timezone_identifiers_list)
|
||||
add_next_index_string(return_value, table[i].id, 1);
|
||||
};
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* proto {{{ array timezone_abbreviations_list()
|
||||
*/
|
||||
PHP_FUNCTION(timezone_abbreviations_list)
|
||||
{
|
||||
const timelib_tz_lookup_table *table, *entry;
|
||||
@@ -2115,7 +2169,7 @@ PHP_FUNCTION(timezone_abbreviations_list)
|
||||
entry++;
|
||||
} while (entry->name);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool date_default_timezone_set(string timezone_identifier)
|
||||
Sets the default timezone used by all date/time functions in a script */
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
setting bogus timezones
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
//bogus
|
||||
var_dump(date_default_timezone_set('AAA'));
|
||||
var_dump(date_default_timezone_set('ZZZ'));
|
||||
|
||||
|
||||
//now the first and the last one
|
||||
var_dump(date_default_timezone_set("Africa/Abidjan"));
|
||||
var_dump(date_default_timezone_set("Zulu"));
|
||||
|
||||
echo "done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: date_default_timezone_set(): Timezone ID 'AAA' is invalid in %stimezones.php on line 4
|
||||
bool(false)
|
||||
|
||||
Notice: date_default_timezone_set(): Timezone ID 'ZZZ' is invalid in %stimezones.php on line 5
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
done
|
||||
+13
-15
@@ -26,10 +26,14 @@ dbhead_t *get_dbf_head(int fd)
|
||||
|
||||
if ((dbh = (dbhead_t *)calloc(1, sizeof(dbhead_t))) == NULL)
|
||||
return NULL;
|
||||
if (lseek(fd, 0, 0) < 0)
|
||||
if (lseek(fd, 0, 0) < 0) {
|
||||
free(dbh);
|
||||
return NULL;
|
||||
if ((ret = read(fd, &dbhead, sizeof(dbhead))) < 0)
|
||||
}
|
||||
if ((ret = read(fd, &dbhead, sizeof(dbhead))) <= 0) {
|
||||
free(dbh);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* build in core info */
|
||||
dbh->db_fd = fd;
|
||||
@@ -54,6 +58,7 @@ dbhead_t *get_dbf_head(int fd)
|
||||
|
||||
if (gf_retval < 0) {
|
||||
free_dbf_head(dbh);
|
||||
free(tdbf);
|
||||
return NULL;
|
||||
}
|
||||
if (gf_retval != 2 ) {
|
||||
@@ -89,7 +94,7 @@ void free_dbf_head(dbhead_t *dbh)
|
||||
free(cur_f->db_format);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
free(dbf);
|
||||
free(dbh);
|
||||
}
|
||||
@@ -119,7 +124,7 @@ int put_dbf_head(dbhead_t *dbh)
|
||||
|
||||
if (lseek(fd, 0, 0) < 0)
|
||||
return -1;
|
||||
if ((ret = write(fd, &dbhead, sizeof(dbhead))) < 0)
|
||||
if ((ret = write(fd, &dbhead, sizeof(dbhead))) <= 0)
|
||||
return -1;
|
||||
return ret;
|
||||
}
|
||||
@@ -132,7 +137,7 @@ int get_dbf_field(dbhead_t *dbh, dbfield_t *dbf)
|
||||
struct dbf_dfield dbfield;
|
||||
int ret;
|
||||
|
||||
if ((ret = read(dbh->db_fd, &dbfield, sizeof(dbfield))) < 0) {
|
||||
if ((ret = read(dbh->db_fd, &dbfield, sizeof(dbfield))) <= 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -192,7 +197,7 @@ int put_dbf_field(dbhead_t *dbh, dbfield_t *dbf)
|
||||
}
|
||||
|
||||
/* now write it out to disk */
|
||||
if ((ret = write(dbh->db_fd, &dbfield, sizeof(dbfield))) < 0) {
|
||||
if ((ret = write(dbh->db_fd, &dbfield, sizeof(dbfield))) <= 0) {
|
||||
return ret;
|
||||
}
|
||||
return 1;
|
||||
@@ -252,21 +257,14 @@ dbhead_t *dbf_open(char *dp, int o_flags TSRMLS_DC)
|
||||
|
||||
cp = dp;
|
||||
if ((fd = VCWD_OPEN(cp, o_flags|O_BINARY)) < 0) {
|
||||
cp = (char *)malloc(MAXPATHLEN); /* So where does this get free()'d? -RL */
|
||||
strncpy(cp, dp, MAXPATHLEN-5); strcat(cp, ".dbf");
|
||||
if ((fd = VCWD_OPEN(cp, o_flags)) < 0) {
|
||||
free(cp);
|
||||
perror("open");
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((dbh = get_dbf_head(fd)) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
dbh->db_name = cp;
|
||||
|
||||
dbh->db_cur_rec = 0;
|
||||
|
||||
return dbh;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
--TEST--
|
||||
dbase_open() tests
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("dbase")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$file = dirname(__FILE__)."/002.dbf";
|
||||
@unlink($file);
|
||||
|
||||
$fp = fopen($file, "w");
|
||||
fclose($fp);
|
||||
|
||||
var_dump(dbase_open($file, -1));
|
||||
var_dump(dbase_open($file, 1000));
|
||||
var_dump(dbase_open($file, 0));
|
||||
var_dump(dbase_open($file."nonex", 0));
|
||||
var_dump(dbase_open("", 0));
|
||||
|
||||
@unlink($file);
|
||||
|
||||
$def = array(
|
||||
array("date", "D"),
|
||||
array("name", "C", 50),
|
||||
array("age", "N", 3, 0),
|
||||
array("email", "C", 128),
|
||||
array("ismember", "L")
|
||||
);
|
||||
|
||||
var_dump(dbase_create($file, $def));
|
||||
var_dump(dbase_open($file, 0));
|
||||
|
||||
@unlink($file);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: dbase_open(): unable to open database %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: dbase_open(): unable to open database %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: dbase_open(): unable to open database %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: dbase_open(): unable to open database %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: dbase_open(): unable to open database in %s on line %d
|
||||
bool(false)
|
||||
int(%d)
|
||||
int(%d)
|
||||
Done
|
||||
@@ -73,7 +73,7 @@ PHP_METHOD(domentityreference, __construct)
|
||||
|
||||
intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC);
|
||||
if (intern != NULL) {
|
||||
oldnode = (xmlNodePtr)intern->ptr;
|
||||
oldnode = dom_object_get_node(intern);
|
||||
if (oldnode != NULL) {
|
||||
php_libxml_node_free_resource(oldnode TSRMLS_CC);
|
||||
}
|
||||
|
||||
+15
-11
@@ -301,7 +301,7 @@ static filter_list_entry php_find_filter(long id) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void php_zval_filter(zval **value, long filter, long flags, zval *options, char* charset TSRMLS_DC) /* {{{ */
|
||||
static void php_zval_filter(zval **value, long filter, long flags, zval *options, char* charset, zend_bool copy TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
filter_list_entry filter_func;
|
||||
|
||||
@@ -312,7 +312,9 @@ static void php_zval_filter(zval **value, long filter, long flags, zval *options
|
||||
filter_func = php_find_filter(FILTER_DEFAULT);
|
||||
}
|
||||
|
||||
SEPARATE_ZVAL(value);
|
||||
if (copy) {
|
||||
SEPARATE_ZVAL(value);
|
||||
}
|
||||
/* Here be strings */
|
||||
convert_to_string(*value);
|
||||
|
||||
@@ -379,7 +381,7 @@ static unsigned int php_sapi_filter(int arg, char *var, char **val, unsigned int
|
||||
if (!(IF_G(default_filter) == FILTER_UNSAFE_RAW)) {
|
||||
zval *tmp_new_var = &new_var;
|
||||
Z_STRVAL(new_var) = estrndup(*val, val_len);
|
||||
php_zval_filter(&tmp_new_var, IF_G(default_filter), IF_G(default_filter_flags), NULL, NULL/*charset*/ TSRMLS_CC);
|
||||
php_zval_filter(&tmp_new_var, IF_G(default_filter), IF_G(default_filter_flags), NULL, NULL/*charset*/, 0 TSRMLS_CC);
|
||||
} else if (PG(magic_quotes_gpc)) {
|
||||
Z_STRVAL(new_var) = php_addslashes(*val, Z_STRLEN(new_var), &Z_STRLEN(new_var), 0 TSRMLS_CC);
|
||||
} else {
|
||||
@@ -413,7 +415,7 @@ static unsigned int php_sapi_filter(int arg, char *var, char **val, unsigned int
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void php_zval_filter_recursive(zval **value, long filter, long flags, zval *options, char *charset TSRMLS_DC) /* {{{ */
|
||||
static void php_zval_filter_recursive(zval **value, long filter, long flags, zval *options, char *charset, zend_bool copy TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zval **element;
|
||||
HashPosition pos;
|
||||
@@ -422,10 +424,10 @@ static void php_zval_filter_recursive(zval **value, long filter, long flags, zva
|
||||
for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(value), &pos);
|
||||
zend_hash_get_current_data_ex(Z_ARRVAL_PP(value), (void **) &element, &pos) == SUCCESS;
|
||||
zend_hash_move_forward_ex(Z_ARRVAL_PP(value), &pos)) {
|
||||
php_zval_filter_recursive(element, filter, flags, options, charset TSRMLS_CC);
|
||||
php_zval_filter_recursive(element, filter, flags, options, charset, copy TSRMLS_CC);
|
||||
}
|
||||
} else {
|
||||
php_zval_filter(value, filter, flags, options, charset TSRMLS_CC);
|
||||
php_zval_filter(value, filter, flags, options, charset, copy TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -634,7 +636,7 @@ PHP_FUNCTION(input_get)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
filter_flags = FILTER_FLAG_SCALAR;
|
||||
filter_flags = filter_flags | FILTER_FLAG_SCALAR;
|
||||
}
|
||||
|
||||
zval_copy_ctor(return_value); /* Watch out for empty strings */
|
||||
@@ -644,7 +646,7 @@ PHP_FUNCTION(input_get)
|
||||
ZVAL_BOOL(return_value, 0);
|
||||
}
|
||||
|
||||
php_zval_filter_recursive(&return_value, filter, filter_flags, options, charset TSRMLS_CC);
|
||||
php_zval_filter_recursive(&return_value, filter, filter_flags, options, charset, 1 TSRMLS_CC);
|
||||
} else {
|
||||
RETURN_NULL();
|
||||
}
|
||||
@@ -673,6 +675,7 @@ PHP_FUNCTION(input_get_args)
|
||||
char *key;
|
||||
unsigned int key_len;
|
||||
unsigned long index;
|
||||
zend_bool copy = 0;
|
||||
|
||||
/* pointers to the zval array GET, POST,... */
|
||||
zval *array_ptr = NULL;
|
||||
@@ -700,6 +703,7 @@ PHP_FUNCTION(input_get_args)
|
||||
|
||||
case PARSE_DATA:
|
||||
array_ptr = values;
|
||||
copy = 1;
|
||||
break;
|
||||
|
||||
case PARSE_SESSION:
|
||||
@@ -791,7 +795,7 @@ PHP_FUNCTION(input_get_args)
|
||||
}
|
||||
|
||||
if (filter_flags & FILTER_FLAG_ARRAY) {
|
||||
php_zval_filter_recursive(tmp, filter, filter_flags, options, charset TSRMLS_CC);
|
||||
php_zval_filter_recursive(tmp, filter, filter_flags, options, charset, copy TSRMLS_CC);
|
||||
|
||||
/* ARRAY always returns an array */
|
||||
if (Z_TYPE_PP(tmp) != IS_ARRAY) {
|
||||
@@ -801,7 +805,7 @@ PHP_FUNCTION(input_get_args)
|
||||
*tmp = temparray;
|
||||
}
|
||||
} else {
|
||||
php_zval_filter(tmp, filter, filter_flags, options, charset TSRMLS_CC);
|
||||
php_zval_filter(tmp, filter, filter_flags, options, charset, copy TSRMLS_CC);
|
||||
}
|
||||
zval_add_ref(tmp);
|
||||
add_assoc_zval(return_value, key, *tmp);
|
||||
@@ -895,7 +899,7 @@ PHP_FUNCTION(filter_data)
|
||||
}
|
||||
}
|
||||
}
|
||||
php_zval_filter_recursive(&var, filter, filter_flags, options, charset TSRMLS_CC);
|
||||
php_zval_filter_recursive(&var, filter, filter_flags, options, charset, 1 TSRMLS_CC);
|
||||
RETURN_ZVAL(var, 1, 0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#define FILTER_FLAG_NONE 0x0000
|
||||
|
||||
#define FILTER_FLAG_ARRAY 0x1000000
|
||||
#define FILTER_FLAG_SCALAR 0x2000000
|
||||
#define FILTER_FLAG_SCALAR 0x2000000
|
||||
|
||||
#define FILTER_FLAG_ALLOW_OCTAL 0x0001
|
||||
#define FILTER_FLAG_ALLOW_HEX 0x0002
|
||||
|
||||
@@ -332,9 +332,8 @@ void php_filter_float(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||
|
||||
ret_val = 0.0;
|
||||
|
||||
if (*str == '0') {
|
||||
/* leading zeros */
|
||||
while (*(str++) == '0');
|
||||
while (*str == '0') {
|
||||
str++;
|
||||
}
|
||||
|
||||
if (*str == dec_sep) {
|
||||
|
||||
@@ -9,7 +9,8 @@ $data = array(
|
||||
'.4',
|
||||
'-.4',
|
||||
'1000000000000',
|
||||
'-1000000000000'
|
||||
'-1000000000000',
|
||||
'02.324'
|
||||
);
|
||||
foreach ($data as $val) {
|
||||
$res = filter_data($val, FILTER_VALIDATE_FLOAT);
|
||||
@@ -25,3 +26,4 @@ float(0.4)
|
||||
float(-0.4)
|
||||
float(1.0E+12)
|
||||
float(-1.0E+12)
|
||||
float(2.324)
|
||||
@@ -327,7 +327,7 @@ PHP_NAMED_FUNCTION(zif_dcngettext)
|
||||
|
||||
RETVAL_FALSE;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(4, &domain, &msgid1, &msgid2, &count, &category) == FAILURE) {
|
||||
if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &domain, &msgid1, &msgid2, &count, &category) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
} else {
|
||||
char* msgstr = NULL;
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
dcngettext() tests
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("gettext")) die("skip");
|
||||
if (!function_exists("dcngettext")) die("skip dcngettext() doesn't exist");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(dcngettext(1,1,1,1));
|
||||
var_dump(dcngettext(1,1,1,1,1));
|
||||
var_dump(dcngettext("test","test","test",1,1));
|
||||
var_dump(dcngettext("test","test","test",0,0));
|
||||
var_dump(dcngettext("test","test","test",-1,-1));
|
||||
var_dump(dcngettext("","","",1,1));
|
||||
var_dump(dcngettext("","","",0,0));
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Wrong parameter count for dcngettext() in %s on line %d
|
||||
bool(false)
|
||||
string(1) "1"
|
||||
string(4) "test"
|
||||
string(4) "test"
|
||||
string(4) "test"
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
Done
|
||||
@@ -0,0 +1,45 @@
|
||||
--TEST--
|
||||
gmp_intval() tests
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gmp")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(gmp_intval(1,1));
|
||||
var_dump(gmp_intval(""));
|
||||
var_dump(gmp_intval(1.0001));
|
||||
var_dump(gmp_intval("1.0001"));
|
||||
var_dump(gmp_intval("-1"));
|
||||
var_dump(gmp_intval(-1));
|
||||
var_dump(gmp_intval(-2349828));
|
||||
var_dump(gmp_intval(2342344));
|
||||
var_dump(gmp_intval(new stdclass));
|
||||
var_dump(gmp_intval(array()));
|
||||
|
||||
$fp = fopen(__FILE__, 'r');
|
||||
var_dump(gmp_intval($fp));
|
||||
|
||||
$g = gmp_init("12345678");
|
||||
var_dump(gmp_intval($g));
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Wrong parameter count for gmp_intval() in %s on line %d
|
||||
NULL
|
||||
int(0)
|
||||
int(1)
|
||||
int(1)
|
||||
int(-1)
|
||||
int(-1)
|
||||
int(-2349828)
|
||||
int(2342344)
|
||||
|
||||
Notice: Object of class stdClass could not be converted to int in %s on line %d
|
||||
int(1)
|
||||
int(0)
|
||||
|
||||
Warning: gmp_intval(): supplied resource is not a valid GMP integer resource in %s on line %d
|
||||
bool(false)
|
||||
int(12345678)
|
||||
Done
|
||||
@@ -0,0 +1,68 @@
|
||||
--TEST--
|
||||
gmp_strval() tests
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gmp")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(gmp_strval());
|
||||
var_dump(gmp_strval(""));
|
||||
var_dump(gmp_strval("", ""));
|
||||
var_dump(gmp_strval("", -1));
|
||||
var_dump(gmp_strval(-1, ""));
|
||||
|
||||
$fp = fopen(__FILE__, "r");
|
||||
var_dump(gmp_strval($fp));
|
||||
|
||||
$g = gmp_init("9765456");
|
||||
var_dump(gmp_strval($g));
|
||||
var_dump(gmp_strval($g, -1));
|
||||
var_dump(gmp_strval($g, 100000));
|
||||
var_dump(gmp_strval($g, 10));
|
||||
|
||||
$g = gmp_init("-3373333");
|
||||
var_dump(gmp_strval($g));
|
||||
var_dump(gmp_strval($g, -1));
|
||||
var_dump(gmp_strval($g, 100000));
|
||||
var_dump(gmp_strval($g, 10));
|
||||
|
||||
var_dump(gmp_strval(array(1,2), array(1,2)));
|
||||
var_dump(gmp_strval(new stdclass, new stdclass));
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Wrong parameter count for gmp_strval() in %s on line %d
|
||||
NULL
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_strval(): Bad base for conversion: 0 in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_strval(): supplied resource is not a valid GMP integer resource in %s on line %d
|
||||
bool(false)
|
||||
string(7) "9765456"
|
||||
|
||||
Warning: gmp_strval(): Bad base for conversion: -1 in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_strval(): Bad base for conversion: 100000 in %s on line %d
|
||||
bool(false)
|
||||
string(7) "9765456"
|
||||
string(8) "-3373333"
|
||||
|
||||
Warning: gmp_strval(): Bad base for conversion: -1 in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_strval(): Bad base for conversion: 100000 in %s on line %d
|
||||
bool(false)
|
||||
string(8) "-3373333"
|
||||
|
||||
Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,50 @@
|
||||
--TEST--
|
||||
gmp_sub() tests
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gmp")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(gmp_sub());
|
||||
var_dump(gmp_sub(""));
|
||||
var_dump(gmp_sub("", ""));
|
||||
var_dump(gmp_sub("", "", ""));
|
||||
var_dump(gmp_sub(array(), array()));
|
||||
|
||||
var_dump($g = gmp_sub(10000, 10001));
|
||||
var_dump(gmp_strval($g));
|
||||
var_dump($g = gmp_sub(10000, -1));
|
||||
var_dump(gmp_strval($g));
|
||||
var_dump($g = gmp_sub(10000, new stdclass));
|
||||
var_dump(gmp_strval($g));
|
||||
var_dump($g = gmp_sub(new stdclass, 100));
|
||||
var_dump(gmp_strval($g));
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Wrong parameter count for gmp_sub() in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Wrong parameter count for gmp_sub() in %s on line %d
|
||||
NULL
|
||||
bool(false)
|
||||
|
||||
Warning: Wrong parameter count for gmp_sub() in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: gmp_sub(): Unable to convert variable to GMP - wrong type in %s on line %d
|
||||
bool(false)
|
||||
resource(%d) of type (GMP integer)
|
||||
string(2) "-1"
|
||||
resource(%d) of type (GMP integer)
|
||||
string(5) "10001"
|
||||
|
||||
Warning: gmp_sub(): Unable to convert variable to GMP - wrong type in %s on line %d
|
||||
bool(false)
|
||||
string(1) "0"
|
||||
|
||||
Warning: gmp_sub(): Unable to convert variable to GMP - wrong type in %s on line %d
|
||||
bool(false)
|
||||
string(1) "0"
|
||||
Done
|
||||
@@ -0,0 +1,133 @@
|
||||
--TEST--
|
||||
gmp_div_qr() tests
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gmp")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(gmp_div_qr());
|
||||
var_dump(gmp_div_qr(""));
|
||||
|
||||
var_dump($r = gmp_div_qr(0,1));
|
||||
var_dump(gmp_strval($r[0]));
|
||||
var_dump(gmp_strval($r[1]));
|
||||
var_dump($r = gmp_div_qr(1,0));
|
||||
var_dump($r = gmp_div_qr(12653,23482734));
|
||||
var_dump(gmp_strval($r[0]));
|
||||
var_dump(gmp_strval($r[1]));
|
||||
var_dump($r = gmp_div_qr(12653,23482734, 10));
|
||||
var_dump(gmp_strval($r[0]));
|
||||
var_dump(gmp_strval($r[1]));
|
||||
var_dump($r = gmp_div_qr(1123123,123));
|
||||
var_dump(gmp_strval($r[0]));
|
||||
var_dump(gmp_strval($r[1]));
|
||||
var_dump($r = gmp_div_qr(1123123,123, 1));
|
||||
var_dump(gmp_strval($r[0]));
|
||||
var_dump(gmp_strval($r[1]));
|
||||
var_dump($r = gmp_div_qr(1123123,123, 2));
|
||||
var_dump(gmp_strval($r[0]));
|
||||
var_dump(gmp_strval($r[1]));
|
||||
var_dump($r = gmp_div_qr(1123123,123, GMP_ROUND_ZERO));
|
||||
var_dump(gmp_strval($r[0]));
|
||||
var_dump(gmp_strval($r[1]));
|
||||
var_dump($r = gmp_div_qr(1123123,123, GMP_ROUND_PLUSINF));
|
||||
var_dump(gmp_strval($r[0]));
|
||||
var_dump(gmp_strval($r[1]));
|
||||
var_dump($r = gmp_div_qr(1123123,123, GMP_ROUND_MINUSINF));
|
||||
var_dump(gmp_strval($r[0]));
|
||||
var_dump(gmp_strval($r[1]));
|
||||
|
||||
$fp = fopen(__FILE__, 'r');
|
||||
|
||||
var_dump(gmp_div_qr($fp, $fp));
|
||||
var_dump(gmp_div_qr(array(), array()));
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Wrong parameter count for gmp_div_qr() in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Wrong parameter count for gmp_div_qr() in %s on line %d
|
||||
NULL
|
||||
array(2) {
|
||||
[0]=>
|
||||
resource(%d) of type (GMP integer)
|
||||
[1]=>
|
||||
resource(%d) of type (GMP integer)
|
||||
}
|
||||
string(1) "0"
|
||||
string(1) "0"
|
||||
|
||||
Warning: gmp_div_qr(): Zero operand not allowed in %s on line %d
|
||||
bool(false)
|
||||
array(2) {
|
||||
[0]=>
|
||||
resource(%d) of type (GMP integer)
|
||||
[1]=>
|
||||
resource(%d) of type (GMP integer)
|
||||
}
|
||||
string(1) "0"
|
||||
string(5) "12653"
|
||||
NULL
|
||||
|
||||
Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
|
||||
bool(false)
|
||||
array(2) {
|
||||
[0]=>
|
||||
resource(%d) of type (GMP integer)
|
||||
[1]=>
|
||||
resource(%d) of type (GMP integer)
|
||||
}
|
||||
string(4) "9131"
|
||||
string(2) "10"
|
||||
array(2) {
|
||||
[0]=>
|
||||
resource(%d) of type (GMP integer)
|
||||
[1]=>
|
||||
resource(%d) of type (GMP integer)
|
||||
}
|
||||
string(4) "9132"
|
||||
string(4) "-113"
|
||||
array(2) {
|
||||
[0]=>
|
||||
resource(%d) of type (GMP integer)
|
||||
[1]=>
|
||||
resource(%d) of type (GMP integer)
|
||||
}
|
||||
string(4) "9131"
|
||||
string(2) "10"
|
||||
array(2) {
|
||||
[0]=>
|
||||
resource(%d) of type (GMP integer)
|
||||
[1]=>
|
||||
resource(%d) of type (GMP integer)
|
||||
}
|
||||
string(4) "9131"
|
||||
string(2) "10"
|
||||
array(2) {
|
||||
[0]=>
|
||||
resource(%d) of type (GMP integer)
|
||||
[1]=>
|
||||
resource(%d) of type (GMP integer)
|
||||
}
|
||||
string(4) "9132"
|
||||
string(4) "-113"
|
||||
array(2) {
|
||||
[0]=>
|
||||
resource(%d) of type (GMP integer)
|
||||
[1]=>
|
||||
resource(%d) of type (GMP integer)
|
||||
}
|
||||
string(4) "9131"
|
||||
string(2) "10"
|
||||
|
||||
Warning: gmp_div_qr(): supplied resource is not a valid GMP integer resource in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_div_qr(): Unable to convert variable to GMP - wrong type in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,73 @@
|
||||
--TEST--
|
||||
gmp_div_r() tests
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gmp")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(gmp_div_r());
|
||||
var_dump(gmp_div_r(""));
|
||||
|
||||
var_dump($r = gmp_div_r(0,1));
|
||||
var_dump(gmp_strval($r));
|
||||
var_dump($r = gmp_div_r(1,0));
|
||||
var_dump($r = gmp_div_r(12653,23482734));
|
||||
var_dump(gmp_strval($r));
|
||||
var_dump($r = gmp_div_r(12653,23482734, 10));
|
||||
var_dump(gmp_strval($r));
|
||||
var_dump($r = gmp_div_r(1123123,123));
|
||||
var_dump(gmp_strval($r));
|
||||
var_dump($r = gmp_div_r(1123123,123, 1));
|
||||
var_dump(gmp_strval($r));
|
||||
var_dump($r = gmp_div_r(1123123,123, 2));
|
||||
var_dump(gmp_strval($r));
|
||||
var_dump($r = gmp_div_r(1123123,123, GMP_ROUND_ZERO));
|
||||
var_dump(gmp_strval($r));
|
||||
var_dump($r = gmp_div_r(1123123,123, GMP_ROUND_PLUSINF));
|
||||
var_dump(gmp_strval($r));
|
||||
var_dump($r = gmp_div_r(1123123,123, GMP_ROUND_MINUSINF));
|
||||
var_dump(gmp_strval($r));
|
||||
|
||||
$fp = fopen(__FILE__, 'r');
|
||||
|
||||
var_dump(gmp_div_r($fp, $fp));
|
||||
var_dump(gmp_div_r(array(), array()));
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Wrong parameter count for gmp_div_r() in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Wrong parameter count for gmp_div_r() in %s on line %d
|
||||
NULL
|
||||
int(0)
|
||||
string(1) "0"
|
||||
|
||||
Warning: gmp_div_r(): Zero operand not allowed in %s on line %d
|
||||
bool(false)
|
||||
int(12653)
|
||||
string(5) "12653"
|
||||
NULL
|
||||
|
||||
Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
|
||||
bool(false)
|
||||
int(10)
|
||||
string(2) "10"
|
||||
int(113)
|
||||
string(3) "113"
|
||||
int(10)
|
||||
string(2) "10"
|
||||
int(10)
|
||||
string(2) "10"
|
||||
int(113)
|
||||
string(3) "113"
|
||||
int(10)
|
||||
string(2) "10"
|
||||
|
||||
Warning: gmp_div_r(): supplied resource is not a valid GMP integer resource in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_div_r(): Unable to convert variable to GMP - wrong type in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,73 @@
|
||||
--TEST--
|
||||
gmp_div_q() tests
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gmp")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(gmp_div_q());
|
||||
var_dump(gmp_div_q(""));
|
||||
|
||||
var_dump($r = gmp_div_q(0,1));
|
||||
var_dump(gmp_strval($r));
|
||||
var_dump($r = gmp_div_q(1,0));
|
||||
var_dump($r = gmp_div_q(12653,23482734));
|
||||
var_dump(gmp_strval($r));
|
||||
var_dump($r = gmp_div_q(12653,23482734, 10));
|
||||
var_dump(gmp_strval($r));
|
||||
var_dump($r = gmp_div_q(1123123,123));
|
||||
var_dump(gmp_strval($r));
|
||||
var_dump($r = gmp_div_q(1123123,123, 1));
|
||||
var_dump(gmp_strval($r));
|
||||
var_dump($r = gmp_div_q(1123123,123, 2));
|
||||
var_dump(gmp_strval($r));
|
||||
var_dump($r = gmp_div_q(1123123,123, GMP_ROUND_ZERO));
|
||||
var_dump(gmp_strval($r));
|
||||
var_dump($r = gmp_div_q(1123123,123, GMP_ROUND_PLUSINF));
|
||||
var_dump(gmp_strval($r));
|
||||
var_dump($r = gmp_div_q(1123123,123, GMP_ROUND_MINUSINF));
|
||||
var_dump(gmp_strval($r));
|
||||
|
||||
$fp = fopen(__FILE__, 'r');
|
||||
|
||||
var_dump(gmp_div_q($fp, $fp));
|
||||
var_dump(gmp_div_q(array(), array()));
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Wrong parameter count for gmp_div_q() in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Wrong parameter count for gmp_div_q() in %s on line %d
|
||||
NULL
|
||||
resource(%d) of type (GMP integer)
|
||||
string(1) "0"
|
||||
|
||||
Warning: gmp_div_q(): Zero operand not allowed in %s on line %d
|
||||
bool(false)
|
||||
resource(%d) of type (GMP integer)
|
||||
string(1) "0"
|
||||
NULL
|
||||
|
||||
Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
|
||||
bool(false)
|
||||
resource(%d) of type (GMP integer)
|
||||
string(4) "9131"
|
||||
resource(%d) of type (GMP integer)
|
||||
string(4) "9132"
|
||||
resource(%d) of type (GMP integer)
|
||||
string(4) "9131"
|
||||
resource(%d) of type (GMP integer)
|
||||
string(4) "9131"
|
||||
resource(%d) of type (GMP integer)
|
||||
string(4) "9132"
|
||||
resource(%d) of type (GMP integer)
|
||||
string(4) "9131"
|
||||
|
||||
Warning: gmp_div_q(): supplied resource is not a valid GMP integer resource in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_div_q(): Unable to convert variable to GMP - wrong type in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
gmp_mod tests()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gmp")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(gmp_mod());
|
||||
var_dump(gmp_mod(""));
|
||||
var_dump(gmp_mod("",""));
|
||||
var_dump(gmp_mod(0,1));
|
||||
var_dump(gmp_mod(0,-1));
|
||||
var_dump(gmp_mod(-1,0));
|
||||
|
||||
var_dump(gmp_mod(array(), array()));
|
||||
|
||||
$a = gmp_init("-100000000");
|
||||
$b = gmp_init("353467");
|
||||
|
||||
var_dump(gmp_mod($a, $b));
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Wrong parameter count for gmp_mod() in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Wrong parameter count for gmp_mod() in %s on line %d
|
||||
NULL
|
||||
bool(false)
|
||||
int(0)
|
||||
resource(%d) of type (GMP integer)
|
||||
|
||||
Warning: gmp_mod(): Zero operand not allowed in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: gmp_mod(): Unable to convert variable to GMP - wrong type in %s on line %d
|
||||
bool(false)
|
||||
resource(%d) of type (GMP integer)
|
||||
Done
|
||||
+10
-2
@@ -1159,7 +1159,7 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn
|
||||
|
||||
prev_in_left = in_left;
|
||||
|
||||
encoded = php_base64_encode(buf, (int)(out_size - out_left), &dummy);
|
||||
encoded = (char *) php_base64_encode((unsigned char *) buf, (int)(out_size - out_left), &dummy);
|
||||
encoded_len = (size_t)dummy;
|
||||
|
||||
if (char_cnt < encoded_len) {
|
||||
@@ -1829,7 +1829,7 @@ static void _php_iconv_show_error(php_iconv_err_t err, const char *out_charset,
|
||||
|
||||
case PHP_ICONV_ERR_TOO_BIG:
|
||||
/* should not happen */
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Run out of buffer");
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Buffer length exceeded");
|
||||
break;
|
||||
|
||||
case PHP_ICONV_ERR_MALFORMED:
|
||||
@@ -1946,6 +1946,10 @@ PHP_FUNCTION(iconv_strpos)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (ndl_len < 1) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
err = _php_iconv_strpos(&retval, haystk, haystk_len, ndl, ndl_len,
|
||||
offset, charset);
|
||||
_php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC);
|
||||
@@ -1981,6 +1985,10 @@ PHP_FUNCTION(iconv_strrpos)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (ndl_len < 1) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
err = _php_iconv_strpos(&retval, haystk, haystk_len, ndl, ndl_len,
|
||||
-1, charset);
|
||||
_php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC);
|
||||
|
||||
@@ -31,6 +31,10 @@ foo(str_repeat("abcab", 60)."abcdb".str_repeat("adabc", 60), "abcd", 0);
|
||||
foo(str_repeat("あいうえお", 30)."いうおえあ".str_repeat("あいえおう", 30), "うお", 0, "EUC-JP");
|
||||
$str = str_repeat("あいうえお", 60).'$'.str_repeat("あいえおう", 60);
|
||||
foo($str, '$', 0, "ISO-2022-JP", "EUC-JP");
|
||||
|
||||
var_dump(iconv_strpos("string", ""));
|
||||
var_dump(iconv_strpos("", "string"));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
2: %s
|
||||
@@ -50,3 +54,5 @@ int(302)
|
||||
int(151)
|
||||
int(1)
|
||||
int(300)
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -32,6 +32,10 @@ for ($i = 0; $i <=6; ++$i) {
|
||||
$str = str_repeat("あいうえお", 60).str_repeat('$', $i).str_repeat("あいえおう", 60);
|
||||
foo($str, '$', "ISO-2022-JP", "EUC-JP");
|
||||
}
|
||||
|
||||
var_dump(iconv_strrpos("string", ""));
|
||||
var_dump(iconv_strrpos("", "string"));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(14)
|
||||
@@ -54,3 +58,5 @@ int(605)
|
||||
int(304)
|
||||
int(606)
|
||||
int(305)
|
||||
bool(false)
|
||||
bool(false)
|
||||
+4
-1
@@ -2178,7 +2178,10 @@ PHP_FUNCTION(imap_utf8)
|
||||
|
||||
cpytxt(&src, Z_STRVAL_PP(str), Z_STRLEN_PP(str));
|
||||
utf8_mime2text(&src, &dest);
|
||||
RETURN_STRINGL(dest.data, strlen(dest.data), 1);
|
||||
RETVAL_STRINGL(dest.data, dest.size, 1);
|
||||
if (dest.data) {
|
||||
free(dest.data);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
imap_utf8() tests
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("imap")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(imap_utf8(""));
|
||||
var_dump(imap_utf8(1));
|
||||
var_dump(imap_utf8(array(1,2)));
|
||||
var_dump(imap_utf8("test"));
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(0) ""
|
||||
string(1) "1"
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
string(5) "Array"
|
||||
string(4) "test"
|
||||
Done
|
||||
@@ -11,6 +11,9 @@ $a[] = &$a;
|
||||
var_dump($a);
|
||||
var_dump(json_encode($a));
|
||||
|
||||
/* Break circular data structure to prevent memory leaks */
|
||||
unset($a[0]);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
+8
-1
@@ -705,7 +705,7 @@ PHP_FUNCTION(libxml_set_streams_context)
|
||||
PHP_FUNCTION(libxml_use_internal_errors)
|
||||
{
|
||||
xmlStructuredErrorFunc current_handler;
|
||||
int use_errors=0, retval;
|
||||
zend_bool use_errors=0, retval;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &use_errors) == FAILURE) {
|
||||
return;
|
||||
@@ -1033,6 +1033,13 @@ void php_libxml_node_decrement_resource(php_libxml_node_object *object TSRMLS_DC
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
PHP_LIBXML_API BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
return xmlDllMain(hinstDLL, fdwReason, lpvReserved);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -1391,6 +1391,7 @@ xmlXPathCompile
|
||||
xmlXPathCompiledEval
|
||||
xmlXPathConcatFunction
|
||||
xmlXPathContainsFunction
|
||||
xmlXPathContextSetCache
|
||||
xmlXPathConvertBoolean
|
||||
xmlXPathConvertNumber
|
||||
xmlXPathConvertString
|
||||
|
||||
@@ -2824,7 +2824,7 @@ PHP_FUNCTION(mb_encode_mimeheader)
|
||||
int trans_enc_name_len;
|
||||
char *linefeed = "\r\n";
|
||||
int linefeed_len;
|
||||
int indent = 0;
|
||||
long indent = 0;
|
||||
|
||||
mbfl_string_init(&string);
|
||||
string.no_language = MBSTRG(current_language);
|
||||
|
||||
@@ -18,6 +18,6 @@ bug #36745 : LOAD DATA LOCAL INFILE doesn't return correct error message
|
||||
$mysql->close();
|
||||
printf("Done");
|
||||
?>
|
||||
--EXPECT--
|
||||
string(31) "Can't find file 'filenotfound'."
|
||||
--EXPECTF--
|
||||
string(%d) "%s"
|
||||
Done
|
||||
@@ -254,6 +254,7 @@ static zend_function_entry php_oci_functions[] = {
|
||||
PHP_FE(oci_lob_append, NULL)
|
||||
PHP_FE(oci_lob_copy, NULL)
|
||||
PHP_FE(oci_lob_export, NULL)
|
||||
PHP_FE(oci_lob_seek, NULL)
|
||||
PHP_FE(oci_commit, NULL)
|
||||
PHP_FE(oci_rollback, NULL)
|
||||
PHP_FE(oci_new_descriptor, NULL)
|
||||
|
||||
@@ -902,6 +902,9 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
|
||||
memset((void*)&bind,0,sizeof(php_oci_bind));
|
||||
if (zend_hash_find(statement->binds, name, name_len + 1, (void **)&old_bind) == SUCCESS) {
|
||||
bindp = old_bind;
|
||||
if (bindp->zval) {
|
||||
zval_ptr_dtor(&bindp->zval);
|
||||
}
|
||||
} else {
|
||||
zend_hash_update(statement->binds, name, name_len + 1, &bind, sizeof(php_oci_bind), (void **)&bindp);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
--TEST--
|
||||
oci_bind_array_by_name(), SQLT_CHR, default max_length and empty array
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$statement = oci_parse($c, 'SELECT user FROM v$session');
|
||||
|
||||
$array = array();
|
||||
|
||||
var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, -10, SQLT_CHR, -10));
|
||||
var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, -10));
|
||||
var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, -1));
|
||||
var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, 0));
|
||||
|
||||
oci_execute($statement);
|
||||
|
||||
var_dump($array);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: oci_bind_array_by_name() expects at most 6 parameters, 7 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
Done
|
||||
@@ -37,10 +37,10 @@ require dirname(__FILE__)."/drop_type.inc";
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
|
||||
Warning: OCI-Collection::assignelem(): OCI-22165: given index [%d] must be in the range of 0 to [0] in %s on line %d
|
||||
Warning: OCI-Collection::assignelem(): OCI-22165: given index [%d] must be in the range of %s to [0] in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: OCI-Collection::assignelem(): OCI-22165: given index [5000] must be in the range of 0 to [0] in %s on line %d
|
||||
Warning: OCI-Collection::assignelem(): OCI-22165: given index [5000] must be in the range of %s to [0] in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
--TEST--
|
||||
oci_define_by_name()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__)."/connect.inc";
|
||||
require dirname(__FILE__)."/create_table.inc";
|
||||
|
||||
$insert_sql = "INSERT INTO ".$schema.$table_name." (string) VALUES ('some')";
|
||||
|
||||
if (!($s = oci_parse($c, $insert_sql))) {
|
||||
die("oci_parse(insert) failed!\n");
|
||||
}
|
||||
|
||||
if (!oci_execute($s)) {
|
||||
die("oci_execute(insert) failed!\n");
|
||||
}
|
||||
|
||||
$stmt = oci_parse($c, "SELECT string FROM ".$table_name."");
|
||||
|
||||
/* the define MUST be done BEFORE ociexecute! */
|
||||
|
||||
$strong = '';
|
||||
var_dump(oci_define_by_name($stmt, "STRING", $string, 20));
|
||||
var_dump(oci_define_by_name($stmt, "STRING", $string, 20));
|
||||
var_dump(oci_define_by_name($stmt, "", $string, 20));
|
||||
var_dump(oci_define_by_name($stmt, ""));
|
||||
|
||||
oci_execute($stmt);
|
||||
|
||||
while (oci_fetch($stmt)) {
|
||||
var_dump($string);
|
||||
}
|
||||
|
||||
require dirname(__FILE__)."/drop_table.inc";
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
Warning: oci_define_by_name(): Column name cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: oci_define_by_name() expects at least 3 parameters, 2 given in %s on line %d
|
||||
NULL
|
||||
string(4) "some"
|
||||
Done
|
||||
@@ -0,0 +1,74 @@
|
||||
--TEST--
|
||||
oci_lob_free()/close()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$ora_sql = "INSERT INTO
|
||||
".$schema.$table_name." (blob)
|
||||
VALUES (empty_blob())
|
||||
RETURNING
|
||||
blob
|
||||
INTO :v_blob ";
|
||||
|
||||
$statement = oci_parse($c,$ora_sql);
|
||||
$blob = oci_new_descriptor($c,OCI_D_LOB);
|
||||
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
|
||||
oci_execute($statement, OCI_DEFAULT);
|
||||
|
||||
$blob;
|
||||
|
||||
var_dump($blob->write("test"));
|
||||
var_dump($blob->close());
|
||||
var_dump($blob->write("test"));
|
||||
var_dump(oci_free_descriptor($blob));
|
||||
var_dump($blob->write("test"));
|
||||
|
||||
var_dump(oci_free_descriptor($blob));
|
||||
var_dump(oci_free_descriptor(new stdclass));
|
||||
|
||||
$blob = oci_new_descriptor($c,OCI_D_LOB);
|
||||
unset($blob->descriptor);
|
||||
var_dump(oci_free_descriptor($blob));
|
||||
|
||||
oci_commit($c);
|
||||
|
||||
$select_sql = "SELECT blob FROM ".$schema.$table_name."";
|
||||
$s = oci_parse($c, $select_sql);
|
||||
oci_execute($s);
|
||||
|
||||
var_dump(oci_fetch_array($s, OCI_NUM + OCI_RETURN_LOBS));
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(4)
|
||||
|
||||
Warning: OCI-Lob::close(): ORA-22289: cannot perform operation on an unopened file or LOB in %s on line %d
|
||||
bool(false)
|
||||
int(4)
|
||||
bool(true)
|
||||
|
||||
Warning: OCI-Lob::write(): %d is not a valid oci8 descriptor resource in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: oci_free_descriptor(): %d is not a valid oci8 descriptor resource in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: oci_free_descriptor() expects parameter 1 to be OCI-Lob, object given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: oci_free_descriptor(): Unable to find descriptor property in %s on line %d
|
||||
bool(false)
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(8) "testtest"
|
||||
}
|
||||
Done
|
||||
@@ -0,0 +1,80 @@
|
||||
--TEST--
|
||||
fetching the same lob several times
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
|
||||
$drop = "DROP table lob_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
$create = "CREATE table lob_test(mykey NUMBER, lob_1 CLOB)";
|
||||
$statement = oci_parse($c, $create);
|
||||
oci_execute($statement);
|
||||
|
||||
$init = "INSERT INTO lob_test (mykey, lob_1) VALUES(1, EMPTY_CLOB()) RETURNING lob_1 INTO :mylob";
|
||||
$statement = oci_parse($c, $init);
|
||||
$clob = oci_new_descriptor($c, OCI_D_LOB);
|
||||
oci_bind_by_name($statement, ":mylob", $clob, -1, OCI_B_CLOB);
|
||||
oci_execute($statement, OCI_DEFAULT);
|
||||
$clob->save();
|
||||
oci_lob_save();
|
||||
oci_lob_save($clob, "data");
|
||||
unset($clob->descriptor);
|
||||
oci_lob_save($clob, "data");
|
||||
|
||||
oci_commit($c);
|
||||
|
||||
$init = "INSERT INTO lob_test (mykey, lob_1) VALUES(2, EMPTY_CLOB()) RETURNING lob_1 INTO :mylob";
|
||||
$statement = oci_parse($c, $init);
|
||||
$clob = oci_new_descriptor($c, OCI_D_LOB);
|
||||
oci_bind_by_name($statement, ":mylob", $clob, -1, OCI_B_CLOB);
|
||||
oci_execute($statement, OCI_DEFAULT);
|
||||
$clob->save("long data");
|
||||
$clob->save("long data", -1);
|
||||
$clob->save("long data", 0);
|
||||
|
||||
oci_commit($c);
|
||||
|
||||
|
||||
$query = 'SELECT * FROM lob_test ORDER BY mykey ASC';
|
||||
$statement = oci_parse ($c, $query);
|
||||
oci_execute($statement, OCI_DEFAULT);
|
||||
|
||||
while ($row = oci_fetch_array($statement, OCI_ASSOC)) {
|
||||
$result = $row['LOB_1']->load();
|
||||
var_dump($result);
|
||||
}
|
||||
|
||||
$query = 'SELECT * FROM lob_test ORDER BY mykey DESC';
|
||||
$statement = oci_parse ($c, $query);
|
||||
oci_execute($statement, OCI_DEFAULT);
|
||||
|
||||
while ($row = oci_fetch_array($statement, OCI_ASSOC)) {
|
||||
$result = $row['LOB_1']->load();
|
||||
var_dump($result);
|
||||
}
|
||||
|
||||
$drop = "DROP table lob_test";
|
||||
$statement = oci_parse($c, $drop);
|
||||
@oci_execute($statement);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: OCI-Lob::save() expects at least 1 parameter, 0 given in %s on line %d
|
||||
|
||||
Warning: oci_lob_save() expects at least 2 parameters, 0 given in %s on line %d
|
||||
|
||||
Warning: oci_lob_save(): Unable to find descriptor property in %s on line %d
|
||||
|
||||
Warning: OCI-Lob::save(): Offset parameter must be greater than or equal to 0 in %s on line %d
|
||||
string(4) "data"
|
||||
string(9) "long data"
|
||||
string(9) "long data"
|
||||
string(4) "data"
|
||||
Done
|
||||
@@ -0,0 +1,84 @@
|
||||
--TEST--
|
||||
oci_lob_import()/read()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$ora_sql = "INSERT INTO
|
||||
".$schema.$table_name." (blob)
|
||||
VALUES (empty_blob())
|
||||
RETURNING
|
||||
blob
|
||||
INTO :v_blob ";
|
||||
|
||||
$statement = oci_parse($c,$ora_sql);
|
||||
$blob = oci_new_descriptor($c,OCI_D_LOB);
|
||||
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
|
||||
oci_execute($statement, OCI_DEFAULT);
|
||||
|
||||
var_dump($blob);
|
||||
var_dump($blob->seek(10, OCI_SEEK_CUR));
|
||||
var_dump($blob->import(dirname(__FILE__)."/lob_009.txt"));
|
||||
var_dump($blob->import());
|
||||
var_dump(oci_lob_import($blob));
|
||||
var_dump(oci_lob_import($blob, dirname(__FILE__)."/lob_009.txt"));
|
||||
unset($blob->descriptor);
|
||||
var_dump(oci_lob_import($blob, dirname(__FILE__)."/lob_009.txt"));
|
||||
oci_commit($c);
|
||||
|
||||
$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
|
||||
$s = oci_parse($c, $select_sql);
|
||||
oci_execute($s, OCI_DEFAULT);
|
||||
|
||||
var_dump($row = oci_fetch_array($s));
|
||||
|
||||
while (!$row[0]->eof()) {
|
||||
var_dump($row[0]->read(1024));
|
||||
}
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
bool(true)
|
||||
bool(true)
|
||||
|
||||
Warning: OCI-Lob::import() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: oci_lob_import() expects exactly 2 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
bool(true)
|
||||
|
||||
Warning: oci_lob_import(): Unable to find descriptor property in %s on line %d
|
||||
bool(false)
|
||||
array(2) {
|
||||
[0]=>
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
["BLOB"]=>
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
}
|
||||
string(43) "this
|
||||
is
|
||||
a
|
||||
test
|
||||
file for
|
||||
test lob_009.phpt
|
||||
"
|
||||
Done
|
||||
@@ -0,0 +1,75 @@
|
||||
--TEST--
|
||||
oci_lob_load()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$ora_sql = "INSERT INTO
|
||||
".$schema.$table_name." (blob)
|
||||
VALUES (empty_blob())
|
||||
RETURNING
|
||||
blob
|
||||
INTO :v_blob ";
|
||||
|
||||
$statement = oci_parse($c,$ora_sql);
|
||||
$blob = oci_new_descriptor($c,OCI_D_LOB);
|
||||
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
|
||||
oci_execute($statement, OCI_DEFAULT);
|
||||
|
||||
var_dump($blob);
|
||||
|
||||
var_dump($blob->size());
|
||||
var_dump($blob->write(str_repeat("string.", 1000)));
|
||||
var_dump($blob->size());
|
||||
oci_commit($c);
|
||||
|
||||
$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
|
||||
$s = oci_parse($c, $select_sql);
|
||||
oci_execute($s, OCI_DEFAULT);
|
||||
|
||||
var_dump($row = oci_fetch_array($s));
|
||||
|
||||
var_dump(strlen($row[0]->load()));
|
||||
var_dump(strlen(oci_lob_load($row[0])));
|
||||
var_dump(oci_lob_load());
|
||||
unset($row[0]->descriptor);
|
||||
var_dump(oci_lob_load($row[0]));
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
int(0)
|
||||
int(7000)
|
||||
int(7000)
|
||||
array(2) {
|
||||
[0]=>
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
["BLOB"]=>
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
}
|
||||
int(7000)
|
||||
int(7000)
|
||||
|
||||
Warning: oci_lob_load() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: oci_lob_load(): Unable to find descriptor property in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,82 @@
|
||||
--TEST--
|
||||
oci_lob_read() tests
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$ora_sql = "INSERT INTO
|
||||
".$schema.$table_name." (blob)
|
||||
VALUES (empty_blob())
|
||||
RETURNING
|
||||
blob
|
||||
INTO :v_blob ";
|
||||
|
||||
$statement = oci_parse($c,$ora_sql);
|
||||
$blob = oci_new_descriptor($c,OCI_D_LOB);
|
||||
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
|
||||
oci_execute($statement, OCI_DEFAULT);
|
||||
|
||||
var_dump($blob->size());
|
||||
var_dump($blob->write(str_repeat("string.", 1000)));
|
||||
var_dump($blob->size());
|
||||
oci_commit($c);
|
||||
|
||||
$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
|
||||
$s = oci_parse($c, $select_sql);
|
||||
oci_execute($s, OCI_DEFAULT);
|
||||
|
||||
var_dump($row = oci_fetch_array($s));
|
||||
|
||||
var_dump(oci_lob_read($row[0], 2));
|
||||
var_dump(oci_lob_read($row[0]));
|
||||
var_dump(oci_lob_read());
|
||||
var_dump(oci_lob_eof($row[0]));
|
||||
var_dump(oci_lob_eof());
|
||||
|
||||
unset($row[0]->descriptor);
|
||||
var_dump(oci_lob_read($row[0],1));
|
||||
var_dump(oci_lob_eof($row[0]));
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(0)
|
||||
int(7000)
|
||||
int(7000)
|
||||
array(2) {
|
||||
[0]=>
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
["BLOB"]=>
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
}
|
||||
string(2) "st"
|
||||
|
||||
Warning: oci_lob_read() expects exactly 2 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: oci_lob_read() expects exactly 2 parameters, 0 given in %s on line %d
|
||||
NULL
|
||||
bool(false)
|
||||
|
||||
Warning: oci_lob_eof() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: oci_lob_read(): Unable to find descriptor property in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: oci_lob_eof(): Unable to find descriptor property in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,100 @@
|
||||
--TEST--
|
||||
oci_lob_seek()/rewind()/append()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__).'/connect.inc';
|
||||
require dirname(__FILE__).'/create_table.inc';
|
||||
|
||||
$ora_sql = "INSERT INTO
|
||||
".$schema.$table_name." (blob)
|
||||
VALUES (empty_blob())
|
||||
RETURNING
|
||||
blob
|
||||
INTO :v_blob ";
|
||||
|
||||
$statement = oci_parse($c,$ora_sql);
|
||||
$blob = oci_new_descriptor($c,OCI_D_LOB);
|
||||
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
|
||||
oci_execute($statement, OCI_DEFAULT);
|
||||
|
||||
var_dump($blob);
|
||||
|
||||
var_dump(oci_lob_write($blob, "test"));
|
||||
var_dump(oci_lob_rewind());
|
||||
var_dump(oci_lob_rewind($blob));
|
||||
var_dump(oci_lob_write($blob, "str"));
|
||||
var_dump(oci_lob_seek(10, OCI_SEEK_SET));
|
||||
var_dump(oci_lob_seek($blob, 10, OCI_SEEK_SET));
|
||||
|
||||
oci_commit($c);
|
||||
|
||||
$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
|
||||
$s = oci_parse($c, $select_sql);
|
||||
oci_execute($s, OCI_DEFAULT);
|
||||
|
||||
var_dump($row = oci_fetch_array($s));
|
||||
|
||||
var_dump(oci_lob_append());
|
||||
var_dump(oci_lob_append($blob));
|
||||
var_dump(oci_lob_append($row[0], $blob));
|
||||
var_dump(oci_lob_read(10000));
|
||||
var_dump(oci_lob_read($row[0], 10000));
|
||||
|
||||
oci_commit($c);
|
||||
|
||||
$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
|
||||
$s = oci_parse($c, $select_sql);
|
||||
oci_execute($s, OCI_DEFAULT);
|
||||
|
||||
$row = oci_fetch_array($s);
|
||||
|
||||
var_dump(oci_lob_read($row[0], 10000));
|
||||
|
||||
require dirname(__FILE__).'/drop_table.inc';
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
int(4)
|
||||
|
||||
Warning: oci_lob_rewind() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
bool(true)
|
||||
int(3)
|
||||
|
||||
Warning: oci_lob_seek() expects parameter 1 to be OCI-Lob, integer given in %s on line %d
|
||||
NULL
|
||||
bool(true)
|
||||
array(2) {
|
||||
[0]=>
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
["BLOB"]=>
|
||||
object(OCI-Lob)#%d (1) {
|
||||
["descriptor"]=>
|
||||
resource(%d) of type (oci8 descriptor)
|
||||
}
|
||||
}
|
||||
|
||||
Warning: oci_lob_append() expects exactly 2 parameters, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: oci_lob_append() expects exactly 2 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
bool(true)
|
||||
|
||||
Warning: oci_lob_read() expects exactly 2 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
string(4) "strt"
|
||||
string(8) "strtstrt"
|
||||
Done
|
||||
+58
-15
@@ -651,6 +651,9 @@ PHP_MINIT_FUNCTION(openssl)
|
||||
* openSSL callbacks */
|
||||
ssl_stream_data_index = SSL_get_ex_new_index(0, "PHP stream index", NULL, NULL, NULL);
|
||||
|
||||
REGISTER_STRING_CONSTANT("OPENSSL_VERSION_TEXT", OPENSSL_VERSION_TEXT, CONST_CS|CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("OPENSSL_VERSION_NUMBER", OPENSSL_VERSION_NUMBER, CONST_CS|CONST_PERSISTENT);
|
||||
|
||||
/* purposes for cert purpose checking */
|
||||
REGISTER_LONG_CONSTANT("X509_PURPOSE_SSL_CLIENT", X509_PURPOSE_SSL_CLIENT, CONST_CS|CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("X509_PURPOSE_SSL_SERVER", X509_PURPOSE_SSL_SERVER, CONST_CS|CONST_PERSISTENT);
|
||||
@@ -1336,7 +1339,8 @@ static int php_openssl_make_REQ(struct php_x509_request * req, X509_REQ * csr, z
|
||||
/* apply values from the dn hash */
|
||||
zend_hash_internal_pointer_reset_ex(HASH_OF(dn), &hpos);
|
||||
while(zend_hash_get_current_data_ex(HASH_OF(dn), (void**)&item, &hpos) == SUCCESS) {
|
||||
char * strindex; uint strindexlen;
|
||||
char * strindex = NULL;
|
||||
uint strindexlen = 0;
|
||||
ulong intindex;
|
||||
|
||||
zend_hash_get_current_key_ex(HASH_OF(dn), &strindex, &strindexlen, &intindex, 0, &hpos);
|
||||
@@ -1776,6 +1780,7 @@ PHP_FUNCTION(openssl_csr_new)
|
||||
|
||||
if (we_made_the_key) {
|
||||
/* and a resource for the private key */
|
||||
zval_dtor(out_pkey);
|
||||
ZVAL_RESOURCE(out_pkey, zend_list_insert(req.priv_key, le_key));
|
||||
req.priv_key = NULL; /* make sure the cleanup code doesn't zap it! */
|
||||
} else if (key_resource != -1) {
|
||||
@@ -1878,7 +1883,16 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval ** val, int public_key, char *
|
||||
int free_cert = 0;
|
||||
long cert_res = -1;
|
||||
char * filename = NULL;
|
||||
|
||||
zval tmp;
|
||||
|
||||
Z_TYPE(tmp) = IS_NULL;
|
||||
|
||||
#define TMP_CLEAN \
|
||||
if (Z_TYPE(tmp) == IS_STRING) {\
|
||||
zval_dtor(&tmp); \
|
||||
return NULL; \
|
||||
}
|
||||
|
||||
if (resourceval) {
|
||||
*resourceval = -1;
|
||||
}
|
||||
@@ -1891,13 +1905,19 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval ** val, int public_key, char *
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "key array must be of the form array(0 => key, 1 => phrase)");
|
||||
return NULL;
|
||||
}
|
||||
convert_to_string_ex(zphrase);
|
||||
passphrase = Z_STRVAL_PP(zphrase);
|
||||
|
||||
if (Z_TYPE_PP(zphrase) == IS_STRING) {
|
||||
passphrase = Z_STRVAL_PP(zphrase);
|
||||
} else {
|
||||
tmp = **zphrase;
|
||||
zval_copy_ctor(&tmp);
|
||||
passphrase = Z_STRVAL(tmp);
|
||||
}
|
||||
|
||||
/* now set val to be the key param and continue */
|
||||
if (zend_hash_index_find(HASH_OF(*val), 0, (void **)&val) == FAILURE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "key array must be of the form array(0 => key, 1 => phrase)");
|
||||
return NULL;
|
||||
TMP_CLEAN;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1907,7 +1927,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval ** val, int public_key, char *
|
||||
|
||||
what = zend_fetch_resource(val TSRMLS_CC, -1, "OpenSSL X.509/key", &type, 2, le_x509, le_key);
|
||||
if (!what) {
|
||||
return NULL;
|
||||
TMP_CLEAN;
|
||||
}
|
||||
if (resourceval) {
|
||||
*resourceval = Z_LVAL_PP(val);
|
||||
@@ -1924,28 +1944,30 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval ** val, int public_key, char *
|
||||
/* check whether it is actually a private key if requested */
|
||||
if (!public_key && !is_priv) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "supplied key param is a public key");
|
||||
return NULL;
|
||||
TMP_CLEAN;
|
||||
}
|
||||
|
||||
if (public_key && is_priv) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Don't know how to get public key from this private key");
|
||||
return NULL;
|
||||
TMP_CLEAN;
|
||||
} else {
|
||||
if (Z_TYPE(tmp) == IS_STRING) {
|
||||
zval_dtor(&tmp);
|
||||
}
|
||||
/* got the key - return it */
|
||||
return (EVP_PKEY*)what;
|
||||
}
|
||||
}
|
||||
|
||||
/* other types could be used here - eg: file pointers and read in the data from them */
|
||||
|
||||
return NULL;
|
||||
TMP_CLEAN;
|
||||
} else {
|
||||
/* force it to be a string and check if it refers to a file */
|
||||
/* passing non string values leaks, object uses toString, it returns NULL
|
||||
* See bug38255.phpt
|
||||
*/
|
||||
if (!(Z_TYPE_PP(val) == IS_STRING || Z_TYPE_PP(val) == IS_OBJECT)) {
|
||||
return NULL;
|
||||
TMP_CLEAN;
|
||||
}
|
||||
convert_to_string_ex(val);
|
||||
|
||||
@@ -1966,7 +1988,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval ** val, int public_key, char *
|
||||
in = BIO_new_mem_buf(Z_STRVAL_PP(val), Z_STRLEN_PP(val));
|
||||
}
|
||||
if (in == NULL) {
|
||||
return NULL;
|
||||
TMP_CLEAN;
|
||||
}
|
||||
key = PEM_read_bio_PUBKEY(in, NULL,NULL, NULL);
|
||||
BIO_free(in);
|
||||
@@ -1977,7 +1999,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval ** val, int public_key, char *
|
||||
|
||||
if (filename) {
|
||||
if (php_openssl_safe_mode_chk(filename TSRMLS_CC)) {
|
||||
return NULL;
|
||||
TMP_CLEAN;
|
||||
}
|
||||
in = BIO_new_file(filename, "r");
|
||||
} else {
|
||||
@@ -1985,7 +2007,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval ** val, int public_key, char *
|
||||
}
|
||||
|
||||
if (in == NULL) {
|
||||
return NULL;
|
||||
TMP_CLEAN;
|
||||
}
|
||||
key = PEM_read_bio_PrivateKey(in, NULL,NULL, passphrase);
|
||||
BIO_free(in);
|
||||
@@ -2003,6 +2025,9 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval ** val, int public_key, char *
|
||||
if (key && makeresource && resourceval) {
|
||||
*resourceval = ZEND_REGISTER_RESOURCE(NULL, key, le_key);
|
||||
}
|
||||
if (Z_TYPE(tmp) == IS_STRING) {
|
||||
zval_dtor(&tmp);
|
||||
}
|
||||
return key;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2026,9 +2051,27 @@ static EVP_PKEY * php_openssl_generate_private_key(struct php_x509_request * req
|
||||
if ((req->priv_key = EVP_PKEY_new()) != NULL) {
|
||||
switch(req->priv_key_type) {
|
||||
case OPENSSL_KEYTYPE_RSA:
|
||||
if (EVP_PKEY_assign_RSA(req->priv_key, RSA_generate_key(req->priv_key_bits, 0x10001, NULL, NULL)))
|
||||
if (EVP_PKEY_assign_RSA(req->priv_key, RSA_generate_key(req->priv_key_bits, 0x10001, NULL, NULL))) {
|
||||
return_val = req->priv_key;
|
||||
}
|
||||
break;
|
||||
#ifndef NO_DSA
|
||||
case OPENSSL_KEYTYPE_DSA:
|
||||
{
|
||||
DSA *dsapar = DSA_generate_parameters(req->priv_key_bits, NULL, 0, NULL, NULL, NULL, NULL);
|
||||
if (dsapar) {
|
||||
DSA_set_method(dsapar, DSA_get_default_method());
|
||||
if (DSA_generate_key(dsapar)) {
|
||||
if (EVP_PKEY_assign_DSA(req->priv_key, dsapar)) {
|
||||
return_val = req->priv_key;
|
||||
}
|
||||
} else {
|
||||
DSA_free(dsapar);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported private key type");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
--TEST--
|
||||
openssl_csr_new() tests
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("openssl")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$a = 1;
|
||||
var_dump(openssl_csr_new(1,$a));
|
||||
var_dump(openssl_csr_new(1,$a,1,1));
|
||||
$a = array();
|
||||
var_dump(openssl_csr_new(array(), $a, array(), array()));
|
||||
|
||||
//this leaks
|
||||
$a = array(1,2);
|
||||
$b = array(1,2);
|
||||
var_dump(openssl_csr_new($a, $b));
|
||||
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: openssl_csr_new() expects parameter 1 to be array, integer given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: openssl_csr_new() expects parameter 1 to be array, integer given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: openssl_csr_new(): key array must be of the form array(0 => key, 1 => phrase) in %s on line %d
|
||||
|
||||
Warning: openssl_csr_new(): add1_attr_by_txt challengePassword_min -> 4 (failed) in %s on line %d
|
||||
bool(false)
|
||||
resource(%d) of type (OpenSSL X.509 CSR)
|
||||
Done
|
||||
@@ -3,6 +3,7 @@
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
if (OPENSSL_VERSION_NUMBER<0x009070af) die("skip");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
#36732, add support for req_extensions in openss_csr_new and sign
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -90,6 +90,7 @@ static void php_free_pcre_cache(void *data)
|
||||
pcre_cache_entry *pce = (pcre_cache_entry *) data;
|
||||
if (!pce) return;
|
||||
pefree(pce->re, 1);
|
||||
if (pce->extra) pefree(pce->extra, 1);
|
||||
#if HAVE_SETLOCALE
|
||||
if ((void*)pce->tables) pefree((void*)pce->tables, 1);
|
||||
pefree(pce->locale, 1);
|
||||
|
||||
@@ -4,11 +4,8 @@ dnl vim:et:sw=2:ts=2:
|
||||
|
||||
if test "$PHP_PDO" != "no"; then
|
||||
|
||||
PHP_ARG_WITH(pdo-sqlite, for sqlite 3 driver for PDO,
|
||||
[ --without-pdo-sqlite PDO: sqlite 3 support],yes)
|
||||
|
||||
PHP_ARG_WITH(pdo-sqlite, for sqlite 3 support for PDO,
|
||||
[ --with-pdo-sqlite[=DIR] PDO: sqlite support. DIR is the sqlite base directory, the bundled sqlite is used by default])
|
||||
[ --without-pdo-sqlite[=DIR] PDO: sqlite support. DIR is the sqlite base directory, the bundled sqlite is used by default],yes)
|
||||
|
||||
if test "$PHP_PDO_SQLITE" != "no"; then
|
||||
|
||||
|
||||
+3
-2
@@ -3309,12 +3309,13 @@ PHP_FUNCTION(pg_copy_to)
|
||||
if (!pg_delim) {
|
||||
pg_delim = "\t";
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
|
||||
|
||||
if (!pg_null_as) {
|
||||
pg_null_as = safe_estrdup("\\\\N");
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
|
||||
|
||||
query = (char *)emalloc(strlen(query_template) + strlen(table_name) + strlen(pg_null_as) + 1);
|
||||
sprintf(query, "COPY \"%s\" TO STDOUT DELIMITERS '%c' WITH NULL AS '%s'",
|
||||
table_name, *pg_delim, pg_null_as);
|
||||
|
||||
@@ -363,7 +363,7 @@ PHP_FUNCTION(readline_write_history)
|
||||
/* {{{ proto bool readline_completion_function(string funcname)
|
||||
Readline completion function? */
|
||||
|
||||
static char *_readline_command_generator(char *text,int state)
|
||||
static char *_readline_command_generator(const char *text, int state)
|
||||
{
|
||||
HashTable *myht = Z_ARRVAL(_readline_array);
|
||||
zval **entry;
|
||||
|
||||
@@ -5,5 +5,6 @@ ARG_ENABLE("reflection", "disable reflection support", "yes");
|
||||
|
||||
if (PHP_REFLECTION != "no") {
|
||||
EXTENSION("reflection", "php_reflection.c");
|
||||
AC_DEFINE('HAVE_REFLECTION', 1, 'Reflection support enabled');
|
||||
}
|
||||
|
||||
@@ -537,10 +537,26 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
|
||||
/* {{{ _const_string */
|
||||
static void _const_string(string *str, char *name, zval *value, char *indent TSRMLS_DC)
|
||||
{
|
||||
string_printf(str, "%s Constant [ %s %s ] { }\n",
|
||||
char *type;
|
||||
zval value_copy;
|
||||
int use_copy;
|
||||
|
||||
type = zend_zval_type_name(value);
|
||||
|
||||
zend_make_printable_zval(value, &value_copy, &use_copy);
|
||||
if (use_copy) {
|
||||
value = &value_copy;
|
||||
}
|
||||
|
||||
string_printf(str, "%s Constant [ %s %s ] { %s }\n",
|
||||
indent,
|
||||
zend_zval_type_name(value),
|
||||
name);
|
||||
type,
|
||||
name,
|
||||
Z_STRVAL_P(value));
|
||||
|
||||
if (use_copy) {
|
||||
zval_dtor(value);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1107,7 +1123,7 @@ static void reflection_property_factory(zend_class_entry *ce, zend_property_info
|
||||
zend_unmangle_property_name(prop->name, prop->name_length, &class_name, &prop_name);
|
||||
|
||||
if (!(prop->flags & ZEND_ACC_PRIVATE)) {
|
||||
/* we have to seach the class hierarchy for this (implicit) public or protected property */
|
||||
/* we have to search the class hierarchy for this (implicit) public or protected property */
|
||||
zend_class_entry *tmp_ce = ce;
|
||||
zend_property_info *tmp_info;
|
||||
|
||||
@@ -3741,7 +3757,7 @@ ZEND_METHOD(reflection_property, __construct)
|
||||
}
|
||||
|
||||
if (!(property_info->flags & ZEND_ACC_PRIVATE)) {
|
||||
/* we have to seach the class hierarchy for this (implicit) public or protected property */
|
||||
/* we have to search the class hierarchy for this (implicit) public or protected property */
|
||||
zend_class_entry *tmp_ce = ce;
|
||||
zend_property_info *tmp_info;
|
||||
|
||||
@@ -4351,8 +4367,7 @@ ZEND_END_ARG_INFO()
|
||||
|
||||
static zend_function_entry reflection_function_abstract_functions[] = {
|
||||
ZEND_ME(reflection, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
|
||||
ZEND_ME(reflection_function, __construct, arginfo_reflection_function___construct, 0)
|
||||
ZEND_ME(reflection_function, __toString, NULL, 0)
|
||||
PHP_ABSTRACT_ME(reflection_function, __toString, NULL)
|
||||
ZEND_ME(reflection_function, isInternal, NULL, 0)
|
||||
ZEND_ME(reflection_function, isUserDefined, NULL, 0)
|
||||
ZEND_ME(reflection_function, getName, NULL, 0)
|
||||
@@ -4374,6 +4389,8 @@ static zend_function_entry reflection_function_abstract_functions[] = {
|
||||
};
|
||||
|
||||
static zend_function_entry reflection_function_functions[] = {
|
||||
ZEND_ME(reflection_function, __construct, arginfo_reflection_function___construct, 0)
|
||||
ZEND_ME(reflection_function, __toString, NULL, 0)
|
||||
ZEND_ME(reflection_function, export, arginfo_reflection_function_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
|
||||
ZEND_ME(reflection_function, isDisabled, NULL, 0)
|
||||
ZEND_ME(reflection_function, invoke, arginfo_reflection_function_invoke, 0)
|
||||
@@ -4462,7 +4479,7 @@ ZEND_END_ARG_INFO()
|
||||
|
||||
static
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_getMethods, 0, 0, 0)
|
||||
ZEND_ARG_INFO(0, $filter)
|
||||
ZEND_ARG_INFO(0, filter)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
static
|
||||
|
||||
@@ -17,14 +17,14 @@ Reflection::export(new ReflectionClass('just_constants'));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Class [ <user> class just_constants ] {
|
||||
@@ %s
|
||||
@@ %s %d-%d
|
||||
|
||||
- Constants [5] {
|
||||
Constant [ boolean BOOLEAN_CONSTANT ] { }
|
||||
Constant [ null NULL_CONSTANT ] { }
|
||||
Constant [ string STRING_CONSTANT ] { }
|
||||
Constant [ integer INTEGER_CONSTANT ] { }
|
||||
Constant [ double FLOAT_CONSTANT ] { }
|
||||
Constant [ boolean BOOLEAN_CONSTANT ] { 1 }
|
||||
Constant [ null NULL_CONSTANT ] { }
|
||||
Constant [ string STRING_CONSTANT ] { This is a string }
|
||||
Constant [ integer INTEGER_CONSTANT ] { 1000 }
|
||||
Constant [ double FLOAT_CONSTANT ] { 3.14159265 }
|
||||
}
|
||||
|
||||
- Static properties [0] {
|
||||
|
||||
@@ -1976,7 +1976,7 @@ SXE_METHOD(__construct)
|
||||
{
|
||||
php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
|
||||
char *data, *ns = NULL;
|
||||
int data_len, *ns_len = 0;
|
||||
int data_len, ns_len = 0;
|
||||
xmlDocPtr docp;
|
||||
long options = 0;
|
||||
zend_bool is_url = 0, isprefix = 0;
|
||||
|
||||
+7
-1
@@ -401,6 +401,8 @@ try_again:
|
||||
}
|
||||
if (phpurl->path) {
|
||||
smart_str_appends(&soap_headers, phpurl->path);
|
||||
} else {
|
||||
smart_str_appendc(&soap_headers, '/');
|
||||
}
|
||||
if (phpurl->query) {
|
||||
smart_str_appendc(&soap_headers, '?');
|
||||
@@ -518,6 +520,8 @@ try_again:
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)"POST:", sizeof("POST:")-1);
|
||||
if (phpurl->path) {
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)phpurl->path, strlen(phpurl->path));
|
||||
} else {
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)"/", 1);
|
||||
}
|
||||
if (phpurl->query) {
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)"?", 1);
|
||||
@@ -574,7 +578,9 @@ try_again:
|
||||
smart_str_append_const(&soap_headers, "\", uri=\"");
|
||||
if (phpurl->path) {
|
||||
smart_str_appends(&soap_headers, phpurl->path);
|
||||
}
|
||||
} else {
|
||||
smart_str_appendc(&soap_headers, '/');
|
||||
}
|
||||
if (phpurl->query) {
|
||||
smart_str_appendc(&soap_headers, '?');
|
||||
smart_str_appends(&soap_headers, phpurl->query);
|
||||
|
||||
@@ -4543,6 +4543,7 @@ static void type_to_string(sdlTypePtr type, smart_str *buf, int level)
|
||||
type->kind == XSD_TYPEKIND_EXTENSION) && type->encode) {
|
||||
encodePtr enc = type->encode;
|
||||
while (enc && enc->details.sdl_type &&
|
||||
enc != enc->details.sdl_type->encode &&
|
||||
enc->details.sdl_type->kind != XSD_TYPEKIND_SIMPLE &&
|
||||
enc->details.sdl_type->kind != XSD_TYPEKIND_LIST &&
|
||||
enc->details.sdl_type->kind != XSD_TYPEKIND_UNION) {
|
||||
|
||||
@@ -114,7 +114,7 @@ int sqlite_step(
|
||||
sqlite *db;
|
||||
int rc;
|
||||
|
||||
if( p->magic!=VDBE_MAGIC_RUN ){
|
||||
if( !p || p->magic!=VDBE_MAGIC_RUN ){
|
||||
return SQLITE_MISUSE;
|
||||
}
|
||||
db = p->db;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #38759 (sqlite2 empty query causes segfault)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("pdo")) print "skip";
|
||||
if (!extension_loaded("sqlite")) print "skip";
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dbh = new PDO('sqlite2::memory:');
|
||||
var_dump($dbh->query(" "));
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(false)
|
||||
Done
|
||||
+4
-33
@@ -2548,46 +2548,17 @@ PHP_FUNCTION(array_count_values)
|
||||
(void**)&tmp) == FAILURE) {
|
||||
zval *data;
|
||||
MAKE_STD_ZVAL(data);
|
||||
Z_TYPE_P(data) = IS_LONG;
|
||||
Z_LVAL_P(data) = 1;
|
||||
ZVAL_LONG(data, 1);
|
||||
zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_PP(entry), &data, sizeof(data), NULL);
|
||||
} else {
|
||||
Z_LVAL_PP(tmp)++;
|
||||
}
|
||||
} else if (Z_TYPE_PP(entry) == IS_STRING) {
|
||||
/* make sure our array does not end up with numeric string keys
|
||||
* but don't touch those strings that start with 0 */
|
||||
if (!(Z_STRLEN_PP(entry) > 1 && Z_STRVAL_PP(entry)[0] == '0') && is_numeric_string(Z_STRVAL_PP(entry), Z_STRLEN_PP(entry), NULL, NULL, 0) == IS_LONG) {
|
||||
zval tmp_entry;
|
||||
|
||||
tmp_entry = **entry;
|
||||
zval_copy_ctor(&tmp_entry);
|
||||
|
||||
convert_to_long(&tmp_entry);
|
||||
|
||||
if (zend_hash_index_find(Z_ARRVAL_P(return_value),
|
||||
Z_LVAL(tmp_entry),
|
||||
(void**)&tmp) == FAILURE) {
|
||||
zval *data;
|
||||
MAKE_STD_ZVAL(data);
|
||||
Z_TYPE_P(data) = IS_LONG;
|
||||
Z_LVAL_P(data) = 1;
|
||||
zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL(tmp_entry), &data, sizeof(data), NULL);
|
||||
} else {
|
||||
Z_LVAL_PP(tmp)++;
|
||||
}
|
||||
|
||||
zval_dtor(&tmp_entry);
|
||||
zend_hash_move_forward_ex(myht, &pos);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (zend_hash_find(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRLEN_PP(entry)+1, (void**)&tmp) == FAILURE) {
|
||||
if (zend_symtable_find(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRLEN_PP(entry) + 1, (void**)&tmp) == FAILURE) {
|
||||
zval *data;
|
||||
MAKE_STD_ZVAL(data);
|
||||
Z_TYPE_P(data) = IS_LONG;
|
||||
Z_LVAL_P(data) = 1;
|
||||
zend_hash_update(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRLEN_PP(entry) + 1, &data, sizeof(data), NULL);
|
||||
ZVAL_LONG(data, 1);
|
||||
zend_symtable_update(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRLEN_PP(entry) + 1, &data, sizeof(data), NULL);
|
||||
} else {
|
||||
Z_LVAL_PP(tmp)++;
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ PHPAPI void php_print_credits(int flag TSRMLS_DC)
|
||||
|
||||
if (flag & PHP_CREDITS_QA) {
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_header(1, "PHP 5.1 Quality Assurance Team");
|
||||
php_info_print_table_header(1, "PHP Quality Assurance Team");
|
||||
php_info_print_table_row(1, "Ilia Alshanetsky, Joerg Behrens, Antony Dovgal, Stefan Esser, Moriyoshi Koizumi, Magnus Maatta, Sebastian Nohn, Derick Rethans, Melvyn Sopacua, Jani Taskinen");
|
||||
php_info_print_table_end();
|
||||
}
|
||||
|
||||
@@ -1880,7 +1880,7 @@ static php_stream_filter *consumed_filter_create(const char *filtername, zval *f
|
||||
/* Create this filter */
|
||||
data = pecalloc(1, sizeof(php_consumed_filter_data), persistent);
|
||||
if (!data) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %ld bytes.", sizeof(php_consumed_filter_data));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %zd bytes.", sizeof(php_consumed_filter_data));
|
||||
return NULL;
|
||||
}
|
||||
data->persistent = persistent;
|
||||
|
||||
+1
-5
@@ -490,11 +490,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
|
||||
php_info_print_table_row(2, "Thread Safety", "disabled" );
|
||||
#endif
|
||||
|
||||
#if USE_ZEND_ALLOC
|
||||
php_info_print_table_row(2, "Zend Memory Manager", "enabled" );
|
||||
#else
|
||||
php_info_print_table_row(2, "Zend Memory Manager", "disabled" );
|
||||
#endif
|
||||
php_info_print_table_row(2, "Zend Memory Manager", is_zend_mm(TSRMLS_C) ? "enabled" : "disabled" );
|
||||
|
||||
#if HAVE_IPV6
|
||||
php_info_print_table_row(2, "IPv6 Support", "enabled" );
|
||||
|
||||
@@ -33,8 +33,10 @@
|
||||
|
||||
#ifndef PHP_WIN32
|
||||
#define php_select(m, r, w, e, t) select(m, r, w, e, t)
|
||||
typedef unsigned long long php_timeout_ull;
|
||||
#else
|
||||
#include "win32/select.h"
|
||||
typedef unsigned __int64 php_timeout_ull;
|
||||
#endif
|
||||
|
||||
static php_stream_context *decode_context_param(zval *contextresource TSRMLS_DC);
|
||||
@@ -81,7 +83,7 @@ PHP_FUNCTION(stream_socket_client)
|
||||
int host_len;
|
||||
zval *zerrno = NULL, *zerrstr = NULL, *zcontext = NULL;
|
||||
double timeout = FG(default_socket_timeout);
|
||||
unsigned long conv;
|
||||
php_timeout_ull conv;
|
||||
struct timeval tv;
|
||||
char *hashkey = NULL;
|
||||
php_stream *stream = NULL;
|
||||
@@ -103,7 +105,7 @@ PHP_FUNCTION(stream_socket_client)
|
||||
}
|
||||
|
||||
/* prepare the timeout value for use */
|
||||
conv = (unsigned long) (timeout * 1000000.0);
|
||||
conv = (php_timeout_ull) (timeout * 1000000.0);
|
||||
tv.tv_sec = conv / 1000000;
|
||||
tv.tv_usec = conv % 1000000;
|
||||
|
||||
@@ -231,7 +233,7 @@ PHP_FUNCTION(stream_socket_accept)
|
||||
{
|
||||
double timeout = FG(default_socket_timeout);
|
||||
zval *peername = NULL;
|
||||
unsigned long conv;
|
||||
php_timeout_ull conv;
|
||||
struct timeval tv;
|
||||
php_stream *stream = NULL, *clistream = NULL;
|
||||
zval *zstream;
|
||||
@@ -245,7 +247,7 @@ PHP_FUNCTION(stream_socket_accept)
|
||||
php_stream_from_zval(stream, &zstream);
|
||||
|
||||
/* prepare the timeout value for use */
|
||||
conv = (unsigned long) (timeout * 1000000.0);
|
||||
conv = (php_timeout_ull) (timeout * 1000000.0);
|
||||
tv.tv_sec = conv / 1000000;
|
||||
tv.tv_usec = conv % 1000000;
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
--TEST--
|
||||
array_search() tests
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$a = array(1=>0, 2=>1, 4=>3, "a"=>"b", "c"=>"d");
|
||||
|
||||
var_dump(array_search(1));
|
||||
var_dump(array_search(1,1));
|
||||
var_dump(array_search("a",$a));
|
||||
var_dump(array_search("0",$a, true));
|
||||
var_dump(array_search("0",$a));
|
||||
var_dump(array_search(0,$a));
|
||||
var_dump(array_search(1,$a));
|
||||
var_dump(array_search("d",$a, true));
|
||||
var_dump(array_search("d",$a));
|
||||
var_dump(array_search(-1,$a, true));
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Wrong parameter count for array_search() in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: array_search(): Wrong datatype for second argument in %s on line %d
|
||||
bool(false)
|
||||
int(1)
|
||||
bool(false)
|
||||
int(1)
|
||||
int(1)
|
||||
int(2)
|
||||
string(1) "c"
|
||||
int(1)
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,48 @@
|
||||
--TEST--
|
||||
array_walk() tests
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(array_walk());
|
||||
$var = 1;
|
||||
var_dump(array_walk($var,1));
|
||||
$var = array();
|
||||
var_dump(array_walk($var,""));
|
||||
|
||||
function foo($v1, $v2, $v3) {
|
||||
var_dump($v1);
|
||||
var_dump($v2);
|
||||
var_dump($v3);
|
||||
}
|
||||
|
||||
$var = array(1,2);
|
||||
var_dump(array_walk($var, "foo", "data"));
|
||||
|
||||
function foo2($v1, $v2, $v3) {
|
||||
throw new Exception($v3);
|
||||
}
|
||||
|
||||
try {
|
||||
var_dump(array_walk($var,"foo2", "data"));
|
||||
} catch (Exception $e) {
|
||||
var_dump($e->getMessage());
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Wrong parameter count for array_walk() in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: array_walk(): The argument should be an array in %s on line %d
|
||||
bool(false)
|
||||
bool(true)
|
||||
int(1)
|
||||
int(0)
|
||||
string(4) "data"
|
||||
int(2)
|
||||
int(1)
|
||||
string(4) "data"
|
||||
bool(true)
|
||||
string(4) "data"
|
||||
Done
|
||||
@@ -0,0 +1,54 @@
|
||||
--TEST--
|
||||
array_walk_recursive() tests
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(array_walk_recursive());
|
||||
$var = 1;
|
||||
var_dump(array_walk_recursive($var,1));
|
||||
$var = array();
|
||||
var_dump(array_walk_recursive($var,""));
|
||||
|
||||
function foo($v1, $v2, $v3) {
|
||||
var_dump($v1);
|
||||
var_dump($v2);
|
||||
var_dump($v3);
|
||||
}
|
||||
|
||||
$var = array(1,2, array(2,3));
|
||||
var_dump(array_walk_recursive($var, "foo", "data"));
|
||||
|
||||
function foo2($v1, $v2, $v3) {
|
||||
throw new Exception($v3);
|
||||
}
|
||||
|
||||
try {
|
||||
var_dump(array_walk_recursive($var,"foo2", "data"));
|
||||
} catch (Exception $e) {
|
||||
var_dump($e->getMessage());
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Wrong parameter count for array_walk_recursive() in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: array_walk_recursive(): The argument should be an array in %s on line %d
|
||||
bool(false)
|
||||
bool(true)
|
||||
int(1)
|
||||
int(0)
|
||||
string(4) "data"
|
||||
int(2)
|
||||
int(1)
|
||||
string(4) "data"
|
||||
int(2)
|
||||
int(0)
|
||||
string(4) "data"
|
||||
int(3)
|
||||
int(1)
|
||||
string(4) "data"
|
||||
bool(true)
|
||||
string(4) "data"
|
||||
Done
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #38464 (array_count_values() mishandles numeric strings)
|
||||
--FILE--
|
||||
<?php
|
||||
$array = array('-000', ' 001', 1, ' 123', '+123');
|
||||
var_dump(array_count_values($array));
|
||||
?>
|
||||
--EXPECT--
|
||||
array(5) {
|
||||
["-000"]=>
|
||||
int(1)
|
||||
[" 001"]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(1)
|
||||
[" 123"]=>
|
||||
int(1)
|
||||
["+123"]=>
|
||||
int(1)
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
--TEST--
|
||||
max() tests
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(max());
|
||||
var_dump(max(1));
|
||||
var_dump(max(array()));
|
||||
var_dump(max(new stdclass));
|
||||
var_dump(max(2,1,2));
|
||||
var_dump(max(2.1,2.11,2.09));
|
||||
var_dump(max("", "t", "b"));
|
||||
var_dump(max(false, true, false));
|
||||
var_dump(max(true, false, true));
|
||||
var_dump(max(1, true, false, true));
|
||||
var_dump(max(0, true, false, true));
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: max(): Atleast one value should be passed in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Wrong parameter count for max() in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: max(): Array must contain atleast one element in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: Wrong parameter count for max() in %s on line %d
|
||||
NULL
|
||||
int(2)
|
||||
float(2.11)
|
||||
string(1) "t"
|
||||
bool(true)
|
||||
bool(true)
|
||||
int(1)
|
||||
bool(true)
|
||||
Done
|
||||
@@ -0,0 +1,39 @@
|
||||
--TEST--
|
||||
min() tests
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(min());
|
||||
var_dump(min(1));
|
||||
var_dump(min(array()));
|
||||
var_dump(min(new stdclass));
|
||||
var_dump(min(2,1,2));
|
||||
var_dump(min(2.1,2.11,2.09));
|
||||
var_dump(min("", "t", "b"));
|
||||
var_dump(min(false, true, false));
|
||||
var_dump(min(true, false, true));
|
||||
var_dump(min(1, true, false, true));
|
||||
var_dump(min(0, true, false, true));
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: min(): Atleast one value should be passed in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Wrong parameter count for min() in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: min(): Array must contain atleast one element in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: Wrong parameter count for min() in %s on line %d
|
||||
NULL
|
||||
int(1)
|
||||
float(2.09)
|
||||
string(0) ""
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
int(0)
|
||||
Done
|
||||
+10
-2
@@ -13,9 +13,17 @@ tidy.default_config=
|
||||
var_dump($a->getopt("error-file"));
|
||||
echo "Current Value of 'tab-size': ";
|
||||
var_dump($a->getopt("tab-size"));
|
||||
|
||||
|
||||
var_dump($a->getopt('bogus-opt'));
|
||||
var_dump(tidy_getopt($a, 'non-ASCII string àáç'));
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
Current Value of 'tidy-mark': bool(false)
|
||||
Current Value of 'error-file': string(0) ""
|
||||
Current Value of 'tab-size': int(8)
|
||||
|
||||
Warning: tidy::getOpt(): Unknown Tidy Configuration Option 'bogus-opt' in %s007.php on line 10
|
||||
bool(false)
|
||||
|
||||
Warning: tidy_getopt(): Unknown Tidy Configuration Option 'non-ASCII string àáç' in %s007.php on line 11
|
||||
bool(false)
|
||||
@@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
OO API
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("tidy")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$tidy = new tidy();
|
||||
$str = <<<EOF
|
||||
<p>Isto é um texto em Português<br>
|
||||
para testes.</p>
|
||||
EOF;
|
||||
|
||||
$tidy->parseString($str, array('output-xhtml'=>1), 'latin1');
|
||||
$tidy->cleanRepair();
|
||||
$tidy->diagnose();
|
||||
var_dump(tidy_warning_count($tidy) > 0);
|
||||
var_dump(strlen($tidy->errorBuffer) > 50);
|
||||
|
||||
echo $tidy;
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Isto é um texto em Português<br />
|
||||
para testes.</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
tidy_get_opt_doc()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("tidy") || !function_exists('tidy_get_opt_doc')) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(tidy_get_opt_doc(new tidy, 'some_bogus_cfg'));
|
||||
|
||||
$t = new tidy;
|
||||
var_dump($t->getOptDoc('ncr'));
|
||||
var_dump(strlen(tidy_get_opt_doc($t, 'wrap')) > 99);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: tidy_get_opt_doc(): Unknown Tidy Configuration Option 'some_bogus_cfg' in %s021.php on line 3
|
||||
bool(false)
|
||||
string(73) "This option specifies if Tidy should allow numeric character references. "
|
||||
bool(true)
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
tidy_repair_*() and invalid parameters
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("tidy")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$l = 1;
|
||||
$s = "";
|
||||
$a = array();
|
||||
|
||||
tidy_repair_string($s, $l, $l, $l);
|
||||
tidy_repair_string($s, $s, $s, $s);
|
||||
tidy_repair_string($l, $l, $l ,$l);
|
||||
tidy_repair_string($a, $a, $a, $a);
|
||||
|
||||
tidy_repair_file($s, $l, $l, $l);
|
||||
tidy_repair_file($s, $s, $s, $s);
|
||||
tidy_repair_file($l, $l, $l ,$l);
|
||||
tidy_repair_file($a, $a, $a, $a);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: tidy_repair_string(): Could not load configuration file '1' in %s on line %d
|
||||
|
||||
Warning: tidy_repair_string(): Could not set encoding '1' in %s on line %d
|
||||
|
||||
Warning: tidy_repair_string(): Could not load configuration file '' in %s on line %d
|
||||
|
||||
Warning: tidy_repair_string(): Could not load configuration file '1' in %s on line %d
|
||||
|
||||
Warning: tidy_repair_string(): Could not set encoding '1' in %s on line %d
|
||||
|
||||
Warning: tidy_repair_string() expects parameter 1 to be string, array given in %s on line %d
|
||||
|
||||
Warning: tidy_repair_file() expects parameter 1 to be string, array given in %s on line %d
|
||||
Done
|
||||
Loaded 100 of 126 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user