mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-09 02:00:49 +00:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2610d63a48 | ||
|
|
f75d2139cd | ||
|
|
a7f97b6fb7 | ||
|
|
cc65e0cdfb | ||
|
|
e629e4ba20 |
No files matched your search
@@ -20,9 +20,6 @@
|
||||
*.tar.gz
|
||||
*.tar.bz2
|
||||
*.tar.xz
|
||||
*.tar.gz.asc
|
||||
*.tar.bz2.asc
|
||||
*.tar.xz.asc
|
||||
.FBCIndex
|
||||
.FBCLockFolder
|
||||
.deps
|
||||
|
||||
@@ -4,8 +4,6 @@ notifications:
|
||||
email:
|
||||
on_failure: change
|
||||
irc:
|
||||
template:
|
||||
- "%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message} - Change view : %{compare_url} - Build details : %{build_url}"
|
||||
channels:
|
||||
- "irc.efnet.org#php.pecl"
|
||||
on_success: change
|
||||
|
||||
@@ -1,258 +1,5 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
03 Sep 2015, PHP 5.6.13
|
||||
|
||||
- Core:
|
||||
. Fixed bug #69900 (Too long timeout on pipes). (Anatol)
|
||||
. Fixed bug #69487 (SAPI may truncate POST data). (cmb)
|
||||
. Fixed bug #70198 (Checking liveness does not work as expected).
|
||||
(Shafreeck Sea, Anatol Belski)
|
||||
. Fixed bug #70172 (Use After Free Vulnerability in unserialize()). (Stas)
|
||||
. Fixed bug #70219 (Use after free vulnerability in session deserializer).
|
||||
(taoguangchen at icloud dot com)
|
||||
|
||||
- CLI server:
|
||||
. Fixed bug #66606 (Sets HTTP_CONTENT_TYPE but not CONTENT_TYPE).
|
||||
(wusuopu, cmb)
|
||||
. Fixed bug #70264 (CLI server directory traversal). (cmb)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #70266 (DateInterval::__construct.interval_spec is not supposed to
|
||||
be optional). (cmb)
|
||||
. Fixed bug #70277 (new DateTimeZone($foo) is ignoring text after null byte).
|
||||
(cmb)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #70385 (Buffer over-read in exif_read_data with TIFF IFD tag byte
|
||||
value of 32 bytes). (Stas)
|
||||
|
||||
- hash:
|
||||
. Fixed bug #70312 (HAVAL gives wrong hashes in specific cases). (letsgolee
|
||||
at naver dot com)
|
||||
|
||||
- MCrypt:
|
||||
. Fixed bug #69833 (mcrypt fd caching not working). (Anatol)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #70237 (Empty while and do-while segmentation fault with opcode
|
||||
on CLI enabled). (Dmitry, Laruence)
|
||||
|
||||
- PCRE:
|
||||
. Fixed bug #70232 (Incorrect bump-along behavior with \K and empty string
|
||||
match). (cmb)
|
||||
. Fixed bug #70345 (Multiple vulnerabilities related to PCRE functions).
|
||||
(Anatol Belski)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #70388 (SOAP serialize_function_call() type confusion / RCE).
|
||||
(Stas)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #70290 (Null pointer deref (segfault) in spl_autoload via
|
||||
ob_start). (hugh at allthethings dot co dot nz)
|
||||
. Fixed bug #70303 (Incorrect constructor reflection for ArrayObject). (cmb)
|
||||
. Fixed bug #70365 (Use-after-free vulnerability in unserialize() with
|
||||
SplObjectStorage). (taoguangchen at icloud dot com)
|
||||
. Fixed bug #70366 (Use-after-free vulnerability in unserialize() with
|
||||
SplDoublyLinkedList). (taoguangchen at icloud dot com)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #70052 (getimagesize() fails for very large and very small WBMP).
|
||||
(cmb)
|
||||
. Fixed bug #70157 (parse_ini_string() segmentation fault with
|
||||
INI_SCANNER_TYPED). (Tjerk)
|
||||
|
||||
- XSLT:
|
||||
. Fixed bug #69782 (NULL pointer dereference). (Stas)
|
||||
|
||||
- ZIP:
|
||||
. Fixed bug #70350 (ZipArchive::extractTo allows for directory traversal when
|
||||
creating directories). (neal at fb dot com)
|
||||
|
||||
06 Aug 2015, PHP 5.6.12
|
||||
|
||||
- Core:
|
||||
. Fixed bug #70012 (Exception lost with nested finally block). (Laruence)
|
||||
. Fixed bug #70002 (TS issues with temporary dir handling). (Anatol)
|
||||
. Fixed bug #69793 (Remotely triggerable stack exhaustion via recursive
|
||||
method calls). (Stas)
|
||||
. Fixed bug #69892 (Different arrays compare indentical due to integer key
|
||||
truncation). (Nikita)
|
||||
. Fixed bug #70121 (unserialize() could lead to unexpected methods execution
|
||||
/ NULL pointer deref). (Stas)
|
||||
|
||||
- CLI server:
|
||||
. Fixed bug #69655 (php -S changes MKCALENDAR request method to MKCOL). (cmb)
|
||||
. Fixed bug #64878 (304 responses return Content-Type header). (cmb)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #53156 (imagerectangle problem with point ordering). (cmb)
|
||||
. Fixed bug #66387 (Stack overflow with imagefilltoborder). (cmb)
|
||||
. Fixed bug #70102 (imagecreatefromwebm() shifts colors). (cmb)
|
||||
. Fixed bug #66590 (imagewebp() doesn't pad to even length). (cmb)
|
||||
. Fixed bug #66882 (imagerotate by -90 degrees truncates image by 1px). (cmb)
|
||||
. Fixed bug #70064 (imagescale(..., IMG_BICUBIC) leaks memory). (cmb)
|
||||
. Fixed bug #69024 (imagescale segfault with palette based image). (cmb)
|
||||
. Fixed bug #53154 (Zero-height rectangle has whiskers). (cmb)
|
||||
. Fixed bug #67447 (imagecrop() add a black line when cropping). (cmb)
|
||||
. Fixed bug #68714 (copy 'n paste error). (cmb)
|
||||
. Fixed bug #66339 (PHP segfaults in imagexbm). (cmb)
|
||||
. Fixed bug #70047 (gd_info() doesn't report WebP support). (cmb)
|
||||
|
||||
- ODBC:
|
||||
. Fixed bug #69975 (PHP segfaults when accessing nvarchar(max) defined
|
||||
columns). (cmb)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #69882 (OpenSSL error "key values mismatch" after
|
||||
openssl_pkcs12_read with extra cert). (Tomasz Sawicki)
|
||||
. Fixed bug #70014 (openssl_random_pseudo_bytes() is not cryptographically
|
||||
secure). (Stas)
|
||||
|
||||
- Phar:
|
||||
. Improved fix for bug #69441. (Anatol Belski)
|
||||
. Fixed bug #70019 (Files extracted from archive may be placed outside of
|
||||
destination directory). (Anatol Belski)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #70081 (SoapClient info leak / null pointer dereference via
|
||||
multiple type confusions). (Stas)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #70068 (Dangling pointer in the unserialization of ArrayObject
|
||||
items). (sean.heelan)
|
||||
. Fixed bug #70166 (Use After Free Vulnerability in unserialize() with
|
||||
SPLArrayObject). (taoguangchen at icloud dot com)
|
||||
. Fixed bug #70168 (Use After Free Vulnerability in unserialize() with
|
||||
SplObjectStorage). (taoguangchen at icloud dot com)
|
||||
. Fixed bug #70169 (Use After Free Vulnerability in unserialize() with
|
||||
SplDoublyLinkedList). (taoguangchen at icloud dot com)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #70096 (Repeated iptcembed() adds superfluous FF bytes). (cmb)
|
||||
|
||||
09 Jul 2015, PHP 5.6.11
|
||||
|
||||
- Core:
|
||||
. Fixed bug #69768 (escapeshell*() doesn't cater to !). (cmb)
|
||||
. Fixed bug #69703 (Use __builtin_clzl on PowerPC).
|
||||
(dja at axtens dot net, Kalle)
|
||||
. Fixed bug #69732 (can induce segmentation fault with basic php code).
|
||||
(Dmitry)
|
||||
. Fixed bug #69642 (Windows 10 reported as Windows 8).
|
||||
(Christian Wenz, Anatol Belski)
|
||||
. Fixed bug #69551 (parse_ini_file() and parse_ini_string() segmentation
|
||||
fault). (Christoph M. Becker)
|
||||
. Fixed bug #69781 (phpinfo() reports Professional Editions of Windows
|
||||
7/8/8.1/10 as "Business"). (Christian Wenz)
|
||||
. Fixed bug #69740 (finally in generator (yield) swallows exception in
|
||||
iteration). (Nikita)
|
||||
. Fixed bug #69835 (phpinfo() does not report many Windows SKUs).
|
||||
(Christian Wenz)
|
||||
. Fixed bug #69892 (Different arrays compare indentical due to integer key
|
||||
truncation). (Nikita)
|
||||
. Fixed bug #69874 (Can't set empty additional_headers for mail()), regression
|
||||
from fix to bug #68776. (Yasuo)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #61221 (imagegammacorrect function loses alpha channel). (cmb)
|
||||
|
||||
- GMP:
|
||||
. Fixed bug #69803 (gmp_random_range() modifies second parameter if GMP
|
||||
number). (Nikita)
|
||||
|
||||
- Mysqlnd:
|
||||
. Fixed bug #69669 (mysqlnd is vulnerable to BACKRONYM). (CVE-2015-3152)
|
||||
(Andrey)
|
||||
|
||||
- PCRE:
|
||||
. Fixed Bug #53823 (preg_replace: * qualifier on unicode replace garbles the
|
||||
string). (cmb)
|
||||
. Fixed bug #69864 (Segfault in preg_replace_callback) (cmb, ab)
|
||||
|
||||
- PDO_pgsql:
|
||||
. Fixed bug #69752 (PDOStatement::execute() leaks memory with DML
|
||||
Statements when closeCuror() is u). (Philip Hofstetter)
|
||||
. Fixed bug #69362 (PDO-pgsql fails to connect if password contains a
|
||||
leading single quote). (Matteo)
|
||||
. Fixed bug #69344 (PDO PgSQL Incorrect binding numeric array with gaps).
|
||||
(Matteo)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #69958 (Segfault in Phar::convertToData on invalid file).
|
||||
(CVE-2015-5589) (Stas)
|
||||
. Fixed bug #69923 (Buffer overflow and stack smashing error in
|
||||
phar_fix_filepath). (CVE-2015-5590) (Stas)
|
||||
|
||||
- SimpleXML:
|
||||
. Refactored the fix for bug #66084 (simplexml_load_string() mangles empty
|
||||
node name). (Christoph Michael Becker)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #69737 (Segfault when SplMinHeap::compare produces fatal error).
|
||||
(Stas)
|
||||
. Fixed bug #67805 (SplFileObject setMaxLineLength). (Willian Gustavo Veiga).
|
||||
. Fixed bug #69970 (Use-after-free vulnerability in
|
||||
spl_recursive_it_move_forward_ex()). (Laruence)
|
||||
|
||||
- Sqlite3:
|
||||
. Fixed bug #69972 (Use-after-free vulnerability in
|
||||
sqlite3SafetyCheckSickOrOk()). (Laruence)
|
||||
|
||||
11 Jun 2015, PHP 5.6.10
|
||||
|
||||
- Core:
|
||||
. Fixed bug #66048 (temp. directory is cached during multiple requests).
|
||||
(Julien)
|
||||
. Fixed bug #69566 (Conditional jump or move depends on uninitialised value
|
||||
in extension trait). (jbboehr at gmail dot com)
|
||||
. Fixed bug #69599 (Strange generator+exception+variadic crash). (Nikita)
|
||||
. Fixed bug #69628 (complex GLOB_BRACE fails on Windows).
|
||||
(Christoph M. Becker)
|
||||
. Fixed POST data processing slowdown due to small input buffer size
|
||||
on Windows. (Jorge Oliveira, Anatol)
|
||||
. Fixed bug #69646 (OS command injection vulnerability in escapeshellarg).
|
||||
(CVE-2015-4642) (Anatol Belski)
|
||||
. Fixed bug #69719 (Incorrect handling of paths with NULs). (Stas)
|
||||
|
||||
- FTP
|
||||
. Improved fix for bug #69545 (Integer overflow in ftp_genlist() resulting in
|
||||
heap overflow). (CVE-2015-4643) (Max Spelsberg)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #69479 (GD fails to build with newer libvpx). (Remi)
|
||||
|
||||
- Iconv:
|
||||
. Fixed bug #48147 (iconv with //IGNORE cuts the string). (Stas)
|
||||
|
||||
- Litespeed SAPI:
|
||||
. Fixed bug #68812 (Unchecked return value). (George Wang)
|
||||
|
||||
- Mail:
|
||||
. Fixed bug #68776 (mail() does not have mail header injection prevention for
|
||||
additional headers). (Yasuo)
|
||||
|
||||
- MCrypt:
|
||||
. Added file descriptor caching to mcrypt_create_iv() (Leigh)
|
||||
|
||||
- Opcache
|
||||
. Fixed bug #69549 (Memory leak with opcache.optimization_level=0xFFFFFFFF).
|
||||
(Laruence, Dmitry)
|
||||
|
||||
- PCRE
|
||||
. Upgraded pcrelib to 8.37. (CVE-2015-2325, CVE-2015-2326)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #69680 (phar symlink in binary directory broken).
|
||||
(Matteo Bernardini, Remi)
|
||||
|
||||
- Postgres:
|
||||
. Fixed bug #69667 (segfault in php_pgsql_meta_data). (CVE-2015-4644) (Remi)
|
||||
|
||||
- Sqlite3:
|
||||
. Upgrade bundled sqlite to 3.8.10.2. (CVE-2015-3414, CVE-2015-3415,
|
||||
CVE-2015-3416) (Kaplan)
|
||||
|
||||
14 May 2015, PHP 5.6.9
|
||||
|
||||
- Core:
|
||||
@@ -268,17 +15,15 @@ PHP NEWS
|
||||
(Nikita)
|
||||
. Fixed bug #69472 (php_sys_readlink ignores misc errors from
|
||||
GetFinalPathNameByHandleA). (Jan Starke)
|
||||
. Fixed bug #69364 (PHP Multipart/form-data remote dos Vulnerability).
|
||||
(CVE-2015-4024) (Stas)
|
||||
. Fixed bug #69364 (PHP Multipart/form-data remote dos Vulnerability). (Stas)
|
||||
. Fixed bug #69403 (str_repeat() sign mismatch based memory corruption).
|
||||
(Stas)
|
||||
. Fixed bug #69418 (CVE-2006-7243 fix regressions in 5.4+). (CVE-2015-4025)
|
||||
(Stas)
|
||||
. Fixed bug #69418 (CVE-2006-7243 fix regressions in 5.4+). (Stas)
|
||||
. Fixed bug #69522 (heap buffer overflow in unpack()). (Stas)
|
||||
|
||||
- FTP:
|
||||
. Fixed bug #69545 (Integer overflow in ftp_genlist() resulting in heap
|
||||
overflow). (CVE-2015-4022) (Stas)
|
||||
overflow). (Stas)
|
||||
|
||||
- ODBC:
|
||||
. Fixed bug #69354 (Incorrect use of SQLColAttributes with ODBC 3.0).
|
||||
@@ -293,12 +38,14 @@ PHP NEWS
|
||||
(Daniel Lowrey)
|
||||
|
||||
- PCNTL:
|
||||
. Fixed bug #68598 (pcntl_exec() should not allow null char). (CVE-2015-4026)
|
||||
(Stas)
|
||||
. Fixed bug #68598 (pcntl_exec() should not allow null char). (Stas)
|
||||
|
||||
- PCRE
|
||||
. Upgraded pcrelib to 8.37.
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #69453 (Memory Corruption in phar_parse_tarfile when entry
|
||||
filename starts with null). (CVE-2015-4021) (Stas)
|
||||
filename starts with null). (Stas)
|
||||
|
||||
16 Apr 2015, PHP 5.6.8
|
||||
|
||||
@@ -476,8 +223,7 @@ PHP NEWS
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #69085 (SoapClient's __call() type confusion through
|
||||
unserialize()). (CVE-2015-4147, CVE-2015-4148) (andrea dot palazzo at truel
|
||||
dot it, Laruence)
|
||||
unserialize()). (andrea dot palazzo at truel dot it, Laruence)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #69108 ("Segmentation fault" when (de)serializing
|
||||
|
||||
+6
-6
@@ -12,7 +12,7 @@ Collaboration is a Good Thing(tm), and Git lets us do this. Thus, following
|
||||
some basic rules with regards to Git usage will::
|
||||
|
||||
a. Make everybody happier, especially those responsible for maintaining
|
||||
PHP itself.
|
||||
Git itself.
|
||||
|
||||
b. Keep the changes consistently well documented and easily trackable.
|
||||
|
||||
@@ -48,11 +48,11 @@ Currently we have the following branches in use::
|
||||
PHP-5.6 Is used to release the PHP 5.6.x series. This is a current
|
||||
stable version and is open for bugfixes only.
|
||||
|
||||
PHP-5.5 Is used to release the PHP 5.5.x series. This is an old
|
||||
stable version and is open for security fixes only.
|
||||
PHP-5.5 Is used to release the PHP 5.5.x series. This is a current
|
||||
stable version and is open for bugfixes only.
|
||||
|
||||
PHP-5.4 Is used to release the PHP 5.4.x series. This is an old
|
||||
stable version and is open for security fixes only.
|
||||
PHP-5.4 Is used to release the PHP 5.4.x series. This is a current
|
||||
stable version and is open for bugfixes only.
|
||||
|
||||
PHP-5.3 This branch is closed.
|
||||
|
||||
@@ -67,7 +67,7 @@ Currently we have the following branches in use::
|
||||
|
||||
The next few rules are more of a technical nature::
|
||||
|
||||
1. All changes should first go to the lowest branch (i.e. 5.6) and then
|
||||
1. All changes should first go to the lowest branch (i.e. 5.4) and then
|
||||
get merged up to all other branches. If a change is not needed for
|
||||
later branches (i.e. fixes for features which where dropped from later
|
||||
branches) an empty merge should be done.
|
||||
|
||||
@@ -61,9 +61,6 @@ PHP 5.6 UPGRADE NOTES
|
||||
longer accept keys or IVs with incorrect sizes. Furthermore an IV is now
|
||||
required if the used block cipher mode requires it.
|
||||
|
||||
- cURL:
|
||||
Uploads using the @file syntax are now unsupported by default.
|
||||
|
||||
========================================
|
||||
2. New Features
|
||||
========================================
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
--TEST--
|
||||
Bug #69551 - parse_ini_file() and parse_ini_string() segmentation fault
|
||||
--FILE--
|
||||
<?php
|
||||
$ini = <<<INI
|
||||
[Network.eth0]
|
||||
SubnetMask = "
|
||||
"
|
||||
INI;
|
||||
$settings = parse_ini_string($ini, false, INI_SCANNER_RAW);
|
||||
var_dump($settings);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: syntax error, unexpected '"' in Unknown on line %d
|
||||
in %s on line %d
|
||||
bool(false)
|
||||
@@ -1,21 +0,0 @@
|
||||
--TEST--
|
||||
Bug #69599: Strange generator+exception+variadic crash
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function crash() {
|
||||
sin(...[0]);
|
||||
throw new \Exception();
|
||||
yield;
|
||||
}
|
||||
|
||||
iterator_to_array(crash());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught exception 'Exception' in %s:%d
|
||||
Stack trace:
|
||||
#0 [internal function]: crash()
|
||||
#1 %s(%d): iterator_to_array(Object(Generator))
|
||||
#2 {main}
|
||||
thrown in %s on line %d
|
||||
@@ -1,27 +0,0 @@
|
||||
--TEST--
|
||||
Bug #69732 (can induce segmentation fault with basic php code)
|
||||
--FILE--
|
||||
<?php
|
||||
class wpq {
|
||||
private $unreferenced;
|
||||
|
||||
public function __get($name) {
|
||||
return $this->$name . "XXX";
|
||||
}
|
||||
}
|
||||
|
||||
function ret_assoc() {
|
||||
$x = "XXX";
|
||||
return array('foo' => 'bar', $x);
|
||||
}
|
||||
|
||||
$wpq = new wpq;
|
||||
$wpq->interesting =& ret_assoc();
|
||||
$x = $wpq->interesting;
|
||||
printf("%s\n", $x);
|
||||
--EXPECTF--
|
||||
Notice: Undefined property: wpq::$interesting in %sbug69732.php on line 6
|
||||
|
||||
Notice: Indirect modification of overloaded property wpq::$interesting has no effect in %sbug69732.php on line 16
|
||||
|
||||
Fatal error: Cannot assign by reference to overloaded object in %sbug69732.php on line 16
|
||||
@@ -1,28 +0,0 @@
|
||||
--TEST--
|
||||
Bug #69740: finally in generator (yield) swallows exception in iteration
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function generate() {
|
||||
try {
|
||||
yield 1;
|
||||
yield 2;
|
||||
} finally {
|
||||
echo "finally\n";
|
||||
}
|
||||
}
|
||||
|
||||
foreach (generate() as $i) {
|
||||
echo $i, "\n";
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
1
|
||||
finally
|
||||
|
||||
Fatal error: Uncaught exception 'Exception' in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
@@ -1,10 +0,0 @@
|
||||
--TEST--
|
||||
Bug #69892: Different arrays compare indentical due to integer key truncation
|
||||
--SKIPIF--
|
||||
<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump([0 => 0] === [0x100000000 => 0]);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
@@ -1,32 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70012 (Exception lost with nested finally block)
|
||||
--FILE--
|
||||
<?php
|
||||
try {
|
||||
echo "Outer try\n";
|
||||
try {
|
||||
echo " Middle try\n";
|
||||
throw new Exception();
|
||||
} finally {
|
||||
echo " Middle finally\n";
|
||||
try {
|
||||
echo " Inner try\n";
|
||||
} finally {
|
||||
echo " Inner finally\n";
|
||||
}
|
||||
}
|
||||
echo "Outer shouldnt get here\n";
|
||||
} catch (Exception $e) {
|
||||
echo "Outer catch\n";
|
||||
} finally {
|
||||
echo "Outer finally\n";
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
Outer try
|
||||
Middle try
|
||||
Middle finally
|
||||
Inner try
|
||||
Inner finally
|
||||
Outer catch
|
||||
Outer finally
|
||||
@@ -1,9 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70121 (unserialize() could lead to unexpected methods execution / NULL pointer deref)
|
||||
--FILE--
|
||||
<?php
|
||||
unserialize('O:12:"DateInterval":1:{s:4:"days";O:9:"Exception":7:{s:10:"'."\0".'*'."\0".'message";s:1:"x";s:17:"'."\0".'Exception'."\0".'string";s:1:"A";s:7:"'."\0".'*'."\0".'code";i:0;s:7:"'."\0".'*'."\0".'file";s:1:"a";s:7:"'."\0".'*'."\0".'line";i:1337;s:16:"'."\0".'Exception'."\0".'trace";a:0:{}s:19:"'."\0".'Exception'."\0".'previous";O:8:"stdClass":0:{}}}');
|
||||
?>
|
||||
OK
|
||||
--EXPECT--
|
||||
OK
|
||||
@@ -1,18 +0,0 @@
|
||||
--TEST--
|
||||
Testing declare statement with ticks
|
||||
--SKIPIF--
|
||||
--FILE--
|
||||
<?php
|
||||
register_tick_function(function () { echo "tick\n"; });
|
||||
function foo() { }
|
||||
|
||||
declare(ticks=1) {
|
||||
|
||||
$statement;
|
||||
foo();
|
||||
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
tick
|
||||
tick
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Closure::__invoke() with variadic parameter
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$closure = function(&...$refs) {};
|
||||
$closure->__invoke(
|
||||
$v1, $v2, $v3, $v4,
|
||||
$v5, $v6, $v7, $v8,
|
||||
$v9, $v10, $v11, $v12,
|
||||
$v13
|
||||
);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
+2
-2
@@ -678,7 +678,7 @@ static inline unsigned int zend_mm_high_bit(size_t _size)
|
||||
__asm {
|
||||
bsr eax, _size
|
||||
}
|
||||
#elif defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__) || defined(__powerpc__))
|
||||
#elif defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__))
|
||||
return (8 * SIZEOF_SIZE_T - 1) - __builtin_clzl(_size);
|
||||
#else
|
||||
unsigned int n = 0;
|
||||
@@ -706,7 +706,7 @@ static inline unsigned int zend_mm_low_bit(size_t _size)
|
||||
__asm {
|
||||
bsf eax, _size
|
||||
}
|
||||
#elif defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__) || defined(__powerpc__))
|
||||
#elif defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__))
|
||||
return __builtin_ctzl(_size);
|
||||
#else
|
||||
static const int offset[16] = {4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0};
|
||||
|
||||
@@ -148,12 +148,10 @@ ZEND_API zend_function *zend_get_closure_invoke_method(zval *obj TSRMLS_DC) /* {
|
||||
{
|
||||
zend_closure *closure = (zend_closure *)zend_object_store_get_object(obj TSRMLS_CC);
|
||||
zend_function *invoke = (zend_function*)emalloc(sizeof(zend_function));
|
||||
const zend_uint keep_flags = ZEND_ACC_RETURN_REFERENCE | ZEND_ACC_VARIADIC;
|
||||
|
||||
invoke->common = closure->func.common;
|
||||
invoke->type = ZEND_INTERNAL_FUNCTION;
|
||||
invoke->internal_function.fn_flags =
|
||||
ZEND_ACC_PUBLIC | ZEND_ACC_CALL_VIA_HANDLER | (closure->func.common.fn_flags & keep_flags);
|
||||
invoke->internal_function.fn_flags = ZEND_ACC_PUBLIC | ZEND_ACC_CALL_VIA_HANDLER | (closure->func.common.fn_flags & ZEND_ACC_RETURN_REFERENCE);
|
||||
invoke->internal_function.handler = ZEND_MN(Closure___invoke);
|
||||
invoke->internal_function.module = 0;
|
||||
invoke->internal_function.scope = zend_ce_closure;
|
||||
|
||||
+2
-9
@@ -4101,7 +4101,7 @@ static int zend_fixup_trait_method(zend_function *fn, zend_class_entry *ce TSRML
|
||||
if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
|
||||
ce->ce_flags |= ZEND_ACC_IMPLICIT_ABSTRACT_CLASS;
|
||||
}
|
||||
if (fn->type == ZEND_USER_FUNCTION && fn->op_array.static_variables) {
|
||||
if (fn->op_array.static_variables) {
|
||||
ce->ce_flags |= ZEND_HAS_STATIC_IN_METHODS;
|
||||
}
|
||||
}
|
||||
@@ -6827,14 +6827,7 @@ void zend_do_extended_fcall_end(TSRMLS_D) /* {{{ */
|
||||
|
||||
void zend_do_ticks(TSRMLS_D) /* {{{ */
|
||||
{
|
||||
zend_op *opline;
|
||||
|
||||
/* This prevents a double TICK generated by the parser statement of "declare()" */
|
||||
if (CG(active_op_array)->last && CG(active_op_array)->opcodes[CG(active_op_array)->last - 1].opcode == ZEND_TICKS) {
|
||||
return;
|
||||
}
|
||||
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
|
||||
opline->opcode = ZEND_TICKS;
|
||||
SET_UNUSED(opline->op1);
|
||||
|
||||
+8
-37
@@ -41,7 +41,7 @@ void zend_exception_set_previous(zval *exception, zval *add_previous TSRMLS_DC)
|
||||
if (exception == add_previous || !add_previous || !exception) {
|
||||
return;
|
||||
}
|
||||
if (Z_TYPE_P(add_previous) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(add_previous), default_exception_ce TSRMLS_CC)) {
|
||||
if (Z_TYPE_P(add_previous) != IS_OBJECT && !instanceof_function(Z_OBJCE_P(add_previous), default_exception_ce TSRMLS_CC)) {
|
||||
zend_error(E_ERROR, "Cannot set non exception as previous exception");
|
||||
return;
|
||||
}
|
||||
@@ -218,33 +218,6 @@ ZEND_METHOD(exception, __construct)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto Exception::__wakeup()
|
||||
Exception unserialize checks */
|
||||
#define CHECK_EXC_TYPE(name, type) \
|
||||
value = zend_read_property(default_exception_ce, object, name, sizeof(name)-1, 0 TSRMLS_CC); \
|
||||
if(value && Z_TYPE_P(value) != type) { \
|
||||
zval *tmp; \
|
||||
MAKE_STD_ZVAL(tmp); \
|
||||
ZVAL_STRINGL(tmp, name, sizeof(name)-1, 1); \
|
||||
Z_OBJ_HANDLER_P(object, unset_property)(object, tmp, 0 TSRMLS_CC); \
|
||||
zval_ptr_dtor(&tmp); \
|
||||
}
|
||||
|
||||
ZEND_METHOD(exception, __wakeup)
|
||||
{
|
||||
zval *value;
|
||||
zval *object = getThis();
|
||||
HashTable *intern_ht = zend_std_get_properties(getThis() TSRMLS_CC);
|
||||
CHECK_EXC_TYPE("message", IS_STRING);
|
||||
CHECK_EXC_TYPE("string", IS_STRING);
|
||||
CHECK_EXC_TYPE("code", IS_LONG);
|
||||
CHECK_EXC_TYPE("file", IS_STRING);
|
||||
CHECK_EXC_TYPE("line", IS_LONG);
|
||||
CHECK_EXC_TYPE("trace", IS_ARRAY);
|
||||
CHECK_EXC_TYPE("previous", IS_OBJECT);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto ErrorException::__construct(string message, int code, int severity [, string filename [, int lineno [, Exception previous]]])
|
||||
ErrorException constructor */
|
||||
ZEND_METHOD(error_exception, __construct)
|
||||
@@ -613,7 +586,7 @@ ZEND_METHOD(exception, getTraceAsString)
|
||||
int res_len = 0, *len = &res_len, num = 0;
|
||||
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
|
||||
trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC);
|
||||
if (Z_TYPE_P(trace) != IS_ARRAY) {
|
||||
RETURN_FALSE;
|
||||
@@ -629,8 +602,8 @@ ZEND_METHOD(exception, getTraceAsString)
|
||||
TRACE_APPEND_STRL(s_tmp, strlen(s_tmp));
|
||||
efree(s_tmp);
|
||||
|
||||
res[res_len] = '\0';
|
||||
RETURN_STRINGL(res, res_len, 0);
|
||||
res[res_len] = '\0';
|
||||
RETURN_STRINGL(res, res_len, 0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -667,15 +640,15 @@ ZEND_METHOD(exception, __toString)
|
||||
int len = 0;
|
||||
zend_fcall_info fci;
|
||||
zval fname;
|
||||
|
||||
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
|
||||
str = estrndup("", 0);
|
||||
|
||||
exception = getThis();
|
||||
ZVAL_STRINGL(&fname, "gettraceasstring", sizeof("gettraceasstring")-1, 1);
|
||||
|
||||
while (exception && Z_TYPE_P(exception) == IS_OBJECT && instanceof_function(Z_OBJCE_P(exception), default_exception_ce TSRMLS_CC)) {
|
||||
while (exception && Z_TYPE_P(exception) == IS_OBJECT) {
|
||||
prev_str = str;
|
||||
_default_exception_get_entry(exception, "message", sizeof("message")-1, &message TSRMLS_CC);
|
||||
_default_exception_get_entry(exception, "file", sizeof("file")-1, &file TSRMLS_CC);
|
||||
@@ -685,7 +658,6 @@ ZEND_METHOD(exception, __toString)
|
||||
convert_to_string(&file);
|
||||
convert_to_long(&line);
|
||||
|
||||
trace = NULL;
|
||||
fci.size = sizeof(fci);
|
||||
fci.function_table = &Z_OBJCE_P(exception)->function_table;
|
||||
fci.function_name = &fname;
|
||||
@@ -698,7 +670,7 @@ ZEND_METHOD(exception, __toString)
|
||||
|
||||
zend_call_function(&fci, NULL TSRMLS_CC);
|
||||
|
||||
if (trace && Z_TYPE_P(trace) != IS_STRING) {
|
||||
if (Z_TYPE_P(trace) != IS_STRING) {
|
||||
zval_ptr_dtor(&trace);
|
||||
trace = NULL;
|
||||
}
|
||||
@@ -755,7 +727,6 @@ ZEND_END_ARG_INFO()
|
||||
const static zend_function_entry default_exception_functions[] = {
|
||||
ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
|
||||
ZEND_ME(exception, __construct, arginfo_exception___construct, ZEND_ACC_PUBLIC)
|
||||
ZEND_ME(exception, __wakeup, NULL, ZEND_ACC_PUBLIC)
|
||||
ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
|
||||
ZEND_ME(exception, getCode, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
|
||||
ZEND_ME(exception, getFile, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
|
||||
|
||||
@@ -198,9 +198,6 @@ static void zend_generator_dtor_storage(zend_generator *generator, zend_object_h
|
||||
if (finally_op_num) {
|
||||
ex->opline = &ex->op_array->opcodes[finally_op_num];
|
||||
ex->fast_ret = NULL;
|
||||
ex->delayed_exception = EG(exception);
|
||||
EG(exception) = NULL;
|
||||
|
||||
generator->flags |= ZEND_GENERATOR_FORCED_CLOSE;
|
||||
zend_generator_resume(generator TSRMLS_CC);
|
||||
}
|
||||
|
||||
+3
-2
@@ -1446,10 +1446,11 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t co
|
||||
}
|
||||
if (ordered) {
|
||||
if (p1->nKeyLength==0 && p2->nKeyLength==0) { /* numeric indices */
|
||||
if (p1->h != p2->h) {
|
||||
result = p1->h - p2->h;
|
||||
if (result!=0) {
|
||||
HASH_UNPROTECT_RECURSION(ht1);
|
||||
HASH_UNPROTECT_RECURSION(ht2);
|
||||
return p1->h > p2->h ? 1 : -1;
|
||||
return result;
|
||||
}
|
||||
} else { /* string indices */
|
||||
result = p1->nKeyLength - p2->nKeyLength;
|
||||
|
||||
+3
-18
@@ -108,18 +108,7 @@ static void zend_ini_init_string(zval *result)
|
||||
*/
|
||||
static void zend_ini_add_string(zval *result, zval *op1, zval *op2)
|
||||
{
|
||||
int length;
|
||||
|
||||
if (Z_TYPE_P(op1) != IS_STRING) {
|
||||
zval copy;
|
||||
MAKE_COPY_ZVAL(&op1, ©);
|
||||
convert_to_string(©);
|
||||
Z_STRVAL_P(op1) = zend_strndup(Z_STRVAL(copy), Z_STRLEN(copy));
|
||||
Z_STRLEN_P(op1) = Z_STRLEN(copy);
|
||||
zval_dtor(©);
|
||||
}
|
||||
|
||||
length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2);
|
||||
int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2);
|
||||
|
||||
Z_STRVAL_P(result) = (char *) realloc(Z_STRVAL_P(op1), length+1);
|
||||
memcpy(Z_STRVAL_P(result)+Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
|
||||
@@ -224,7 +213,7 @@ ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_erro
|
||||
zend_file_handle_dtor(fh TSRMLS_CC);
|
||||
|
||||
shutdown_ini_scanner(TSRMLS_C);
|
||||
|
||||
|
||||
if (retval == 0) {
|
||||
return SUCCESS;
|
||||
} else {
|
||||
@@ -314,11 +303,7 @@ statement:
|
||||
#endif
|
||||
ZEND_INI_PARSER_CB(&$1, &$5, &$2, ZEND_INI_PARSER_POP_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC);
|
||||
free(Z_STRVAL($1));
|
||||
if (Z_TYPE($2) == IS_STRING) {
|
||||
free(Z_STRVAL($2));
|
||||
} else {
|
||||
zval_dtor(&$2);
|
||||
}
|
||||
free(Z_STRVAL($2));
|
||||
zval_internal_dtor(&$5);
|
||||
}
|
||||
| TC_LABEL { ZEND_INI_PARSER_CB(&$1, NULL, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC); free(Z_STRVAL($1)); }
|
||||
|
||||
@@ -2029,7 +2029,7 @@ end_raw_value_chars:
|
||||
}
|
||||
|
||||
/* Eat leading and trailing double quotes */
|
||||
if (yyleng > 1 && yytext[0] == '"' && yytext[yyleng - 1] == '"') {
|
||||
if (yytext[0] == '"' && yytext[yyleng - 1] == '"') {
|
||||
SCNG(yy_text)++;
|
||||
yyleng = yyleng - 2;
|
||||
} else if (sc) {
|
||||
|
||||
@@ -523,7 +523,7 @@ end_raw_value_chars:
|
||||
}
|
||||
|
||||
/* Eat leading and trailing double quotes */
|
||||
if (yyleng > 1 && yytext[0] == '"' && yytext[yyleng - 1] == '"') {
|
||||
if (yytext[0] == '"' && yytext[yyleng - 1] == '"') {
|
||||
SCNG(yy_text)++;
|
||||
yyleng = yyleng - 2;
|
||||
} else if (sc) {
|
||||
|
||||
+12
-17
@@ -1753,9 +1753,7 @@ ZEND_VM_HANDLER(38, ZEND_ASSIGN, VAR|CV, CONST|TMP|VAR|CV)
|
||||
}
|
||||
}
|
||||
|
||||
if (OP1_TYPE == IS_VAR && OP1_FREE) {
|
||||
zval_ptr_dtor_nogc(&value);
|
||||
}
|
||||
FREE_OP1_VAR_PTR();
|
||||
|
||||
/* zend_assign_to_variable() always takes care of op2, never free it! */
|
||||
FREE_OP2_IF_VAR();
|
||||
@@ -1774,10 +1772,6 @@ ZEND_VM_HANDLER(39, ZEND_ASSIGN_REF, VAR|CV, VAR|CV)
|
||||
SAVE_OPLINE();
|
||||
value_ptr_ptr = GET_OP2_ZVAL_PTR_PTR(BP_VAR_W);
|
||||
|
||||
if (OP1_TYPE == IS_VAR && UNEXPECTED(EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
|
||||
}
|
||||
|
||||
if (OP2_TYPE == IS_VAR &&
|
||||
value_ptr_ptr &&
|
||||
!Z_ISREF_PP(value_ptr_ptr) &&
|
||||
@@ -1795,6 +1789,9 @@ ZEND_VM_HANDLER(39, ZEND_ASSIGN_REF, VAR|CV, VAR|CV)
|
||||
} else if (OP2_TYPE == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) {
|
||||
PZVAL_LOCK(*value_ptr_ptr);
|
||||
}
|
||||
if (OP1_TYPE == IS_VAR && UNEXPECTED(EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
|
||||
}
|
||||
|
||||
variable_ptr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
|
||||
if ((OP2_TYPE == IS_VAR && UNEXPECTED(value_ptr_ptr == NULL)) ||
|
||||
@@ -1890,7 +1887,7 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
|
||||
|
||||
EX(call)--;
|
||||
|
||||
zend_vm_stack_clear_multiple(0 TSRMLS_CC);
|
||||
zend_vm_stack_clear_multiple(1 TSRMLS_CC);
|
||||
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
zend_throw_exception_internal(NULL TSRMLS_CC);
|
||||
@@ -2078,7 +2075,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
|
||||
|
||||
EX(call)--;
|
||||
|
||||
zend_vm_stack_clear_multiple(0 TSRMLS_CC);
|
||||
zend_vm_stack_clear_multiple(1 TSRMLS_CC);
|
||||
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
zend_throw_exception_internal(NULL TSRMLS_CC);
|
||||
@@ -5428,6 +5425,7 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED)
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_function *op_array;
|
||||
int closure_is_static, closure_is_being_defined_inside_static_context;
|
||||
|
||||
SAVE_OPLINE();
|
||||
|
||||
@@ -5436,9 +5434,9 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED)
|
||||
zend_error_noreturn(E_ERROR, "Base lambda function for closure not found");
|
||||
}
|
||||
|
||||
if (UNEXPECTED((op_array->common.fn_flags & ZEND_ACC_STATIC) ||
|
||||
(EX(prev_execute_data) &&
|
||||
EX(prev_execute_data)->function_state.function->common.fn_flags & ZEND_ACC_STATIC))) {
|
||||
closure_is_static = op_array->common.fn_flags & ZEND_ACC_STATIC;
|
||||
closure_is_being_defined_inside_static_context = EX(prev_execute_data) && EX(prev_execute_data)->function_state.function->common.fn_flags & ZEND_ACC_STATIC;
|
||||
if (closure_is_static || closure_is_being_defined_inside_static_context) {
|
||||
zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(called_scope), NULL TSRMLS_CC);
|
||||
} else {
|
||||
zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(scope), EG(This) TSRMLS_CC);
|
||||
@@ -5651,11 +5649,8 @@ ZEND_VM_HANDLER(162, ZEND_FAST_CALL, ANY, ANY)
|
||||
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->op2.opline_num]);
|
||||
ZEND_VM_CONTINUE();
|
||||
}
|
||||
if (UNEXPECTED(EX(delayed_exception) != NULL)) {
|
||||
EX(fast_ret) = NULL;
|
||||
} else {
|
||||
EX(fast_ret) = opline;
|
||||
}
|
||||
EX(fast_ret) = opline;
|
||||
EX(delayed_exception) = NULL;
|
||||
ZEND_VM_SET_OPCODE(opline->op1.jmp_addr);
|
||||
ZEND_VM_CONTINUE();
|
||||
}
|
||||
|
||||
+24
-54
@@ -459,7 +459,7 @@ static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
|
||||
|
||||
EX(call)--;
|
||||
|
||||
zend_vm_stack_clear_multiple(0 TSRMLS_CC);
|
||||
zend_vm_stack_clear_multiple(1 TSRMLS_CC);
|
||||
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
zend_throw_exception_internal(NULL TSRMLS_CC);
|
||||
@@ -647,7 +647,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
|
||||
|
||||
EX(call)--;
|
||||
|
||||
zend_vm_stack_clear_multiple(0 TSRMLS_CC);
|
||||
zend_vm_stack_clear_multiple(1 TSRMLS_CC);
|
||||
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
zend_throw_exception_internal(NULL TSRMLS_CC);
|
||||
@@ -1354,11 +1354,8 @@ static int ZEND_FASTCALL ZEND_FAST_CALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->op2.opline_num]);
|
||||
ZEND_VM_CONTINUE();
|
||||
}
|
||||
if (UNEXPECTED(EX(delayed_exception) != NULL)) {
|
||||
EX(fast_ret) = NULL;
|
||||
} else {
|
||||
EX(fast_ret) = opline;
|
||||
}
|
||||
EX(fast_ret) = opline;
|
||||
EX(delayed_exception) = NULL;
|
||||
ZEND_VM_SET_OPCODE(opline->op1.jmp_addr);
|
||||
ZEND_VM_CONTINUE();
|
||||
}
|
||||
@@ -6804,6 +6801,7 @@ static int ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_CONST_UNUSED_HANDLER
|
||||
{
|
||||
USE_OPLINE
|
||||
zend_function *op_array;
|
||||
int closure_is_static, closure_is_being_defined_inside_static_context;
|
||||
|
||||
SAVE_OPLINE();
|
||||
|
||||
@@ -6812,9 +6810,9 @@ static int ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_CONST_UNUSED_HANDLER
|
||||
zend_error_noreturn(E_ERROR, "Base lambda function for closure not found");
|
||||
}
|
||||
|
||||
if (UNEXPECTED((op_array->common.fn_flags & ZEND_ACC_STATIC) ||
|
||||
(EX(prev_execute_data) &&
|
||||
EX(prev_execute_data)->function_state.function->common.fn_flags & ZEND_ACC_STATIC))) {
|
||||
closure_is_static = op_array->common.fn_flags & ZEND_ACC_STATIC;
|
||||
closure_is_being_defined_inside_static_context = EX(prev_execute_data) && EX(prev_execute_data)->function_state.function->common.fn_flags & ZEND_ACC_STATIC;
|
||||
if (closure_is_static || closure_is_being_defined_inside_static_context) {
|
||||
zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(called_scope), NULL TSRMLS_CC);
|
||||
} else {
|
||||
zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(scope), EG(This) TSRMLS_CC);
|
||||
@@ -15695,9 +15693,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_VAR == IS_VAR && (free_op1.var != NULL)) {
|
||||
zval_ptr_dtor_nogc(&value);
|
||||
}
|
||||
if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
|
||||
|
||||
/* zend_assign_to_variable() always takes care of op2, never free it! */
|
||||
|
||||
@@ -18048,9 +18044,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_VAR == IS_VAR && (free_op1.var != NULL)) {
|
||||
zval_ptr_dtor_nogc(&value);
|
||||
}
|
||||
if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
|
||||
|
||||
/* zend_assign_to_variable() always takes care of op2, never free it! */
|
||||
|
||||
@@ -20310,9 +20304,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_A
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_VAR == IS_VAR && (free_op1.var != NULL)) {
|
||||
zval_ptr_dtor_nogc(&value);
|
||||
}
|
||||
if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
|
||||
|
||||
/* zend_assign_to_variable() always takes care of op2, never free it! */
|
||||
zval_ptr_dtor_nogc(&free_op2.var);
|
||||
@@ -20331,10 +20323,6 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL
|
||||
SAVE_OPLINE();
|
||||
value_ptr_ptr = _get_zval_ptr_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
|
||||
|
||||
if (IS_VAR == IS_VAR && UNEXPECTED(EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
|
||||
}
|
||||
|
||||
if (IS_VAR == IS_VAR &&
|
||||
value_ptr_ptr &&
|
||||
!Z_ISREF_PP(value_ptr_ptr) &&
|
||||
@@ -20352,6 +20340,9 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL
|
||||
} else if (IS_VAR == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) {
|
||||
PZVAL_LOCK(*value_ptr_ptr);
|
||||
}
|
||||
if (IS_VAR == IS_VAR && UNEXPECTED(EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
|
||||
}
|
||||
|
||||
variable_ptr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
|
||||
if ((IS_VAR == IS_VAR && UNEXPECTED(value_ptr_ptr == NULL)) ||
|
||||
@@ -23782,9 +23773,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_AR
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_VAR == IS_VAR && (free_op1.var != NULL)) {
|
||||
zval_ptr_dtor_nogc(&value);
|
||||
}
|
||||
if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
|
||||
|
||||
/* zend_assign_to_variable() always takes care of op2, never free it! */
|
||||
|
||||
@@ -23802,10 +23791,6 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE
|
||||
SAVE_OPLINE();
|
||||
value_ptr_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op2.var TSRMLS_CC);
|
||||
|
||||
if (IS_VAR == IS_VAR && UNEXPECTED(EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
|
||||
}
|
||||
|
||||
if (IS_CV == IS_VAR &&
|
||||
value_ptr_ptr &&
|
||||
!Z_ISREF_PP(value_ptr_ptr) &&
|
||||
@@ -23823,6 +23808,9 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE
|
||||
} else if (IS_CV == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) {
|
||||
PZVAL_LOCK(*value_ptr_ptr);
|
||||
}
|
||||
if (IS_VAR == IS_VAR && UNEXPECTED(EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
|
||||
}
|
||||
|
||||
variable_ptr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
|
||||
if ((IS_CV == IS_VAR && UNEXPECTED(value_ptr_ptr == NULL)) ||
|
||||
@@ -33224,10 +33212,6 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_CV == IS_VAR && 0) {
|
||||
zval_ptr_dtor_nogc(&value);
|
||||
}
|
||||
|
||||
/* zend_assign_to_variable() always takes care of op2, never free it! */
|
||||
|
||||
CHECK_EXCEPTION();
|
||||
@@ -35348,10 +35332,6 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_CV == IS_VAR && 0) {
|
||||
zval_ptr_dtor_nogc(&value);
|
||||
}
|
||||
|
||||
/* zend_assign_to_variable() always takes care of op2, never free it! */
|
||||
|
||||
CHECK_EXCEPTION();
|
||||
@@ -37473,10 +37453,6 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_CV == IS_VAR && 0) {
|
||||
zval_ptr_dtor_nogc(&value);
|
||||
}
|
||||
|
||||
/* zend_assign_to_variable() always takes care of op2, never free it! */
|
||||
zval_ptr_dtor_nogc(&free_op2.var);
|
||||
|
||||
@@ -37494,10 +37470,6 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE
|
||||
SAVE_OPLINE();
|
||||
value_ptr_ptr = _get_zval_ptr_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
|
||||
|
||||
if (IS_CV == IS_VAR && UNEXPECTED(EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
|
||||
}
|
||||
|
||||
if (IS_VAR == IS_VAR &&
|
||||
value_ptr_ptr &&
|
||||
!Z_ISREF_PP(value_ptr_ptr) &&
|
||||
@@ -37515,6 +37487,9 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE
|
||||
} else if (IS_VAR == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) {
|
||||
PZVAL_LOCK(*value_ptr_ptr);
|
||||
}
|
||||
if (IS_CV == IS_VAR && UNEXPECTED(EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
|
||||
}
|
||||
|
||||
variable_ptr_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
|
||||
if ((IS_VAR == IS_VAR && UNEXPECTED(value_ptr_ptr == NULL)) ||
|
||||
@@ -40658,10 +40633,6 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_CV == IS_VAR && 0) {
|
||||
zval_ptr_dtor_nogc(&value);
|
||||
}
|
||||
|
||||
/* zend_assign_to_variable() always takes care of op2, never free it! */
|
||||
|
||||
CHECK_EXCEPTION();
|
||||
@@ -40678,10 +40649,6 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER
|
||||
SAVE_OPLINE();
|
||||
value_ptr_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op2.var TSRMLS_CC);
|
||||
|
||||
if (IS_CV == IS_VAR && UNEXPECTED(EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
|
||||
}
|
||||
|
||||
if (IS_CV == IS_VAR &&
|
||||
value_ptr_ptr &&
|
||||
!Z_ISREF_PP(value_ptr_ptr) &&
|
||||
@@ -40699,6 +40666,9 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER
|
||||
} else if (IS_CV == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) {
|
||||
PZVAL_LOCK(*value_ptr_ptr);
|
||||
}
|
||||
if (IS_CV == IS_VAR && UNEXPECTED(EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr)) {
|
||||
zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
|
||||
}
|
||||
|
||||
variable_ptr_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
|
||||
if ((IS_CV == IS_VAR && UNEXPECTED(value_ptr_ptr == NULL)) ||
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=6
|
||||
PHP_RELEASE_VERSION=13
|
||||
PHP_RELEASE_VERSION=9
|
||||
PHP_EXTRA_VERSION=""
|
||||
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
#else
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#define TIMELIB_SUPPORTS_V2DATA
|
||||
#include "timezonedb.h"
|
||||
|
||||
#if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__))
|
||||
|
||||
+27565
-29093
File diff suppressed because it is too large.
Load diff
+67
-82
@@ -383,7 +383,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_date_period_construct, 0, 0, 3)
|
||||
ZEND_ARG_INFO(0, end)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_date_interval_construct, 0, 0, 1)
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_date_interval_construct, 0, 0, 0)
|
||||
ZEND_ARG_INFO(0, interval_spec)
|
||||
ZEND_END_ARG_INFO()
|
||||
/* }}} */
|
||||
@@ -601,7 +601,7 @@ static zend_object_handlers date_object_handlers_period;
|
||||
#define DATE_SET_CONTEXT \
|
||||
zval *object; \
|
||||
object = getThis(); \
|
||||
|
||||
|
||||
#define DATE_FETCH_OBJECT \
|
||||
php_date_obj *obj; \
|
||||
DATE_SET_CONTEXT; \
|
||||
@@ -770,7 +770,7 @@ PHP_RSHUTDOWN_FUNCTION(date)
|
||||
* RFC2822, Section 3.3: http://www.ietf.org/rfc/rfc2822.txt
|
||||
* FWS = ([*WSP CRLF] 1*WSP) / ; Folding white space
|
||||
* CFWS = *([FWS] comment) (([FWS] comment) / FWS)
|
||||
*
|
||||
*
|
||||
* date-time = [ day-of-week "," ] date FWS time [CFWS]
|
||||
* day-of-week = ([FWS] day-name)
|
||||
* day-name = "Mon" / "Tue" / "Wed" / "Thu" / "Fri" / "Sat" / "Sun"
|
||||
@@ -792,19 +792,19 @@ PHP_RSHUTDOWN_FUNCTION(date)
|
||||
* date-fullyear = 4DIGIT
|
||||
* date-month = 2DIGIT ; 01-12
|
||||
* date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on month/year
|
||||
*
|
||||
*
|
||||
* time-hour = 2DIGIT ; 00-23
|
||||
* time-minute = 2DIGIT ; 00-59
|
||||
* time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second rules
|
||||
*
|
||||
*
|
||||
* time-secfrac = "." 1*DIGIT
|
||||
* time-numoffset = ("+" / "-") time-hour ":" time-minute
|
||||
* time-offset = "Z" / time-numoffset
|
||||
*
|
||||
*
|
||||
* partial-time = time-hour ":" time-minute ":" time-second [time-secfrac]
|
||||
* full-date = date-fullyear "-" date-month "-" date-mday
|
||||
* full-time = partial-time time-offset
|
||||
*
|
||||
*
|
||||
* date-time = full-date "T" full-time
|
||||
*/
|
||||
#define DATE_FORMAT_RFC3339 "Y-m-d\\TH:i:sP"
|
||||
@@ -885,10 +885,6 @@ PHP_MSHUTDOWN_FUNCTION(date)
|
||||
timelib_error_container_dtor(DATEG(last_errors));
|
||||
}
|
||||
|
||||
#ifndef ZTS
|
||||
DATEG(default_timezone) = NULL;
|
||||
#endif
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -897,7 +893,7 @@ PHP_MSHUTDOWN_FUNCTION(date)
|
||||
PHP_MINFO_FUNCTION(date)
|
||||
{
|
||||
const timelib_tzdb *tzdb = DATE_TIMEZONEDB;
|
||||
|
||||
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_row(2, "date/time support", "enabled");
|
||||
php_info_print_table_row(2, "\"Olson\" Timezone Database Version", tzdb->version);
|
||||
@@ -1049,8 +1045,8 @@ char *php_date_full_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
|
||||
timelib_sll day_of_week = timelib_day_of_week(y, m, d);
|
||||
if (day_of_week < 0) {
|
||||
return "Unknown";
|
||||
}
|
||||
return day_full_names[day_of_week];
|
||||
}
|
||||
return day_full_names[day_of_week];
|
||||
}
|
||||
|
||||
char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
|
||||
@@ -1058,8 +1054,8 @@ char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
|
||||
timelib_sll day_of_week = timelib_day_of_week(y, m, d);
|
||||
if (day_of_week < 0) {
|
||||
return "Unknown";
|
||||
}
|
||||
return day_short_names[day_of_week];
|
||||
}
|
||||
return day_short_names[day_of_week];
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1091,7 +1087,7 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
|
||||
offset->leap_secs = 0;
|
||||
offset->is_dst = 0;
|
||||
offset->abbr = malloc(9); /* GMT�xxxx\0 */
|
||||
snprintf(offset->abbr, 9, "GMT%c%02d%02d",
|
||||
snprintf(offset->abbr, 9, "GMT%c%02d%02d",
|
||||
localtime ? ((offset->offset < 0) ? '-' : '+') : '+',
|
||||
localtime ? abs(offset->offset / 3600) : 0,
|
||||
localtime ? abs((offset->offset % 3600) / 60) : 0 );
|
||||
@@ -1137,7 +1133,7 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
|
||||
case 'a': length = slprintf(buffer, 32, "%s", t->h >= 12 ? "pm" : "am"); break;
|
||||
case 'A': length = slprintf(buffer, 32, "%s", t->h >= 12 ? "PM" : "AM"); break;
|
||||
case 'B': {
|
||||
int retval = (((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10) / 864);
|
||||
int retval = (((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10) / 864);
|
||||
while (retval < 0) {
|
||||
retval += 1000;
|
||||
}
|
||||
@@ -1237,7 +1233,7 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime)
|
||||
}
|
||||
|
||||
string = php_format_date(format, format_len, ts, localtime TSRMLS_CC);
|
||||
|
||||
|
||||
RETVAL_STRING(string, 0);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1261,7 +1257,7 @@ PHPAPI char *php_format_date(char *format, int format_len, time_t ts, int localt
|
||||
}
|
||||
|
||||
string = date_format(format, format_len, t, localtime);
|
||||
|
||||
|
||||
timelib_time_dtor(t);
|
||||
return string;
|
||||
}
|
||||
@@ -1302,7 +1298,7 @@ PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC)
|
||||
offset->leap_secs = 0;
|
||||
offset->is_dst = t->dst;
|
||||
offset->abbr = malloc(9); /* GMT�xxxx\0 */
|
||||
snprintf(offset->abbr, 9, "GMT%c%02d%02d",
|
||||
snprintf(offset->abbr, 9, "GMT%c%02d%02d",
|
||||
!localtime ? ((offset->offset < 0) ? '-' : '+') : '+',
|
||||
!localtime ? abs(offset->offset / 3600) : 0,
|
||||
!localtime ? abs((offset->offset % 3600) / 60) : 0 );
|
||||
@@ -1334,7 +1330,7 @@ PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC)
|
||||
|
||||
/* Swatch Beat a.k.a. Internet Time */
|
||||
case 'B':
|
||||
retval = (((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10) / 864);
|
||||
retval = (((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10) / 864);
|
||||
while (retval < 0) {
|
||||
retval += 1000;
|
||||
}
|
||||
@@ -1386,7 +1382,7 @@ PHP_FUNCTION(idate)
|
||||
char *format;
|
||||
int format_len;
|
||||
long ts = 0;
|
||||
int ret;
|
||||
int ret;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
@@ -1414,7 +1410,7 @@ PHP_FUNCTION(idate)
|
||||
PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb)
|
||||
{
|
||||
const timelib_tzdb *builtin = timelib_builtin_db();
|
||||
|
||||
|
||||
if (php_version_compare(tzdb->version, builtin->version) > 0) {
|
||||
php_date_global_timezone_db = tzdb;
|
||||
php_date_global_timezone_db_enabled = 1;
|
||||
@@ -1485,7 +1481,7 @@ PHP_FUNCTION(strtotime)
|
||||
}
|
||||
|
||||
if (!time_len) {
|
||||
timelib_time_dtor(now);
|
||||
timelib_time_dtor(now);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1934,7 +1930,7 @@ static void date_period_it_current_data(zend_object_iterator *iter, zval ***data
|
||||
if (it_time->tz_info) {
|
||||
newdateobj->time->tz_info = it_time->tz_info;
|
||||
}
|
||||
|
||||
|
||||
*data = &iterator->current;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2128,13 +2124,13 @@ static inline zend_object_value date_object_new_date_ex(zend_class_entry *class_
|
||||
if (ptr) {
|
||||
*ptr = intern;
|
||||
}
|
||||
|
||||
|
||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||
object_properties_init(&intern->std, class_type);
|
||||
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_date, NULL TSRMLS_CC);
|
||||
retval.handlers = &date_object_handlers_date;
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -2148,12 +2144,12 @@ static zend_object_value date_object_clone_date(zval *this_ptr TSRMLS_DC)
|
||||
php_date_obj *new_obj = NULL;
|
||||
php_date_obj *old_obj = (php_date_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
|
||||
zend_object_value new_ov = date_object_new_date_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
|
||||
|
||||
|
||||
zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
|
||||
if (!old_obj->time) {
|
||||
return new_ov;
|
||||
}
|
||||
|
||||
|
||||
/* this should probably moved to a new `timelib_time *timelime_time_clone(timelib_time *)` */
|
||||
new_obj->time = timelib_time_ctor();
|
||||
*new_obj->time = *old_obj->time;
|
||||
@@ -2163,7 +2159,7 @@ static zend_object_value date_object_clone_date(zval *this_ptr TSRMLS_DC)
|
||||
if (old_obj->time->tz_info) {
|
||||
new_obj->time->tz_info = old_obj->time->tz_info;
|
||||
}
|
||||
|
||||
|
||||
return new_ov;
|
||||
}
|
||||
|
||||
@@ -2280,10 +2276,10 @@ static inline zend_object_value date_object_new_timezone_ex(zend_class_entry *cl
|
||||
|
||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||
object_properties_init(&intern->std, class_type);
|
||||
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_timezone, NULL TSRMLS_CC);
|
||||
retval.handlers = &date_object_handlers_timezone;
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -2297,12 +2293,12 @@ static zend_object_value date_object_clone_timezone(zval *this_ptr TSRMLS_DC)
|
||||
php_timezone_obj *new_obj = NULL;
|
||||
php_timezone_obj *old_obj = (php_timezone_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
|
||||
zend_object_value new_ov = date_object_new_timezone_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
|
||||
|
||||
|
||||
zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
|
||||
if (!old_obj->initialized) {
|
||||
return new_ov;
|
||||
}
|
||||
|
||||
|
||||
new_obj->type = old_obj->type;
|
||||
new_obj->initialized = 1;
|
||||
switch (new_obj->type) {
|
||||
@@ -2318,7 +2314,7 @@ static zend_object_value date_object_clone_timezone(zval *this_ptr TSRMLS_DC)
|
||||
new_obj->tzi.z.abbr = strdup(old_obj->tzi.z.abbr);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return new_ov;
|
||||
}
|
||||
|
||||
@@ -2379,10 +2375,10 @@ static inline zend_object_value date_object_new_interval_ex(zend_class_entry *cl
|
||||
|
||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||
object_properties_init(&intern->std, class_type);
|
||||
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_interval, NULL TSRMLS_CC);
|
||||
retval.handlers = &date_object_handlers_interval;
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -2396,7 +2392,7 @@ static zend_object_value date_object_clone_interval(zval *this_ptr TSRMLS_DC)
|
||||
php_interval_obj *new_obj = NULL;
|
||||
php_interval_obj *old_obj = (php_interval_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
|
||||
zend_object_value new_ov = date_object_new_interval_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
|
||||
|
||||
|
||||
zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
|
||||
|
||||
/** FIX ME ADD CLONE STUFF **/
|
||||
@@ -2468,10 +2464,10 @@ static inline zend_object_value date_object_new_period_ex(zend_class_entry *clas
|
||||
|
||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||
object_properties_init(&intern->std, class_type);
|
||||
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_period, NULL TSRMLS_CC);
|
||||
retval.handlers = &date_object_handlers_period;
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -2485,7 +2481,7 @@ static zend_object_value date_object_clone_period(zval *this_ptr TSRMLS_DC)
|
||||
php_period_obj *new_obj = NULL;
|
||||
php_period_obj *old_obj = (php_period_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
|
||||
zend_object_value new_ov = date_object_new_period_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
|
||||
|
||||
|
||||
zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
|
||||
|
||||
/** FIX ME ADD CLONE STUFF **/
|
||||
@@ -2571,7 +2567,7 @@ PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str,
|
||||
int type = TIMELIB_ZONETYPE_ID, new_dst = 0;
|
||||
char *new_abbr = NULL;
|
||||
timelib_sll new_offset;
|
||||
|
||||
|
||||
if (dateobj->time) {
|
||||
timelib_time_dtor(dateobj->time);
|
||||
}
|
||||
@@ -2970,7 +2966,7 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time *
|
||||
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(hour, h);
|
||||
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(minute, i);
|
||||
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(second, s);
|
||||
|
||||
|
||||
if (parsed_time->f == -99999) {
|
||||
add_assoc_bool(return_value, "fraction", 0);
|
||||
} else {
|
||||
@@ -3037,7 +3033,7 @@ PHP_FUNCTION(date_parse)
|
||||
int date_len;
|
||||
struct timelib_error_container *error;
|
||||
timelib_time *parsed_time;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &date, &date_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3056,7 +3052,7 @@ PHP_FUNCTION(date_parse_from_format)
|
||||
int date_len, format_len;
|
||||
struct timelib_error_container *error;
|
||||
timelib_time *parsed_time;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &format, &format_len, &date, &date_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3540,7 +3536,7 @@ static void php_date_isodate_set(zval *object, long y, long w, long d, zval *ret
|
||||
memset(&dateobj->time->relative, 0, sizeof(dateobj->time->relative));
|
||||
dateobj->time->relative.d = timelib_daynr_from_weeknr(y, w, d);
|
||||
dateobj->time->have_relative = 1;
|
||||
|
||||
|
||||
timelib_update_ts(dateobj->time, NULL);
|
||||
}
|
||||
|
||||
@@ -3682,17 +3678,12 @@ PHP_FUNCTION(date_diff)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int timezone_initialize(php_timezone_obj *tzobj, /*const*/ char *tz, size_t tz_len TSRMLS_DC)
|
||||
static int timezone_initialize(php_timezone_obj *tzobj, /*const*/ char *tz TSRMLS_DC)
|
||||
{
|
||||
timelib_time *dummy_t = ecalloc(1, sizeof(timelib_time));
|
||||
int dst, not_found;
|
||||
char *orig_tz = tz;
|
||||
|
||||
if (strlen(tz) != tz_len) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Timezone must not contain null bytes");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
dummy_t->z = timelib_parse_zone(&tz, &dst, dummy_t, ¬_found, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
|
||||
if (not_found) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or bad timezone (%s)", orig_tz);
|
||||
@@ -3719,7 +3710,7 @@ PHP_FUNCTION(timezone_open)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
tzobj = zend_object_store_get_object(php_date_instantiate(date_ce_timezone, return_value TSRMLS_CC) TSRMLS_CC);
|
||||
if (SUCCESS != timezone_initialize(tzobj, tz, tz_len TSRMLS_CC)) {
|
||||
if (SUCCESS != timezone_initialize(tzobj, tz TSRMLS_CC)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -3734,11 +3725,11 @@ PHP_METHOD(DateTimeZone, __construct)
|
||||
int tz_len;
|
||||
php_timezone_obj *tzobj;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
|
||||
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len)) {
|
||||
tzobj = zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
if (FAILURE == timezone_initialize(tzobj, tz, tz_len TSRMLS_CC)) {
|
||||
if (FAILURE == timezone_initialize(tzobj, tz TSRMLS_CC)) {
|
||||
ZVAL_NULL(getThis());
|
||||
}
|
||||
}
|
||||
@@ -3753,7 +3744,7 @@ static int php_date_timezone_initialize_from_hash(zval **return_value, php_timez
|
||||
|
||||
if (zend_hash_find(myht, "timezone_type", 14, (void**) &z_timezone_type) == SUCCESS && Z_TYPE_PP(z_timezone_type) == IS_LONG) {
|
||||
if (zend_hash_find(myht, "timezone", 9, (void**) &z_timezone) == SUCCESS && Z_TYPE_PP(z_timezone) == IS_STRING) {
|
||||
if (SUCCESS == timezone_initialize(*tzobj, Z_STRVAL_PP(z_timezone), Z_STRLEN_PP(z_timezone) TSRMLS_CC)) {
|
||||
if (SUCCESS == timezone_initialize(*tzobj, Z_STRVAL_PP(z_timezone) TSRMLS_CC)) {
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -4012,7 +4003,7 @@ static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *forma
|
||||
struct timelib_error_container *errors;
|
||||
|
||||
timelib_strtointerval(format, format_length, &b, &e, &p, &r, &errors);
|
||||
|
||||
|
||||
if (errors->error_count > 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or bad format (%s)", format);
|
||||
retval = FAILURE;
|
||||
@@ -4171,7 +4162,7 @@ PHP_METHOD(DateInterval, __construct)
|
||||
php_interval_obj *diobj;
|
||||
timelib_rel_time *reltime;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &interval_string, &interval_string_length) == SUCCESS) {
|
||||
if (date_interval_initialize(&reltime, interval_string, interval_string_length TSRMLS_CC) == SUCCESS) {
|
||||
@@ -4194,7 +4185,8 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
|
||||
#define PHP_DATE_INTERVAL_READ_PROPERTY(element, member, itype, def) \
|
||||
do { \
|
||||
zval **z_arg = NULL; \
|
||||
if (zend_hash_find(myht, element, strlen(element) + 1, (void**) &z_arg) == SUCCESS && Z_TYPE_PP(z_arg) == IS_LONG) { \
|
||||
if (zend_hash_find(myht, element, strlen(element) + 1, (void**) &z_arg) == SUCCESS) { \
|
||||
convert_to_long(*z_arg); \
|
||||
(*intobj)->diff->member = (itype)Z_LVAL_PP(z_arg); \
|
||||
} else { \
|
||||
(*intobj)->diff->member = (itype)def; \
|
||||
@@ -4205,15 +4197,8 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
|
||||
do { \
|
||||
zval **z_arg = NULL; \
|
||||
if (zend_hash_find(myht, element, strlen(element) + 1, (void**) &z_arg) == SUCCESS) { \
|
||||
if (Z_TYPE_PP(z_arg) == IS_STRING) { \
|
||||
DATE_A64I((*intobj)->diff->member, Z_STRVAL_PP(z_arg)); \
|
||||
} else if (Z_TYPE_PP(z_arg) == IS_LONG || Z_TYPE_PP(z_arg) == IS_BOOL) { \
|
||||
(*intobj)->diff->member = (timelib_sll)Z_LVAL_PP(z_arg); \
|
||||
} else if (Z_TYPE_PP(z_arg) == IS_DOUBLE) { \
|
||||
(*intobj)->diff->member = (timelib_sll)Z_DVAL_PP(z_arg); \
|
||||
} else { \
|
||||
(*intobj)->diff->member = -1LL; \
|
||||
} \
|
||||
convert_to_string(*z_arg); \
|
||||
DATE_A64I((*intobj)->diff->member, Z_STRVAL_PP(z_arg)); \
|
||||
} else { \
|
||||
(*intobj)->diff->member = -1LL; \
|
||||
} \
|
||||
@@ -4391,7 +4376,7 @@ static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_
|
||||
struct timelib_error_container *errors;
|
||||
|
||||
timelib_strtointerval(format, format_length, &b, &e, &p, &r, &errors);
|
||||
|
||||
|
||||
if (errors->error_count > 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or bad format (%s)", format);
|
||||
retval = FAILURE;
|
||||
@@ -4420,7 +4405,7 @@ PHP_METHOD(DatePeriod, __construct)
|
||||
int isostr_len = 0;
|
||||
timelib_time *clone;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOl|l", &start, date_ce_interface, &interval, date_ce_interval, &recurrences, &options) == FAILURE) {
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOO|l", &start, date_ce_interface, &interval, date_ce_interval, &end, date_ce_interface, &options) == FAILURE) {
|
||||
@@ -4610,7 +4595,7 @@ PHP_FUNCTION(timezone_identifiers_list)
|
||||
tzdb = DATE_TIMEZONEDB;
|
||||
item_count = tzdb->index_size;
|
||||
table = tzdb->index;
|
||||
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
for (i = 0; i < item_count; ++i) {
|
||||
@@ -4644,7 +4629,7 @@ PHP_FUNCTION(timezone_abbreviations_list)
|
||||
{
|
||||
const timelib_tz_lookup_table *table, *entry;
|
||||
zval *element, **abbr_array_pp, *abbr_array;
|
||||
|
||||
|
||||
table = timelib_timezone_abbreviations_list();
|
||||
array_init(return_value);
|
||||
entry = table;
|
||||
@@ -4720,11 +4705,11 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
|
||||
timelib_time *t;
|
||||
timelib_tzinfo *tzi;
|
||||
char *retstr;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|ldddd", &time, &retformat, &latitude, &longitude, &zenith, &gmt_offset) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
case 1:
|
||||
retformat = SUNFUNCS_RET_STRING;
|
||||
@@ -4768,7 +4753,7 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
|
||||
timelib_unixtime2local(t, time);
|
||||
rs = timelib_astro_rise_set_altitude(t, longitude, latitude, altitude, 1, &h_rise, &h_set, &rise, &set, &transit);
|
||||
timelib_time_dtor(t);
|
||||
|
||||
|
||||
if (rs != 0) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -4822,7 +4807,7 @@ PHP_FUNCTION(date_sun_info)
|
||||
timelib_sll rise, set, transit;
|
||||
int dummy;
|
||||
double ddummy;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ldd", &time, &latitude, &longitude) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -4836,7 +4821,7 @@ PHP_FUNCTION(date_sun_info)
|
||||
/* Setup */
|
||||
t2 = timelib_time_ctor();
|
||||
array_init(return_value);
|
||||
|
||||
|
||||
/* Get sun up/down and transit */
|
||||
rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -35.0/60, 1, &ddummy, &ddummy, &rise, &set, &transit);
|
||||
switch (rs) {
|
||||
@@ -4980,7 +4965,7 @@ static HashTable *date_object_get_properties_period(zval *object TSRMLS_DC)
|
||||
ZVAL_NULL(zv);
|
||||
}
|
||||
zend_hash_update(props, "interval", sizeof("interval"), &zv, sizeof(zv), NULL);
|
||||
|
||||
|
||||
/* converted to larger type (int->long); must check when unserializing */
|
||||
MAKE_STD_ZVAL(zv);
|
||||
ZVAL_LONG(zv, (long) period_obj->recurrences);
|
||||
@@ -5063,7 +5048,7 @@ static int php_date_period_initialize_from_hash(php_period_obj *period_obj, Hash
|
||||
}
|
||||
|
||||
period_obj->initialized = 1;
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -5080,7 +5065,7 @@ PHP_METHOD(DatePeriod, __set_state)
|
||||
}
|
||||
|
||||
myht = Z_ARRVAL_P(array);
|
||||
|
||||
|
||||
object_init_ex(return_value, date_ce_period);
|
||||
period_obj = zend_object_store_get_object(return_value TSRMLS_CC);
|
||||
if (!php_date_period_initialize_from_hash(period_obj, myht TSRMLS_CC)) {
|
||||
|
||||
@@ -14,17 +14,17 @@ var_dump($di);
|
||||
--EXPECTF--
|
||||
object(DateInterval)#%d (15) {
|
||||
["y"]=>
|
||||
int(-1)
|
||||
int(2)
|
||||
["m"]=>
|
||||
int(-1)
|
||||
int(0)
|
||||
["d"]=>
|
||||
int(-1)
|
||||
int(0)
|
||||
["h"]=>
|
||||
int(-1)
|
||||
int(6)
|
||||
["i"]=>
|
||||
int(-1)
|
||||
int(8)
|
||||
["s"]=>
|
||||
int(-1)
|
||||
int(0)
|
||||
["weekday"]=>
|
||||
int(10)
|
||||
["weekday_behavior"]=>
|
||||
|
||||
@@ -14,17 +14,17 @@ var_dump($di);
|
||||
--EXPECTF--
|
||||
object(DateInterval)#%d (15) {
|
||||
["y"]=>
|
||||
int(-1)
|
||||
int(2)
|
||||
["m"]=>
|
||||
int(-1)
|
||||
int(0)
|
||||
["d"]=>
|
||||
int(-1)
|
||||
int(0)
|
||||
["h"]=>
|
||||
int(-1)
|
||||
int(6)
|
||||
["i"]=>
|
||||
int(-1)
|
||||
int(8)
|
||||
["s"]=>
|
||||
int(-1)
|
||||
int(0)
|
||||
["weekday"]=>
|
||||
int(10)
|
||||
["weekday_behavior"]=>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Bug #66985 (Some timezones are no longer valid in PHP 5.5.10)
|
||||
Bug #66986 (Some timezones are no longer valid in PHP 5.5.10)
|
||||
--FILE--
|
||||
<?php
|
||||
$zones = array(
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70266 (DateInterval::__construct.interval_spec is not supposed to be optional)
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump((new ReflectionParameter(['DateInterval', '__construct'], 0))->isOptional());
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70277 (new DateTimeZone($foo) is ignoring text after null byte)
|
||||
--FILE--
|
||||
<?php
|
||||
$timezone = "Europe/Zurich\0Foo";
|
||||
var_dump(timezone_open($timezone));
|
||||
var_dump(new DateTimeZone($timezone));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: timezone_open(): Timezone must not contain null bytes in %sbug70277.php on line %d
|
||||
bool(false)
|
||||
|
||||
Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Timezone must not contain null bytes' in %sbug70277.php:%d
|
||||
Stack trace:
|
||||
#0 %sbug70277.php(%d): DateTimeZone->__construct('Europe/Zurich\x00F...')
|
||||
#1 {main}
|
||||
thrown in %sbug70277.php on line %d
|
||||
@@ -61,7 +61,7 @@ array\(11\) {
|
||||
\["mday"\]=>
|
||||
int\((9|14|23)\)
|
||||
\["wday"\]=>
|
||||
int\((0|6)\)
|
||||
int\(0\)
|
||||
\["mon"\]=>
|
||||
int\((10|12)\)
|
||||
\["year"\]=>
|
||||
@@ -69,7 +69,7 @@ array\(11\) {
|
||||
\["yday"\]=>
|
||||
int\((282|347|295)\)
|
||||
\["weekday"\]=>
|
||||
string\((6|8)\) "(Sunday|Saturday)"
|
||||
string\(6\) "Sunday"
|
||||
\["month"\]=>
|
||||
string\((7|8)\) "(October|December)"
|
||||
\[0\]=>
|
||||
|
||||
@@ -87,7 +87,7 @@ array\(9\) {
|
||||
\[5\]=>
|
||||
int\((104|1|-3843)\)
|
||||
\[6\]=>
|
||||
int\((5|6)\)
|
||||
int\(6\)
|
||||
\[7\]=>
|
||||
int\((281|346|294)\)
|
||||
\[8\]=>
|
||||
@@ -107,7 +107,7 @@ array\(9\) {
|
||||
\["tm_year"\]=>
|
||||
int\((104|1|-3843)\)
|
||||
\["tm_wday"\]=>
|
||||
int\((5|6)\)
|
||||
int\(6\)
|
||||
\["tm_yday"\]=>
|
||||
int\((281|346|294)\)
|
||||
\["tm_isdst"\]=>
|
||||
|
||||
+5
-17
@@ -1700,7 +1700,7 @@ PHP_FUNCTION(dom_document_save)
|
||||
char *file;
|
||||
long options = 0;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op|l", &id, dom_document_class_entry, &file, &file_len, &options) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &id, dom_document_class_entry, &file, &file_len, &options) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1930,7 +1930,7 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
|
||||
int is_valid;
|
||||
char resolved_path[MAXPATHLEN + 1];
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &id, dom_document_class_entry, &source, &source_len, &flags) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op|l", &id, dom_document_class_entry, &source, &source_len, &flags) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1943,10 +1943,6 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
|
||||
|
||||
switch (type) {
|
||||
case DOM_LOAD_FILE:
|
||||
if (CHECK_NULL_PATH(source, source_len)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Schema file source");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
valid_file = _dom_get_valid_file_path(source, resolved_path, MAXPATHLEN TSRMLS_CC);
|
||||
if (!valid_file) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Schema file source");
|
||||
@@ -2030,7 +2026,7 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
|
||||
int is_valid;
|
||||
char resolved_path[MAXPATHLEN + 1];
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2043,10 +2039,6 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
|
||||
|
||||
switch (type) {
|
||||
case DOM_LOAD_FILE:
|
||||
if (CHECK_NULL_PATH(source, source_len)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid RelaxNG file source");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
valid_file = _dom_get_valid_file_path(source, resolved_path, MAXPATHLEN TSRMLS_CC);
|
||||
if (!valid_file) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid RelaxNG file source");
|
||||
@@ -2127,7 +2119,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
|
||||
|
||||
id = getThis();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, &source_len, &options) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &source, &source_len, &options) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2137,10 +2129,6 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
|
||||
}
|
||||
|
||||
if (mode == DOM_LOAD_FILE) {
|
||||
if (CHECK_NULL_PATH(source, source_len)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid file source");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ctxt = htmlCreateFileParserCtxt(source, NULL);
|
||||
} else {
|
||||
source_len = xmlStrlen(source);
|
||||
@@ -2229,7 +2217,7 @@ PHP_FUNCTION(dom_document_save_html_file)
|
||||
char *file;
|
||||
const char *encoding;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op", &id, dom_document_class_entry, &file, &file_len) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &file, &file_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ $result = $doc->loadHTMLFile("");
|
||||
assert('$result === false');
|
||||
$doc = new DOMDocument();
|
||||
$result = $doc->loadHTMLFile("text.html\0something");
|
||||
assert('$result === false');
|
||||
assert('$result === null');
|
||||
?>
|
||||
--EXPECTF--
|
||||
%r(PHP ){0,1}%rWarning: DOMDocument::loadHTMLFile(): Empty string supplied as input %s
|
||||
|
||||
%r(PHP ){0,1}%rWarning: DOMDocument::loadHTMLFile(): Invalid file source %s
|
||||
%r(PHP ){0,1}%rWarning: DOMDocument::loadHTMLFile() expects parameter 1 to be a valid path, string given %s
|
||||
@@ -1,12 +0,0 @@
|
||||
--TEST--
|
||||
Bug #69679 (DOMDocument::loadHTML refuses to accept NULL bytes)
|
||||
--FILE--
|
||||
<?php
|
||||
$doc = new DOMDocument();
|
||||
$html = "<!DOCTYPE html><html><head><meta charset='UTF-8'></head><body>U+0000 <span>\x0</span></body></html>";
|
||||
$doc->loadHTML($html);
|
||||
print($doc->saveHTML());
|
||||
?>
|
||||
--EXPECT--
|
||||
<!DOCTYPE html>
|
||||
<html><head><meta charset="UTF-8"></head><body>U+0000 <span></span></body></html>
|
||||
@@ -1,10 +1,7 @@
|
||||
--TEST--
|
||||
Testing reading and writing to DOMNode::textContent
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
if (LIBXML_VERSION < 20707) die ('skip requires libxml2-2.7.7 or higher');
|
||||
?>
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -37,6 +37,6 @@ if test "$PHP_ENCHANT" != "no"; then
|
||||
[
|
||||
AC_DEFINE(HAVE_ENCHANT_BROKER_SET_PARAM, 1, [ ])
|
||||
AC_DEFINE(ENCHANT_VERSION_STRING, "1.5.x", [ ])
|
||||
], [], [ -L$ENCHANT_LIBDIR $ENCHANT_SHARED_LIBADD])
|
||||
], [], [ -L$ENCHANT_LIB $ENCHANT_SHARED_LIBADD])
|
||||
|
||||
fi
|
||||
+106
-106
@@ -64,7 +64,7 @@
|
||||
#include "php_ini.h"
|
||||
#include "ext/standard/php_string.h"
|
||||
#include "ext/standard/php_image.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "ext/standard/info.h"
|
||||
|
||||
/* needed for ssize_t definition */
|
||||
#include <sys/types.h>
|
||||
@@ -151,7 +151,7 @@ ZEND_BEGIN_MODULE_GLOBALS(exif)
|
||||
char * encode_jis;
|
||||
char * decode_jis_be;
|
||||
char * decode_jis_le;
|
||||
ZEND_END_MODULE_GLOBALS(exif)
|
||||
ZEND_END_MODULE_GLOBALS(exif)
|
||||
|
||||
ZEND_DECLARE_MODULE_GLOBALS(exif)
|
||||
|
||||
@@ -160,7 +160,7 @@ ZEND_DECLARE_MODULE_GLOBALS(exif)
|
||||
#else
|
||||
#define EXIF_G(v) (exif_globals.v)
|
||||
#endif
|
||||
|
||||
|
||||
/* {{{ PHP_INI
|
||||
*/
|
||||
|
||||
@@ -203,7 +203,7 @@ PHP_INI_BEGIN()
|
||||
STD_PHP_INI_ENTRY("exif.decode_jis_intel", "JIS", PHP_INI_ALL, OnUpdateDecode, decode_jis_le, zend_exif_globals, exif_globals)
|
||||
PHP_INI_END()
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ PHP_GINIT_FUNCTION
|
||||
*/
|
||||
static PHP_GINIT_FUNCTION(exif)
|
||||
@@ -223,9 +223,9 @@ PHP_MINIT_FUNCTION(exif)
|
||||
{
|
||||
REGISTER_INI_ENTRIES();
|
||||
if (zend_hash_exists(&module_registry, "mbstring", sizeof("mbstring"))) {
|
||||
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 1, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 1, CONST_CS | CONST_PERSISTENT);
|
||||
} else {
|
||||
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 0, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 0, CONST_CS | CONST_PERSISTENT);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -255,7 +255,7 @@ zend_module_entry exif_module_entry = {
|
||||
exif_module_deps,
|
||||
"exif",
|
||||
exif_functions,
|
||||
PHP_MINIT(exif),
|
||||
PHP_MINIT(exif),
|
||||
PHP_MSHUTDOWN(exif),
|
||||
NULL, NULL,
|
||||
PHP_MINFO(exif),
|
||||
@@ -268,7 +268,7 @@ zend_module_entry exif_module_entry = {
|
||||
NULL,
|
||||
NULL,
|
||||
STANDARD_MODULE_PROPERTIES_EX
|
||||
#else
|
||||
#else
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
#endif
|
||||
};
|
||||
@@ -657,73 +657,73 @@ static tag_info_array tag_table_IFD = {
|
||||
{ 0x0213, "YCbCrPositioning"},
|
||||
{ 0x0214, "ReferenceBlackWhite"},
|
||||
{ 0x02BC, "ExtensibleMetadataPlatform"}, /* XAP: Extensible Authoring Publishing, obsoleted by XMP: Extensible Metadata Platform */
|
||||
{ 0x0301, "Gamma"},
|
||||
{ 0x0302, "ICCProfileDescriptor"},
|
||||
{ 0x0303, "SRGBRenderingIntent"},
|
||||
{ 0x0320, "ImageTitle"},
|
||||
{ 0x5001, "ResolutionXUnit"},
|
||||
{ 0x5002, "ResolutionYUnit"},
|
||||
{ 0x5003, "ResolutionXLengthUnit"},
|
||||
{ 0x5004, "ResolutionYLengthUnit"},
|
||||
{ 0x5005, "PrintFlags"},
|
||||
{ 0x5006, "PrintFlagsVersion"},
|
||||
{ 0x5007, "PrintFlagsCrop"},
|
||||
{ 0x5008, "PrintFlagsBleedWidth"},
|
||||
{ 0x5009, "PrintFlagsBleedWidthScale"},
|
||||
{ 0x500A, "HalftoneLPI"},
|
||||
{ 0x500B, "HalftoneLPIUnit"},
|
||||
{ 0x500C, "HalftoneDegree"},
|
||||
{ 0x500D, "HalftoneShape"},
|
||||
{ 0x500E, "HalftoneMisc"},
|
||||
{ 0x500F, "HalftoneScreen"},
|
||||
{ 0x5010, "JPEGQuality"},
|
||||
{ 0x5011, "GridSize"},
|
||||
{ 0x5012, "ThumbnailFormat"},
|
||||
{ 0x5013, "ThumbnailWidth"},
|
||||
{ 0x5014, "ThumbnailHeight"},
|
||||
{ 0x5015, "ThumbnailColorDepth"},
|
||||
{ 0x5016, "ThumbnailPlanes"},
|
||||
{ 0x5017, "ThumbnailRawBytes"},
|
||||
{ 0x5018, "ThumbnailSize"},
|
||||
{ 0x5019, "ThumbnailCompressedSize"},
|
||||
{ 0x501A, "ColorTransferFunction"},
|
||||
{ 0x501B, "ThumbnailData"},
|
||||
{ 0x5020, "ThumbnailImageWidth"},
|
||||
{ 0x5021, "ThumbnailImageHeight"},
|
||||
{ 0x5022, "ThumbnailBitsPerSample"},
|
||||
{ 0x5023, "ThumbnailCompression"},
|
||||
{ 0x5024, "ThumbnailPhotometricInterp"},
|
||||
{ 0x5025, "ThumbnailImageDescription"},
|
||||
{ 0x5026, "ThumbnailEquipMake"},
|
||||
{ 0x5027, "ThumbnailEquipModel"},
|
||||
{ 0x5028, "ThumbnailStripOffsets"},
|
||||
{ 0x5029, "ThumbnailOrientation"},
|
||||
{ 0x502A, "ThumbnailSamplesPerPixel"},
|
||||
{ 0x502B, "ThumbnailRowsPerStrip"},
|
||||
{ 0x502C, "ThumbnailStripBytesCount"},
|
||||
{ 0x502D, "ThumbnailResolutionX"},
|
||||
{ 0x502E, "ThumbnailResolutionY"},
|
||||
{ 0x502F, "ThumbnailPlanarConfig"},
|
||||
{ 0x5030, "ThumbnailResolutionUnit"},
|
||||
{ 0x5031, "ThumbnailTransferFunction"},
|
||||
{ 0x5032, "ThumbnailSoftwareUsed"},
|
||||
{ 0x5033, "ThumbnailDateTime"},
|
||||
{ 0x5034, "ThumbnailArtist"},
|
||||
{ 0x5035, "ThumbnailWhitePoint"},
|
||||
{ 0x5036, "ThumbnailPrimaryChromaticities"},
|
||||
{ 0x5037, "ThumbnailYCbCrCoefficients"},
|
||||
{ 0x5038, "ThumbnailYCbCrSubsampling"},
|
||||
{ 0x5039, "ThumbnailYCbCrPositioning"},
|
||||
{ 0x503A, "ThumbnailRefBlackWhite"},
|
||||
{ 0x503B, "ThumbnailCopyRight"},
|
||||
{ 0x5090, "LuminanceTable"},
|
||||
{ 0x5091, "ChrominanceTable"},
|
||||
{ 0x5100, "FrameDelay"},
|
||||
{ 0x5101, "LoopCount"},
|
||||
{ 0x5110, "PixelUnit"},
|
||||
{ 0x5111, "PixelPerUnitX"},
|
||||
{ 0x5112, "PixelPerUnitY"},
|
||||
{ 0x5113, "PaletteHistogram"},
|
||||
{ 0x0301, "Gamma"},
|
||||
{ 0x0302, "ICCProfileDescriptor"},
|
||||
{ 0x0303, "SRGBRenderingIntent"},
|
||||
{ 0x0320, "ImageTitle"},
|
||||
{ 0x5001, "ResolutionXUnit"},
|
||||
{ 0x5002, "ResolutionYUnit"},
|
||||
{ 0x5003, "ResolutionXLengthUnit"},
|
||||
{ 0x5004, "ResolutionYLengthUnit"},
|
||||
{ 0x5005, "PrintFlags"},
|
||||
{ 0x5006, "PrintFlagsVersion"},
|
||||
{ 0x5007, "PrintFlagsCrop"},
|
||||
{ 0x5008, "PrintFlagsBleedWidth"},
|
||||
{ 0x5009, "PrintFlagsBleedWidthScale"},
|
||||
{ 0x500A, "HalftoneLPI"},
|
||||
{ 0x500B, "HalftoneLPIUnit"},
|
||||
{ 0x500C, "HalftoneDegree"},
|
||||
{ 0x500D, "HalftoneShape"},
|
||||
{ 0x500E, "HalftoneMisc"},
|
||||
{ 0x500F, "HalftoneScreen"},
|
||||
{ 0x5010, "JPEGQuality"},
|
||||
{ 0x5011, "GridSize"},
|
||||
{ 0x5012, "ThumbnailFormat"},
|
||||
{ 0x5013, "ThumbnailWidth"},
|
||||
{ 0x5014, "ThumbnailHeight"},
|
||||
{ 0x5015, "ThumbnailColorDepth"},
|
||||
{ 0x5016, "ThumbnailPlanes"},
|
||||
{ 0x5017, "ThumbnailRawBytes"},
|
||||
{ 0x5018, "ThumbnailSize"},
|
||||
{ 0x5019, "ThumbnailCompressedSize"},
|
||||
{ 0x501A, "ColorTransferFunction"},
|
||||
{ 0x501B, "ThumbnailData"},
|
||||
{ 0x5020, "ThumbnailImageWidth"},
|
||||
{ 0x5021, "ThumbnailImageHeight"},
|
||||
{ 0x5022, "ThumbnailBitsPerSample"},
|
||||
{ 0x5023, "ThumbnailCompression"},
|
||||
{ 0x5024, "ThumbnailPhotometricInterp"},
|
||||
{ 0x5025, "ThumbnailImageDescription"},
|
||||
{ 0x5026, "ThumbnailEquipMake"},
|
||||
{ 0x5027, "ThumbnailEquipModel"},
|
||||
{ 0x5028, "ThumbnailStripOffsets"},
|
||||
{ 0x5029, "ThumbnailOrientation"},
|
||||
{ 0x502A, "ThumbnailSamplesPerPixel"},
|
||||
{ 0x502B, "ThumbnailRowsPerStrip"},
|
||||
{ 0x502C, "ThumbnailStripBytesCount"},
|
||||
{ 0x502D, "ThumbnailResolutionX"},
|
||||
{ 0x502E, "ThumbnailResolutionY"},
|
||||
{ 0x502F, "ThumbnailPlanarConfig"},
|
||||
{ 0x5030, "ThumbnailResolutionUnit"},
|
||||
{ 0x5031, "ThumbnailTransferFunction"},
|
||||
{ 0x5032, "ThumbnailSoftwareUsed"},
|
||||
{ 0x5033, "ThumbnailDateTime"},
|
||||
{ 0x5034, "ThumbnailArtist"},
|
||||
{ 0x5035, "ThumbnailWhitePoint"},
|
||||
{ 0x5036, "ThumbnailPrimaryChromaticities"},
|
||||
{ 0x5037, "ThumbnailYCbCrCoefficients"},
|
||||
{ 0x5038, "ThumbnailYCbCrSubsampling"},
|
||||
{ 0x5039, "ThumbnailYCbCrPositioning"},
|
||||
{ 0x503A, "ThumbnailRefBlackWhite"},
|
||||
{ 0x503B, "ThumbnailCopyRight"},
|
||||
{ 0x5090, "LuminanceTable"},
|
||||
{ 0x5091, "ChrominanceTable"},
|
||||
{ 0x5100, "FrameDelay"},
|
||||
{ 0x5101, "LoopCount"},
|
||||
{ 0x5110, "PixelUnit"},
|
||||
{ 0x5111, "PixelPerUnitX"},
|
||||
{ 0x5112, "PixelPerUnitY"},
|
||||
{ 0x5113, "PaletteHistogram"},
|
||||
{ 0x1000, "RelatedImageFileFormat"},
|
||||
{ 0x800D, "ImageID"},
|
||||
{ 0x80E3, "Matteing"}, /* obsoleted by ExtraSamples */
|
||||
@@ -929,7 +929,7 @@ static tag_info_array tag_table_VND_NIKON = {
|
||||
{ 0x000b, "Converter"},
|
||||
TAG_TABLE_END
|
||||
};
|
||||
|
||||
|
||||
static tag_info_array tag_table_VND_NIKON_990 = {
|
||||
{ 0x0001, "Version"},
|
||||
{ 0x0002, "ISOSetting"},
|
||||
@@ -948,7 +948,7 @@ static tag_info_array tag_table_VND_NIKON_990 = {
|
||||
{ 0x0010, "DataDump"},
|
||||
TAG_TABLE_END
|
||||
};
|
||||
|
||||
|
||||
static tag_info_array tag_table_VND_OLYMPUS = {
|
||||
{ 0x0200, "SpecialMode"},
|
||||
{ 0x0201, "JPEGQuality"},
|
||||
@@ -1214,7 +1214,7 @@ char * exif_dump_data(int *dump_free, int format, int components, int length, in
|
||||
if (components > 0) {
|
||||
dump = erealloc(dump, len + 2 + 1);
|
||||
snprintf(dump + len, 2 + 1, ", ");
|
||||
len += 2;
|
||||
len += 2;
|
||||
components--;
|
||||
} else{
|
||||
break;
|
||||
@@ -1564,7 +1564,7 @@ typedef struct {
|
||||
static void exif_error_docref(const char *docref EXIFERR_DC, const image_info_type *ImageInfo, int type, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
|
||||
va_start(args, format);
|
||||
#ifdef EXIF_DEBUG
|
||||
{
|
||||
@@ -2617,7 +2617,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
*pszEncoding = estrdup((const char*)szValuePtr);
|
||||
szValuePtr = szValuePtr+8;
|
||||
ByteCount -= 8;
|
||||
/* First try to detect BOM: ZERO WIDTH NOBREAK SPACE (FEFF 16)
|
||||
/* First try to detect BOM: ZERO WIDTH NOBREAK SPACE (FEFF 16)
|
||||
* since we have no encoding support for the BOM yet we skip that.
|
||||
*/
|
||||
if (!memcmp(szValuePtr, "\xFE\xFF", 2)) {
|
||||
@@ -2635,8 +2635,8 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
}
|
||||
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
|
||||
if (zend_multibyte_encoding_converter(
|
||||
(unsigned char**)pszInfoPtr,
|
||||
&len,
|
||||
(unsigned char**)pszInfoPtr,
|
||||
&len,
|
||||
(unsigned char*)szValuePtr,
|
||||
ByteCount,
|
||||
zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC),
|
||||
@@ -2656,8 +2656,8 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
ByteCount -= 8;
|
||||
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
|
||||
if (zend_multibyte_encoding_converter(
|
||||
(unsigned char**)pszInfoPtr,
|
||||
&len,
|
||||
(unsigned char**)pszInfoPtr,
|
||||
&len,
|
||||
(unsigned char*)szValuePtr,
|
||||
ByteCount,
|
||||
zend_multibyte_fetch_encoding(ImageInfo->encode_jis TSRMLS_CC),
|
||||
@@ -2691,12 +2691,12 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
* Process unicode field in IFD. */
|
||||
static int exif_process_unicode(image_info_type *ImageInfo, xp_field_type *xp_field, int tag, char *szValuePtr, int ByteCount TSRMLS_DC)
|
||||
{
|
||||
xp_field->tag = tag;
|
||||
xp_field->tag = tag;
|
||||
xp_field->value = NULL;
|
||||
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
|
||||
if (zend_multibyte_encoding_converter(
|
||||
(unsigned char**)&xp_field->value,
|
||||
&xp_field->size,
|
||||
(unsigned char**)&xp_field->value,
|
||||
&xp_field->size,
|
||||
(unsigned char*)szValuePtr,
|
||||
ByteCount,
|
||||
zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC),
|
||||
@@ -2721,7 +2721,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
if (i==sizeof(maker_note_array)/sizeof(maker_note_type))
|
||||
return FALSE;
|
||||
maker_note = maker_note_array+i;
|
||||
|
||||
|
||||
/*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "check (%s,%s)", maker_note->make?maker_note->make:"", maker_note->model?maker_note->model:"");*/
|
||||
if (maker_note->make && (!ImageInfo->make || strcmp(maker_note->make, ImageInfo->make)))
|
||||
continue;
|
||||
@@ -2842,9 +2842,9 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
offset_val = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel);
|
||||
/* If its bigger than 4 bytes, the dir entry contains an offset. */
|
||||
value_ptr = offset_base+offset_val;
|
||||
/*
|
||||
/*
|
||||
dir_entry is ImageInfo->file.list[sn].data+2+i*12
|
||||
offset_base is ImageInfo->file.list[sn].data-dir_offset
|
||||
offset_base is ImageInfo->file.list[sn].data-dir_offset
|
||||
dir_entry - offset_base is dir_offset+2+i*12
|
||||
*/
|
||||
if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry || offset_val < (size_t)(dir_entry-offset_base)) {
|
||||
@@ -2915,18 +2915,18 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
case TAG_COMP_IMAGE_WIDTH:
|
||||
ImageInfo->Thumbnail.width = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
|
||||
break;
|
||||
|
||||
|
||||
case TAG_IMAGEHEIGHT:
|
||||
case TAG_COMP_IMAGE_HEIGHT:
|
||||
ImageInfo->Thumbnail.height = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
|
||||
break;
|
||||
|
||||
|
||||
case TAG_STRIP_OFFSETS:
|
||||
case TAG_JPEG_INTERCHANGE_FORMAT:
|
||||
/* accept both formats */
|
||||
ImageInfo->Thumbnail.offset = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
|
||||
break;
|
||||
|
||||
|
||||
case TAG_STRIP_BYTE_COUNTS:
|
||||
if (ImageInfo->FileType == IMAGE_FILETYPE_TIFF_II || ImageInfo->FileType == IMAGE_FILETYPE_TIFF_MM) {
|
||||
ImageInfo->Thumbnail.filetype = ImageInfo->FileType;
|
||||
@@ -2936,7 +2936,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
}
|
||||
ImageInfo->Thumbnail.size = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
|
||||
break;
|
||||
|
||||
|
||||
case TAG_JPEG_INTERCHANGE_FORMAT_LEN:
|
||||
if (ImageInfo->Thumbnail.filetype == IMAGE_FILETYPE_UNKNOWN) {
|
||||
ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_JPEG;
|
||||
@@ -2954,16 +2954,16 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
if (length<byte_count-1) {
|
||||
/* When there are any characters after the first NUL */
|
||||
ImageInfo->CopyrightPhotographer = estrdup(value_ptr);
|
||||
ImageInfo->CopyrightEditor = estrndup(value_ptr+length+1, byte_count-length-1);
|
||||
ImageInfo->CopyrightEditor = estrdup(value_ptr+length+1);
|
||||
spprintf(&ImageInfo->Copyright, 0, "%s, %s", value_ptr, value_ptr+length+1);
|
||||
/* format = TAG_FMT_UNDEFINED; this musn't be ASCII */
|
||||
/* but we are not supposed to change this */
|
||||
/* keep in mind that image_info does not store editor value */
|
||||
} else {
|
||||
ImageInfo->Copyright = estrndup(value_ptr, byte_count);
|
||||
ImageInfo->Copyright = estrdup(value_ptr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case TAG_USERCOMMENT:
|
||||
ImageInfo->UserCommentLength = exif_process_user_comment(ImageInfo, &(ImageInfo->UserComment), &(ImageInfo->UserCommentEncoding), value_ptr, byte_count TSRMLS_CC);
|
||||
@@ -3051,10 +3051,10 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
break;
|
||||
|
||||
case TAG_MAKE:
|
||||
ImageInfo->make = estrndup(value_ptr, byte_count);
|
||||
ImageInfo->make = estrdup(value_ptr);
|
||||
break;
|
||||
case TAG_MODEL:
|
||||
ImageInfo->model = estrndup(value_ptr, byte_count);
|
||||
ImageInfo->model = estrdup(value_ptr);
|
||||
break;
|
||||
|
||||
case TAG_MAKER_NOTE:
|
||||
@@ -3404,7 +3404,7 @@ static int exif_scan_JPEG_header(image_info_type *ImageInfo TSRMLS_DC)
|
||||
if ((itemlen - 2) < 6) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
exif_process_SOFn(Data, marker, &sof_info);
|
||||
ImageInfo->Width = sof_info.width;
|
||||
ImageInfo->Height = sof_info.height;
|
||||
@@ -3449,21 +3449,21 @@ static int exif_scan_thumbnail(image_info_type *ImageInfo TSRMLS_DC)
|
||||
}
|
||||
for (;;) {
|
||||
pos += length;
|
||||
if (pos>=ImageInfo->Thumbnail.size)
|
||||
if (pos>=ImageInfo->Thumbnail.size)
|
||||
return FALSE;
|
||||
c = data[pos++];
|
||||
if (pos>=ImageInfo->Thumbnail.size)
|
||||
if (pos>=ImageInfo->Thumbnail.size)
|
||||
return FALSE;
|
||||
if (c != 0xFF) {
|
||||
return FALSE;
|
||||
}
|
||||
n = 8;
|
||||
while ((c = data[pos++]) == 0xFF && n--) {
|
||||
if (pos+3>=ImageInfo->Thumbnail.size)
|
||||
if (pos+3>=ImageInfo->Thumbnail.size)
|
||||
return FALSE;
|
||||
/* +3 = pos++ of next check when reaching marker + 2 bytes for length */
|
||||
}
|
||||
if (c == 0xFF)
|
||||
if (c == 0xFF)
|
||||
return FALSE;
|
||||
marker = c;
|
||||
length = php_jpg_get16(data+pos);
|
||||
@@ -3777,7 +3777,7 @@ static int exif_scan_FILE_header(image_info_type *ImageInfo TSRMLS_DC)
|
||||
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "File has TIFF/II format");
|
||||
#endif
|
||||
ImageInfo->sections_found |= FOUND_IFD0;
|
||||
if (exif_process_IFD_in_TIFF(ImageInfo,
|
||||
if (exif_process_IFD_in_TIFF(ImageInfo,
|
||||
php_ifd_get32u(file_header + 4, ImageInfo->motorola_intel),
|
||||
SECTION_IFD0 TSRMLS_CC)) {
|
||||
ret = TRUE;
|
||||
@@ -3957,7 +3957,7 @@ PHP_FUNCTION(exif_read_data)
|
||||
sections_str = exif_get_sectionlist(ImageInfo.sections_found TSRMLS_CC);
|
||||
|
||||
#ifdef EXIF_DEBUG
|
||||
if (sections_str)
|
||||
if (sections_str)
|
||||
exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Sections found: %s", sections_str[0] ? sections_str : "None");
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1663,6 +1663,8 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
for (ptr = data->buf; rcvd; rcvd--, ptr++) {
|
||||
if (*ptr == '\n' && lastch == '\r') {
|
||||
lines++;
|
||||
} else {
|
||||
size++;
|
||||
}
|
||||
lastch = *ptr;
|
||||
}
|
||||
|
||||
+8
-14
@@ -1405,11 +1405,6 @@ PHP_FUNCTION(gd_info)
|
||||
add_assoc_bool(return_value, "XPM Support", 0);
|
||||
#endif
|
||||
add_assoc_bool(return_value, "XBM Support", 1);
|
||||
#ifdef HAVE_GD_WEBP
|
||||
add_assoc_bool(return_value, "WebP Support", 1);
|
||||
#else
|
||||
add_assoc_bool(return_value, "WebP Support", 0);
|
||||
#endif
|
||||
#if defined(USE_GD_JISX0208)
|
||||
add_assoc_bool(return_value, "JIS-mapped Japanese Font Support", 1);
|
||||
#else
|
||||
@@ -1755,7 +1750,7 @@ PHP_FUNCTION(imagefilledarc)
|
||||
long cx, cy, w, h, ST, E, col, style;
|
||||
gdImagePtr im;
|
||||
int e, st;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllllllll", &IM, &cx, &cy, &w, &h, &ST, &E, &col, &style) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -1996,7 +1991,7 @@ PHP_FUNCTION(imagegrabwindow)
|
||||
if ( handle == 0 ) {
|
||||
goto clean;
|
||||
}
|
||||
pPrintWindow = (tPrintWindow) GetProcAddress(handle, "PrintWindow");
|
||||
pPrintWindow = (tPrintWindow) GetProcAddress(handle, "PrintWindow");
|
||||
|
||||
if ( pPrintWindow ) {
|
||||
pPrintWindow(window, memDC, (UINT) client_area);
|
||||
@@ -3065,11 +3060,10 @@ PHP_FUNCTION(imagegammacorrect)
|
||||
for (x = 0; x < gdImageSX(im); x++) {
|
||||
c = gdImageGetPixel(im, x, y);
|
||||
gdImageSetPixel(im, x, y,
|
||||
gdTrueColorAlpha(
|
||||
gdTrueColor(
|
||||
(int) ((pow((pow((gdTrueColorGetRed(c) / 255.0), input)), 1.0 / output) * 255) + .5),
|
||||
(int) ((pow((pow((gdTrueColorGetGreen(c) / 255.0), input)), 1.0 / output) * 255) + .5),
|
||||
(int) ((pow((pow((gdTrueColorGetBlue(c) / 255.0), input)), 1.0 / output) * 255) + .5),
|
||||
gdTrueColorGetAlpha(c)
|
||||
(int) ((pow((pow((gdTrueColorGetBlue(c) / 255.0), input)), 1.0 / output) * 255) + .5)
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -3866,7 +3860,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
|
||||
if (zend_hash_get_current_data_ex(HASH_OF(EXT), (void **) &item, &pos) == FAILURE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (strcmp("linespacing", key) == 0) {
|
||||
convert_to_double_ex(item);
|
||||
strex.flags |= gdFTEX_LINESPACE;
|
||||
@@ -3945,7 +3939,7 @@ PHP_FUNCTION(imagepsloadfont)
|
||||
struct stat st;
|
||||
#endif
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &file, &file_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file, &file_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4285,11 +4279,11 @@ PHP_FUNCTION(imagepsbbox)
|
||||
if (argc != 3 && argc != 6) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "srl|lld", &str, &str_len, &fnt, &sz, &sp, &wd, &angle) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 6) {
|
||||
space = sp;
|
||||
add_width = wd;
|
||||
|
||||
+1
-6
@@ -137,11 +137,6 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid 2nd parameter, it must a filename or a stream");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} else if (argc > 1 && file != NULL) {
|
||||
stream = php_stream_open_wrapper(file, "wb", REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL);
|
||||
if (stream == NULL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} else {
|
||||
ctx = emalloc(sizeof(gdIOCtx));
|
||||
ctx->putC = _php_image_output_putc;
|
||||
@@ -189,7 +184,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
q = i;
|
||||
}
|
||||
if (image_type == PHP_GDIMG_TYPE_XBM) {
|
||||
(*func_p)(im, file ? file : "", q, ctx);
|
||||
(*func_p)(im, file, q, ctx);
|
||||
} else {
|
||||
(*func_p)(im, q, ctx);
|
||||
}
|
||||
|
||||
+7
-17
@@ -1774,13 +1774,9 @@ void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color)
|
||||
|
||||
if (x >= im->sx) {
|
||||
x = im->sx - 1;
|
||||
} else if (x < 0) {
|
||||
x = 0;
|
||||
}
|
||||
if (y >= im->sy) {
|
||||
y = im->sy - 1;
|
||||
} else if (y < 0) {
|
||||
y = 0;
|
||||
}
|
||||
|
||||
for (i = x; i >= 0; i--) {
|
||||
@@ -2048,9 +2044,7 @@ void gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
|
||||
t=y1;
|
||||
y1 = y2;
|
||||
y2 = t;
|
||||
}
|
||||
|
||||
if (x2 < x1) {
|
||||
|
||||
t = x1;
|
||||
x1 = x2;
|
||||
x2 = t;
|
||||
@@ -2101,16 +2095,12 @@ void gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
|
||||
|
||||
return;
|
||||
} else {
|
||||
if (x1 == x2 || y1 == y2) {
|
||||
gdImageLine(im, x1, y1, x2, y2, color);
|
||||
} else {
|
||||
y1v = y1h + 1;
|
||||
y2v = y2h - 1;
|
||||
gdImageLine(im, x1h, y1h, x2h, y1h, color);
|
||||
gdImageLine(im, x1h, y2h, x2h, y2h, color);
|
||||
gdImageLine(im, x1v, y1v, x1v, y2v, color);
|
||||
gdImageLine(im, x2v, y1v, x2v, y2v, color);
|
||||
}
|
||||
y1v = y1h + 1;
|
||||
y2v = y2h - 1;
|
||||
gdImageLine(im, x1h, y1h, x2h, y1h, color);
|
||||
gdImageLine(im, x1h, y2h, x2h, y2h, color);
|
||||
gdImageLine(im, x1v, y1v, x1v, y2v, color);
|
||||
gdImageLine(im, x2v, y1v, x2v, y2v, color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ void gdImageFilledEllipse (gdImagePtr im, int mx, int my, int w, int h, int c)
|
||||
int x=0,mx1=0,mx2=0,my1=0,my2=0;
|
||||
long aq,bq,dx,dy,r,rx,ry,a,b;
|
||||
int i;
|
||||
int old_y2;
|
||||
int old_y1,old_y2;
|
||||
|
||||
a=w>>1;
|
||||
b=h>>1;
|
||||
@@ -79,6 +79,7 @@ void gdImageFilledEllipse (gdImagePtr im, int mx, int my, int w, int h, int c)
|
||||
ry = 0;
|
||||
x = a;
|
||||
old_y2=-2;
|
||||
old_y1=-2;
|
||||
while (x > 0){
|
||||
if (r > 0) {
|
||||
my1++;my2--;
|
||||
@@ -94,10 +95,15 @@ void gdImageFilledEllipse (gdImagePtr im, int mx, int my, int w, int h, int c)
|
||||
if(old_y2!=my2){
|
||||
for(i=mx1;i<=mx2;i++){
|
||||
gdImageSetPixel(im,i,my1,c);
|
||||
}
|
||||
}
|
||||
if(old_y2!=my2){
|
||||
for(i=mx1;i<=mx2;i++){
|
||||
gdImageSetPixel(im,i,my2,c);
|
||||
}
|
||||
}
|
||||
old_y2 = my2;
|
||||
old_y1 = my1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -80,14 +80,14 @@ printf("rect->x: %i\nrect->y: %i\nrect->width: %i\nrect->height: %i\n", crop->x,
|
||||
y = crop->y;
|
||||
if (src->trueColor) {
|
||||
unsigned int dst_y = 0;
|
||||
while (y < (crop->y + crop->height)) {
|
||||
while (y < (crop->y + (crop->height - 1))) {
|
||||
/* TODO: replace 4 w/byte per channel||pitch once available */
|
||||
memcpy(dst->tpixels[dst_y++], src->tpixels[y++] + crop->x, crop->width * 4);
|
||||
}
|
||||
} else {
|
||||
int x;
|
||||
for (y = crop->y; y < (crop->y + crop->height); y++) {
|
||||
for (x = crop->x; x < (crop->x + crop->width); x++) {
|
||||
for (y = crop->y; y < (crop->y + (crop->height - 1)); y++) {
|
||||
for (x = crop->x; x < (crop->x + (crop->width - 1)); x++) {
|
||||
dst->pixels[y - crop->y][x - crop->x] = src->pixels[y][x];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1059,11 +1059,6 @@ gdImagePtr gdImageScaleTwoPass(const gdImagePtr src, const unsigned int src_widt
|
||||
gdImagePtr tmp_im;
|
||||
gdImagePtr dst;
|
||||
|
||||
/* Convert to truecolor if it isn't; this code requires it. */
|
||||
if (!src->trueColor) {
|
||||
gdImagePaletteToTrueColor(src);
|
||||
}
|
||||
|
||||
tmp_im = gdImageCreateTrueColor(new_width, src_height);
|
||||
if (tmp_im == NULL) {
|
||||
return NULL;
|
||||
@@ -1073,12 +1068,12 @@ gdImagePtr gdImageScaleTwoPass(const gdImagePtr src, const unsigned int src_widt
|
||||
|
||||
dst = gdImageCreateTrueColor(new_width, new_height);
|
||||
if (dst == NULL) {
|
||||
gdImageDestroy(tmp_im);
|
||||
gdFree(tmp_im);
|
||||
return NULL;
|
||||
}
|
||||
gdImageSetInterpolationMethod(dst, src->interpolation_id);
|
||||
_gdScaleVert(tmp_im, new_width, src_height, dst, new_width, new_height);
|
||||
gdImageDestroy(tmp_im);
|
||||
gdFree(tmp_im);
|
||||
|
||||
return dst;
|
||||
}
|
||||
@@ -2178,13 +2173,10 @@ gdImagePtr gdImageRotateInterpolated(const gdImagePtr src, const float angle, in
|
||||
|
||||
/* no interpolation needed here */
|
||||
switch (angle_rounded) {
|
||||
case -27000:
|
||||
case 9000:
|
||||
case 9000:
|
||||
return gdImageRotate90(src, 0);
|
||||
case -18000:
|
||||
case 18000:
|
||||
case 18000:
|
||||
return gdImageRotate180(src, 0);
|
||||
case -9000:
|
||||
case 27000:
|
||||
return gdImageRotate270(src, 0);
|
||||
}
|
||||
|
||||
+16
-30
@@ -57,21 +57,21 @@ static inline int clip(float v, int a, int b) {
|
||||
return (v > b) ? b : (v < 0) ? 0 : (int)(v);
|
||||
}
|
||||
enum {
|
||||
COLOR_RED = 1,
|
||||
COLOR_GREEN = 2,
|
||||
COLOR_BLUE = 3,
|
||||
ALPHA_CHANNEL = 0
|
||||
COLOR_RED = 0,
|
||||
COLOR_GREEN = 1,
|
||||
COLOR_BLUE = 2,
|
||||
ALPHA_CHANNEL = 3
|
||||
};
|
||||
|
||||
/* endian neutral extractions of ARGB from a 32 bit pixel */
|
||||
/* endian neutral extractions of RGBA from a 32 bit pixel */
|
||||
static const uint32 RED_SHIFT =
|
||||
8 * (sizeof(uint32) - 1 - COLOR_RED); /* 16 */
|
||||
8 * (sizeof(uint32) - 1 - COLOR_RED); /* 24 */
|
||||
static const uint32 GREEN_SHIFT =
|
||||
8 * (sizeof(uint32) - 1 - COLOR_GREEN); /* 8 */
|
||||
8 * (sizeof(uint32) - 1 - COLOR_GREEN); /* 16 */
|
||||
static const uint32 BLUE_SHIFT =
|
||||
8 * (sizeof(uint32) - 1 - COLOR_BLUE); /* 0 */
|
||||
8 * (sizeof(uint32) - 1 - COLOR_BLUE); /* 8 */
|
||||
static const uint32 ALPHA_SHIFT =
|
||||
8 * (sizeof(uint32) - 1 - ALPHA_CHANNEL); /* 24 */
|
||||
8 * (sizeof(uint32) - 1 - ALPHA_CHANNEL); /* 0 */
|
||||
|
||||
static inline int GetRed(const uint32* rgba) {
|
||||
return gdTrueColorGetRed(*rgba);
|
||||
@@ -706,14 +706,14 @@ static WebPResult VPXEncode(const uint8* Y,
|
||||
codec_ctl(&enc, VP8E_SET_STATIC_THRESHOLD, 0);
|
||||
codec_ctl(&enc, VP8E_SET_TOKEN_PARTITIONS, 2);
|
||||
|
||||
vpx_img_wrap(&img, VPX_IMG_FMT_I420,
|
||||
vpx_img_wrap(&img, IMG_FMT_I420,
|
||||
y_width, y_height, 16, (uint8*)(Y));
|
||||
img.planes[VPX_PLANE_Y] = (uint8*)(Y);
|
||||
img.planes[VPX_PLANE_U] = (uint8*)(U);
|
||||
img.planes[VPX_PLANE_V] = (uint8*)(V);
|
||||
img.stride[VPX_PLANE_Y] = y_stride;
|
||||
img.stride[VPX_PLANE_U] = uv_stride;
|
||||
img.stride[VPX_PLANE_V] = uv_stride;
|
||||
img.planes[PLANE_Y] = (uint8*)(Y);
|
||||
img.planes[PLANE_U] = (uint8*)(U);
|
||||
img.planes[PLANE_V] = (uint8*)(V);
|
||||
img.stride[PLANE_Y] = y_stride;
|
||||
img.stride[PLANE_U] = uv_stride;
|
||||
img.stride[PLANE_V] = uv_stride;
|
||||
|
||||
res = vpx_codec_encode(&enc, &img, 0, 1, 0, VPX_DL_BEST_QUALITY);
|
||||
|
||||
@@ -779,20 +779,6 @@ WebPResult WebPEncode(const uint8* Y,
|
||||
(chunk_size >> 24) & 255 };
|
||||
memcpy(*p_out, kRiffHeader, kRiffHeaderSize);
|
||||
|
||||
if (img_size_bytes & 1) { /* write a padding byte */
|
||||
const int new_size = *p_out_size_bytes + 1;
|
||||
unsigned char* p = (unsigned char*)realloc(*p_out, new_size);
|
||||
if (p == NULL) {
|
||||
free(*p_out);
|
||||
*p_out = NULL;
|
||||
*p_out_size_bytes = 0;
|
||||
return webp_failure;
|
||||
}
|
||||
p[new_size - 1] = 0;
|
||||
*p_out = p;
|
||||
*p_out_size_bytes = new_size;
|
||||
}
|
||||
|
||||
if (psnr) {
|
||||
*psnr = WebPGetPSNR(Y, U, V, *p_out, *p_out_size_bytes);
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
--TEST--
|
||||
Bug #53154 (Zero-height rectangle has whiskers)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreatetruecolor(100, 10);
|
||||
$red = imagecolorallocate($im, 255, 0, 0);
|
||||
imagerectangle($im, 5, 5, 95, 5, $red);
|
||||
var_dump(imagecolorat($im, 5, 4) !== $red);
|
||||
var_dump(imagecolorat($im, 5, 6) !== $red);
|
||||
var_dump(imagecolorat($im, 95, 4) !== $red);
|
||||
var_dump(imagecolorat($im, 95, 6) !== $red);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
@@ -1,57 +0,0 @@
|
||||
--TEST--
|
||||
Bug #53156 (imagerectangle problem with point ordering)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
function draw_and_check_pixel($x, $y)
|
||||
{
|
||||
global $img, $black, $red;
|
||||
|
||||
echo (imagecolorat($img, $x, $y) === $black) ? '+' : '-';
|
||||
imagesetpixel($img, $x, $y, $red);
|
||||
}
|
||||
|
||||
function draw_and_check_rectangle($x1, $y1, $x2, $y2)
|
||||
{
|
||||
global $img, $black;
|
||||
|
||||
echo 'Rectangle: ';
|
||||
imagerectangle($img, $x1, $y1, $x2, $y2, $black);
|
||||
$x = ($x1 + $x2) / 2;
|
||||
$y = ($y1 + $y2) / 2;
|
||||
draw_and_check_pixel($x, $y1);
|
||||
draw_and_check_pixel($x1, $y);
|
||||
draw_and_check_pixel($x, $y2);
|
||||
draw_and_check_pixel($x2, $y);
|
||||
echo PHP_EOL;
|
||||
}
|
||||
|
||||
$img = imagecreate(110, 210);
|
||||
$bgnd = imagecolorallocate($img, 255, 255, 255);
|
||||
$black = imagecolorallocate($img, 0, 0, 0);
|
||||
$red = imagecolorallocate($img, 255, 0, 0);
|
||||
|
||||
draw_and_check_rectangle( 10, 10, 50, 50);
|
||||
draw_and_check_rectangle( 50, 60, 10, 100);
|
||||
draw_and_check_rectangle( 50, 150, 10, 110);
|
||||
draw_and_check_rectangle( 10, 200, 50, 160);
|
||||
imagesetthickness($img, 4);
|
||||
draw_and_check_rectangle( 60, 10, 100, 50);
|
||||
draw_and_check_rectangle(100, 60, 60, 100);
|
||||
draw_and_check_rectangle(100, 150, 60, 110);
|
||||
draw_and_check_rectangle( 60, 200, 100, 160);
|
||||
|
||||
//imagepng($img, __DIR__ . '/bug53156.png'); // debug
|
||||
?>
|
||||
--EXPECT--
|
||||
Rectangle: ++++
|
||||
Rectangle: ++++
|
||||
Rectangle: ++++
|
||||
Rectangle: ++++
|
||||
Rectangle: ++++
|
||||
Rectangle: ++++
|
||||
Rectangle: ++++
|
||||
Rectangle: ++++
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
Bug #53640 (XBM images require width to be multiple of 8)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreate(9, 9);
|
||||
imagecolorallocate($im, 0, 0, 0); // background
|
||||
$white = imagecolorallocate($im, 255, 255, 255);
|
||||
imagefilledrectangle($im, 2, 2, 6, 6, $white);
|
||||
imagexbm($im, NULL);
|
||||
?>
|
||||
--XFAIL--
|
||||
Padding is not implemented yet
|
||||
--EXPECT--
|
||||
#define image_width 9
|
||||
#define image_height 9
|
||||
static unsigned char image_bits[] = {
|
||||
0xFF, 0x01, 0xFF, 0x01, 0x83, 0x01, 0x83, 0x01, 0x83, 0x01, 0x83, 0x01,
|
||||
0x83, 0x01, 0xFF, 0x01, 0xFF, 0x01};
|
||||
@@ -1,23 +0,0 @@
|
||||
--TEST--
|
||||
Bug #61221 - imagegammacorrect function loses alpha channel
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$imagew = 50;
|
||||
$imageh = 50;
|
||||
$img = imagecreatetruecolor($imagew, $imageh);
|
||||
$blacktransparent = imagecolorallocatealpha($img, 0, 0, 0, 127);
|
||||
$redsolid = imagecolorallocate($img, 255, 0, 0);
|
||||
imagefill($img, 0, 0, $blacktransparent);
|
||||
imageline($img, $imagew / 2, 0, $imagew / 2, $imageh - 1, $redsolid);
|
||||
imageline($img, 0, $imageh / 2, $imagew - 1, $imageh / 2, $redsolid);
|
||||
imagegammacorrect($img, 1, 1);
|
||||
$color = imagecolorat($img, 0, 0);
|
||||
var_dump($color === $blacktransparent);
|
||||
imagedestroy($img);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -1,31 +0,0 @@
|
||||
--TEST--
|
||||
Bug #66339 (PHP segfaults in imagexbm)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreate(8, 8);
|
||||
imagecolorallocate($im, 0, 0, 0); // background
|
||||
$white = imagecolorallocate($im, 255, 255, 255);
|
||||
imagefilledrectangle($im, 2, 2, 6, 6, $white);
|
||||
imagexbm($im, NULL);
|
||||
echo "------------\n";
|
||||
imagexbm($im, './bug66339.xbm');
|
||||
echo file_get_contents('./bug66339.xbm');
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink('./bug66339.xbm');
|
||||
?>
|
||||
--EXPECT--
|
||||
#define image_width 8
|
||||
#define image_height 8
|
||||
static unsigned char image_bits[] = {
|
||||
0xFF, 0xFF, 0x83, 0x83, 0x83, 0x83, 0x83, 0xFF};
|
||||
------------
|
||||
#define bug66339_width 8
|
||||
#define bug66339_height 8
|
||||
static unsigned char bug66339_bits[] = {
|
||||
0xFF, 0xFF, 0x83, 0x83, 0x83, 0x83, 0x83, 0xFF};
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
Bug #66387 (Stack overflow with imagefilltoborder)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available!');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreatetruecolor(20, 20);
|
||||
$c = imagecolorallocate($im, 255, 0, 0);
|
||||
imagefilltoborder($im, 0, -999355, $c, $c);
|
||||
echo "ready\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
ready
|
||||
@@ -1,27 +0,0 @@
|
||||
--TEST--
|
||||
Bug #66590 (imagewebp() doesn't pad to even length)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
if (!function_exists('imagewebp')) die('skip WebP support not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$filename = __DIR__ . '/bug66590.webp';
|
||||
$im = imagecreatetruecolor(75, 75);
|
||||
$red = imagecolorallocate($im, 255, 0, 0);
|
||||
imagefilledrectangle($im, 0, 0, 74, 74, $red);
|
||||
imagewebp($im, $filename);
|
||||
$stream = fopen($filename, 'rb');
|
||||
fread($stream, 4); // skip "RIFF"
|
||||
$length = fread($stream, 4);
|
||||
fclose($stream);
|
||||
$length = unpack('V', $length)[1] + 8;
|
||||
var_dump($length === filesize($filename));
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__ . '/bug66590.webp');
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Bug #66590 (imagewebp() doesn't pad to even length) - segfault
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
if (!function_exists('imagewebp')) die('skip WebP support not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreatetruecolor(6, 6);
|
||||
ob_start();
|
||||
imagewebp($im);
|
||||
ob_end_clean();
|
||||
echo "ready\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
ready
|
||||
@@ -1,14 +0,0 @@
|
||||
--TEST--
|
||||
Bug #66882 (imagerotate by -90 degrees truncates image by 1px)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagerotate(imagecreate(10, 10), -90, 0);
|
||||
var_dump(imagesy($im), imagesx($im));
|
||||
?>
|
||||
--EXPECT--
|
||||
int(10)
|
||||
int(10)
|
||||
@@ -1,26 +0,0 @@
|
||||
--TEST--
|
||||
Bug #67447 (imagecrop() adds a black line when cropping)
|
||||
--FILE--
|
||||
<?php
|
||||
// true color
|
||||
$image = imagecreatetruecolor(500, 500);
|
||||
$red = imagecolorallocate($image, 255, 0, 0);
|
||||
imagefill($image, 0, 0, $red);
|
||||
$cropped = imagecrop($image, ['x' => 0, 'y' => 0, 'width' => 250, 'height' => 250]);
|
||||
var_dump(imagecolorat($cropped, 249, 249) === $red);
|
||||
imagedestroy($image);
|
||||
imagedestroy($cropped);
|
||||
|
||||
// palette
|
||||
$image = imagecreate(500, 500);
|
||||
imagecolorallocate($image, 0, 0, 255); // first palette color = background
|
||||
$red = imagecolorallocate($image, 255, 0, 0);
|
||||
imagefill($image, 0, 0, $red);
|
||||
$cropped = imagecrop($image, ['x' => 0, 'y' => 0, 'width' => 250, 'height' => 250]);
|
||||
var_dump(imagecolorat($cropped, 249, 249) === $red);
|
||||
imagedestroy($image);
|
||||
imagedestroy($cropped);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
Bug #69024 (imagescale segfault with palette based image)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreate(256, 256);
|
||||
imagescale($im, 32, 32, IMG_BICUBIC);
|
||||
imagedestroy($im);
|
||||
echo "done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
done
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70047 (gd_info() doesn't report WebP support)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$info = gd_info();
|
||||
var_dump(array_key_exists('WebP Support', $info));
|
||||
var_dump($info['WebP Support'] === function_exists('imagewebp'));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
@@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70102 (imagecreatefromwebm() shifts colors)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
if (!function_exists('imagewebp') || !function_exists('imagecreatefromwebp'))
|
||||
die('skip WebP support not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$filename = __DIR__ . '/bug70102.webp';
|
||||
|
||||
$im = imagecreatetruecolor(8, 8);
|
||||
$white = imagecolorallocate($im, 255, 255, 255);
|
||||
var_dump($white & 0xffffff);
|
||||
imagefilledrectangle($im, 0, 0, 7, 7, $white);
|
||||
imagewebp($im, $filename);
|
||||
imagedestroy($im);
|
||||
|
||||
$im = imagecreatefromwebp($filename);
|
||||
$color = imagecolorat($im, 4, 4);
|
||||
var_dump($color & 0xffffff);
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(__DIR__ . '/bug70102.webp');
|
||||
?>
|
||||
--EXPECT--
|
||||
int(16777215)
|
||||
int(16777215)
|
||||
@@ -1,25 +0,0 @@
|
||||
--TEST--
|
||||
Testing imagefilledellipse() of GD library
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("gd")) die("skip GD not present");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$image = imagecreatetruecolor(100, 100);
|
||||
|
||||
$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
|
||||
|
||||
//create an ellipse and fill it with white color
|
||||
imagefilledellipse($image, 50, 50, 40, 30, $white);
|
||||
|
||||
ob_start();
|
||||
imagepng($image);
|
||||
$img = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
echo md5(base64_encode($img));
|
||||
?>
|
||||
--EXPECT--
|
||||
9ba540bba1b78c9f08efaa6fa0afd93b
|
||||
@@ -8,7 +8,7 @@ rmdir($tempdir);
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
$support = gd_info();
|
||||
if (!isset($support['WebP Support']) || $support['WebP Support'] === false) {
|
||||
if (!isset($support['WEBP Support']) || $support['WEBP Support'] === false) {
|
||||
print 'skip webp support not available';
|
||||
}
|
||||
?>
|
||||
@@ -30,9 +30,9 @@ imagewebp($image, $temp);
|
||||
var_dump(file_exists($tempdir. "/test1"));
|
||||
var_dump(file_exists($tempdir. "/test1.tmp"));
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
?>
|
||||
|
||||
--EXPECTF--
|
||||
imagewebp TEST
|
||||
imagewbmp TEST
|
||||
|
||||
Warning: imagewebp(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
|
||||
bool(false)
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* A very simple algorithm for finding the dissimilarity between images,
|
||||
* mainly useful for checking lossy compression.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the individual components of an RGB value.
|
||||
*
|
||||
* @param int $color
|
||||
* @param int $red
|
||||
* @param int $green
|
||||
* @param int $blue
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function get_rgb($color, &$red, &$green, &$blue)
|
||||
{
|
||||
// assumes $color is an RGB value
|
||||
$red = ($color >> 16) & 0xFF;
|
||||
$green = ($color >> 8) & 0xFF;
|
||||
$blue = $color & 0xFF;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the euclidean distance of two RGB values.
|
||||
*
|
||||
* @param int $color1
|
||||
* @param int $color2
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function calc_pixel_distance($color1, $color2)
|
||||
{
|
||||
get_rgb($color1, $red1, $green1, $blue1);
|
||||
get_rgb($color2, $red2, $green2, $blue2);
|
||||
return sqrt(
|
||||
pow($red1 - $red2, 2) + pow($green1 - $green2, 2) + pow($blue1 - $blue2, 2)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates dissimilarity of two images.
|
||||
*
|
||||
* @param resource $image1
|
||||
* @param resource $image2
|
||||
*
|
||||
* @return int The dissimilarity. 0 means the images are identical. The higher
|
||||
* the value, the more dissimilar are the images.
|
||||
*/
|
||||
function calc_image_dissimilarity($image1, $image2)
|
||||
{
|
||||
// assumes image1 and image2 have same width and height
|
||||
$dissimilarity = 0;
|
||||
for ($i = 0, $n = imagesx($image1); $i < $n; $i++) {
|
||||
for ($j = 0, $m = imagesy($image1); $j < $m; $j++) {
|
||||
$color1 = imagecolorat($image1, $i, $j);
|
||||
$color2 = imagecolorat($image2, $i, $j);
|
||||
$dissimilarity += calc_pixel_distance($color1, $color2);
|
||||
}
|
||||
}
|
||||
return $dissimilarity;
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
--TEST--
|
||||
imagewebp() and imagecreatefromwebp() - basic test
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
if (!function_exists('imagewebp') || !function_exists('imagecreatefromwebp'))
|
||||
die('skip WebP support not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . '/similarity.inc';
|
||||
|
||||
$filename = __DIR__ . '/webp_basic.webp';
|
||||
|
||||
$im1 = imagecreatetruecolor(75, 75);
|
||||
$white = imagecolorallocate($im1, 255, 255, 255);
|
||||
$red = imagecolorallocate($im1, 255, 0, 0);
|
||||
$green = imagecolorallocate($im1, 0, 255, 0);
|
||||
$blue = imagecolorallocate($im1, 0, 0, 255);
|
||||
imagefilledrectangle($im1, 0, 0, 74, 74, $white);
|
||||
imageline($im1, 3, 3, 71, 71, $red);
|
||||
imageellipse($im1, 18, 54, 36, 36, $green);
|
||||
imagerectangle($im1, 41, 3, 71, 33, $blue);
|
||||
imagewebp($im1, $filename);
|
||||
|
||||
$im2 = imagecreatefromwebp($filename);
|
||||
imagewebp($im2, $filename);
|
||||
var_dump(calc_image_dissimilarity($im1, $im2) < 10e5);
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__ . '/webp_basic.webp');
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
+16
-20
@@ -630,7 +630,7 @@ static int gmp_unserialize(zval **object, zend_class_entry *ce, const unsigned c
|
||||
{
|
||||
mpz_ptr gmpnum;
|
||||
const unsigned char *p, *max;
|
||||
zval *zv_ptr;
|
||||
zval zv, *zv_ptr = &zv;
|
||||
int retval = FAILURE;
|
||||
php_unserialize_data_t unserialize_data = (php_unserialize_data_t) data;
|
||||
|
||||
@@ -640,7 +640,7 @@ static int gmp_unserialize(zval **object, zend_class_entry *ce, const unsigned c
|
||||
p = buf;
|
||||
max = buf + buf_len;
|
||||
|
||||
ALLOC_INIT_ZVAL(zv_ptr);
|
||||
INIT_ZVAL(zv);
|
||||
if (!php_var_unserialize(&zv_ptr, &p, max, &unserialize_data TSRMLS_CC)
|
||||
|| Z_TYPE_P(zv_ptr) != IS_STRING
|
||||
|| convert_to_gmp(gmpnum, zv_ptr, 10 TSRMLS_CC) == FAILURE
|
||||
@@ -648,9 +648,9 @@ static int gmp_unserialize(zval **object, zend_class_entry *ce, const unsigned c
|
||||
zend_throw_exception(NULL, "Could not unserialize number", 0 TSRMLS_CC);
|
||||
goto exit;
|
||||
}
|
||||
var_push_dtor_no_addref(&unserialize_data, &zv_ptr);
|
||||
zval_dtor(&zv);
|
||||
|
||||
ALLOC_INIT_ZVAL(zv_ptr);
|
||||
INIT_ZVAL(zv);
|
||||
if (!php_var_unserialize(&zv_ptr, &p, max, &unserialize_data TSRMLS_CC)
|
||||
|| Z_TYPE_P(zv_ptr) != IS_ARRAY
|
||||
) {
|
||||
@@ -667,7 +667,7 @@ static int gmp_unserialize(zval **object, zend_class_entry *ce, const unsigned c
|
||||
|
||||
retval = SUCCESS;
|
||||
exit:
|
||||
var_push_dtor_no_addref(&unserialize_data, &zv_ptr);
|
||||
zval_dtor(&zv);
|
||||
PHP_VAR_UNSERIALIZE_DESTROY(unserialize_data);
|
||||
return retval;
|
||||
}
|
||||
@@ -1841,7 +1841,6 @@ ZEND_FUNCTION(gmp_random_range)
|
||||
{
|
||||
zval *min_arg, *max_arg;
|
||||
mpz_ptr gmpnum_min, gmpnum_max, gmpnum_result;
|
||||
mpz_t gmpnum_range;
|
||||
gmp_temp_t temp_a, temp_b;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &min_arg, &max_arg) == FAILURE) {
|
||||
@@ -1860,23 +1859,22 @@ ZEND_FUNCTION(gmp_random_range)
|
||||
}
|
||||
|
||||
INIT_GMP_RETVAL(gmpnum_result);
|
||||
mpz_init(gmpnum_range);
|
||||
|
||||
if (Z_LVAL_P(min_arg) != 0) {
|
||||
mpz_sub_ui(gmpnum_range, gmpnum_max, Z_LVAL_P(min_arg) - 1);
|
||||
} else {
|
||||
mpz_add_ui(gmpnum_range, gmpnum_max, 1);
|
||||
if (Z_LVAL_P(min_arg)) {
|
||||
mpz_sub_ui(gmpnum_max, gmpnum_max, Z_LVAL_P(min_arg));
|
||||
}
|
||||
|
||||
mpz_urandomm(gmpnum_result, GMPG(rand_state), gmpnum_range);
|
||||
mpz_add_ui(gmpnum_max, gmpnum_max, 1);
|
||||
mpz_urandomm(gmpnum_result, GMPG(rand_state), gmpnum_max);
|
||||
|
||||
if (Z_LVAL_P(min_arg) != 0) {
|
||||
if (Z_LVAL_P(min_arg)) {
|
||||
mpz_add_ui(gmpnum_result, gmpnum_result, Z_LVAL_P(min_arg));
|
||||
}
|
||||
|
||||
mpz_clear(gmpnum_range);
|
||||
FREE_GMP_TEMP(temp_a);
|
||||
} else {
|
||||
|
||||
}
|
||||
else {
|
||||
FETCH_GMP_ZVAL_DEP(gmpnum_min, min_arg, temp_b, temp_a);
|
||||
|
||||
if (mpz_cmp(gmpnum_max, gmpnum_min) <= 0) {
|
||||
@@ -1887,14 +1885,12 @@ ZEND_FUNCTION(gmp_random_range)
|
||||
}
|
||||
|
||||
INIT_GMP_RETVAL(gmpnum_result);
|
||||
mpz_init(gmpnum_range);
|
||||
|
||||
mpz_sub(gmpnum_range, gmpnum_max, gmpnum_min);
|
||||
mpz_add_ui(gmpnum_range, gmpnum_range, 1);
|
||||
mpz_urandomm(gmpnum_result, GMPG(rand_state), gmpnum_range);
|
||||
mpz_sub(gmpnum_max, gmpnum_max, gmpnum_min);
|
||||
mpz_add_ui(gmpnum_max, gmpnum_max, 1);
|
||||
mpz_urandomm(gmpnum_result, GMPG(rand_state), gmpnum_max);
|
||||
mpz_add(gmpnum_result, gmpnum_result, gmpnum_min);
|
||||
|
||||
mpz_clear(gmpnum_range);
|
||||
FREE_GMP_TEMP(temp_b);
|
||||
FREE_GMP_TEMP(temp_a);
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
Bug #69803: gmp_random_range() modifies second parameter if GMP number
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$a = gmp_init(100);
|
||||
$b = gmp_init(200);
|
||||
echo $a . ", ", $b . "\n";
|
||||
gmp_random_range($a, $b);
|
||||
echo $a . ", ", $b . "\n";
|
||||
|
||||
$b = gmp_init(200);
|
||||
echo $a . ", ", $b . "\n";
|
||||
gmp_random_range(100, $b);
|
||||
echo $a . ", ", $b . "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
100, 200
|
||||
100, 200
|
||||
100, 200
|
||||
100, 200
|
||||
@@ -1,50 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70284 (Use after free vulnerability in unserialize() with GMP)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gmp")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$inner = 'r:2;a:1:{i:0;a:1:{i:0;r:4;}}';
|
||||
$exploit = 'a:2:{i:0;s:1:"1";i:1;C:3:"GMP":'.strlen($inner).':{'.$inner.'}}';
|
||||
|
||||
$data = unserialize($exploit);
|
||||
|
||||
$fakezval = ptr2str(1122334455);
|
||||
$fakezval .= ptr2str(0);
|
||||
$fakezval .= "\x00\x00\x00\x00";
|
||||
$fakezval .= "\x01";
|
||||
$fakezval .= "\x00";
|
||||
$fakezval .= "\x00\x00";
|
||||
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$v[$i] = $fakezval.$i;
|
||||
}
|
||||
|
||||
var_dump($data);
|
||||
|
||||
function ptr2str($ptr)
|
||||
{
|
||||
$out = '';
|
||||
for ($i = 0; $i < 8; $i++) {
|
||||
$out .= chr($ptr & 0xff);
|
||||
$ptr >>= 8;
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
object(GMP)#%d (2) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
NULL
|
||||
}
|
||||
["num"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,8 @@ gmp_random_range() basic tests
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$minusTen = gmp_init(-10);
|
||||
$plusTen = gmp_init(10);
|
||||
$minusTen = gmp_init(-1);
|
||||
$plusTen = gmp_init(1);
|
||||
$zero = gmp_init(0);
|
||||
|
||||
var_dump(gmp_random_range());
|
||||
|
||||
@@ -336,7 +336,7 @@ PHP_HASH_API void PHP_HAVAL128Final(unsigned char *digest, PHP_HAVAL_CTX * conte
|
||||
|
||||
/* Pad out to 118 mod 128.
|
||||
*/
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x7f);
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
|
||||
padLen = (index < 118) ? (118 - index) : (246 - index);
|
||||
PHP_HAVALUpdate(context, PADDING, padLen);
|
||||
|
||||
@@ -390,7 +390,7 @@ PHP_HASH_API void PHP_HAVAL160Final(unsigned char *digest, PHP_HAVAL_CTX * conte
|
||||
|
||||
/* Pad out to 118 mod 128.
|
||||
*/
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x7f);
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
|
||||
padLen = (index < 118) ? (118 - index) : (246 - index);
|
||||
PHP_HAVALUpdate(context, PADDING, padLen);
|
||||
|
||||
@@ -444,7 +444,7 @@ PHP_HASH_API void PHP_HAVAL192Final(unsigned char *digest, PHP_HAVAL_CTX * conte
|
||||
|
||||
/* Pad out to 118 mod 128.
|
||||
*/
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x7f);
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
|
||||
padLen = (index < 118) ? (118 - index) : (246 - index);
|
||||
PHP_HAVALUpdate(context, PADDING, padLen);
|
||||
|
||||
@@ -484,7 +484,7 @@ PHP_HASH_API void PHP_HAVAL224Final(unsigned char *digest, PHP_HAVAL_CTX * conte
|
||||
|
||||
/* Pad out to 118 mod 128.
|
||||
*/
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x7f);
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
|
||||
padLen = (index < 118) ? (118 - index) : (246 - index);
|
||||
PHP_HAVALUpdate(context, PADDING, padLen);
|
||||
|
||||
@@ -525,7 +525,7 @@ PHP_HASH_API void PHP_HAVAL256Final(unsigned char *digest, PHP_HAVAL_CTX * conte
|
||||
|
||||
/* Pad out to 118 mod 128.
|
||||
*/
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x7f);
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
|
||||
padLen = (index < 118) ? (118 - index) : (246 - index);
|
||||
PHP_HAVALUpdate(context, PADDING, padLen);
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
--TEST--
|
||||
Bug #70312 HAVAL gives wrong hashes in specific cases
|
||||
--SKIPIF--
|
||||
<?php if(!extension_loaded("hash")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(hash('haval128,5', '1234567890123456789012345678901234567890123456789012345678901234'));
|
||||
var_dump(hash('haval160,5', '1234567890123456789012345678901234567890123456789012345678901234'));
|
||||
var_dump(hash('haval192,5', '1234567890123456789012345678901234567890123456789012345678901234'));
|
||||
var_dump(hash('haval224,5', '1234567890123456789012345678901234567890123456789012345678901234'));
|
||||
var_dump(hash('haval256,5', '1234567890123456789012345678901234567890123456789012345678901234'));
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(32) "f3f0d23819b87228b4b70ee350afaa9d"
|
||||
string(40) "aded6485e137f11d7292212ba3fa961714df0564"
|
||||
string(48) "e53da2b16269fe732e9a898a96707a9f28404d7333b02286"
|
||||
string(56) "c574fb307f0817b514b9bb2e7c4bfaffb7ad667aca3c8b523fefcf10"
|
||||
string(64) "fb73c19300b14d5cb393d929bf005e6c2d459a4c9c009e9813af1d2d3637ee8f"
|
||||
@@ -64,7 +64,7 @@ unlink($file);
|
||||
adler32: ff87222e
|
||||
crc32: 61664d33
|
||||
gost: d9e65f0c0c2ef944e4f8a01f4a46365c4f33a2853756878182a7f03e1490a4cd
|
||||
haval128,3: c25962b13383c3ed9f13817c8f2ae7d6
|
||||
haval128,3: 8bb81269aca8b7f87829020d76a4e841
|
||||
md2: 70f791c0d8fa9edd7d08e32fcba8c354
|
||||
md4: a9d034b16bb290c57a645afd6f14cd3b
|
||||
md5: 704bf818448f5bbb94061332d2c889aa
|
||||
|
||||
@@ -45,7 +45,7 @@ echo "sha256(raw): " . bin2hex(hash_hmac('sha256', $content, $key, TRUE)) . "\n"
|
||||
adler32: 12c803f7
|
||||
crc32: 96859101
|
||||
gost: a4a3c80bdf3f8665bf07376a34dc9c1b11af7c813f4928f62e39f0c0dc564dad
|
||||
haval128,3: 4d1318607f0406bd1b7bd50907772672
|
||||
haval128,3: 82cd0f4bd36729b5c80c33efa8c13ac5
|
||||
md2: 6d111dab563025e4cb5f4425c991fa12
|
||||
md4: 10cdbfe843000c623f8b8da0d5d20b0b
|
||||
md5: 2a632783e2812cf23de100d7d6a463ae
|
||||
|
||||
@@ -73,7 +73,7 @@ unlink($file);
|
||||
adler32: 0f8c02f9
|
||||
crc32: f2a60b9c
|
||||
gost: 94c39a40d5db852a8dc3d24e37eebf2d53e3d711457c59cd02b614f792a9d918
|
||||
haval128,3: f1cea637451097d790354a86de3f54a3
|
||||
haval128,3: e8fcff647f1a675acb429130fb94a17e
|
||||
md2: a685475e600314bb549ab4f33c3b27cb
|
||||
md4: cbc6bff781f48f57378d3effa27553e4
|
||||
md5: 8bddf39dd1c566c27acc7fa85ec36acf
|
||||
|
||||
+4
-35
@@ -35,7 +35,7 @@ if test "$PHP_ICONV" != "no"; then
|
||||
PHP_ICONV_H_PATH="$PHP_ICONV_PREFIX/include/giconv.h"
|
||||
else
|
||||
PHP_ICONV_H_PATH="$PHP_ICONV_PREFIX/include/iconv.h"
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([if iconv is glibc's])
|
||||
AC_TRY_LINK([#include <gnu/libc-version.h>],[gnu_get_libc_version();],
|
||||
@@ -53,8 +53,8 @@ if test "$PHP_ICONV" != "no"; then
|
||||
AC_TRY_RUN([
|
||||
#include <$PHP_ICONV_H_PATH>
|
||||
int main() {
|
||||
printf("%d", _libiconv_version);
|
||||
return 0;
|
||||
printf("%d", _libiconv_version);
|
||||
return 0;
|
||||
}
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
@@ -138,7 +138,7 @@ int main() {
|
||||
if (cd == (iconv_t)(-1)) {
|
||||
if (errno == EINVAL) {
|
||||
return 0;
|
||||
} else {
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -159,37 +159,6 @@ int main() {
|
||||
AC_DEFINE([ICONV_SUPPORTS_ERRNO],0,[Whether iconv supports error no or not])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([if iconv supports //IGNORE])
|
||||
AC_TRY_RUN([
|
||||
#include <$PHP_ICONV_H_PATH>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main() {
|
||||
iconv_t cd = iconv_open( "UTF-8//IGNORE", "UTF-8" );
|
||||
char *in_p = "\xC3\xC3\xC3\xB8";
|
||||
size_t in_left = 4, out_left = 4096;
|
||||
char *out = malloc(out_left);
|
||||
char *out_p = out;
|
||||
size_t result = iconv(cd, (char **) &in_p, &in_left, (char **) &out_p, &out_left);
|
||||
if(result == (size_t)-1) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
PHP_DEFINE([ICONV_BROKEN_IGNORE],0,[ext/iconv])
|
||||
AC_DEFINE([ICONV_BROKEN_IGNORE],0,[Whether iconv supports IGNORE])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
PHP_DEFINE([ICONV_BROKEN_IGNORE],1,[ext/iconv])
|
||||
AC_DEFINE([ICONV_BROKEN_IGNORE],1,[Whether iconv supports IGNORE])
|
||||
],[
|
||||
AC_MSG_RESULT(no, cross-compiling)
|
||||
PHP_DEFINE([ICONV_BROKEN_IGNORE],0,[ext/iconv])
|
||||
AC_DEFINE([ICONV_BROKEN_IGNORE],0,[Whether iconv supports IGNORE])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([if your cpp allows macro usage in include lines])
|
||||
AC_TRY_COMPILE([
|
||||
#define FOO <$PHP_ICONV_H_PATH>
|
||||
|
||||
@@ -529,24 +529,6 @@ static php_iconv_err_t _php_iconv_appendc(smart_str *d, const char c, iconv_t cd
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
#if ICONV_BROKEN_IGNORE
|
||||
static int _php_check_ignore(const char *charset)
|
||||
{
|
||||
size_t clen = strlen(charset);
|
||||
if (clen >= 9 && strcmp("//IGNORE", charset+clen-8) == 0) {
|
||||
return 1;
|
||||
}
|
||||
if (clen >= 19 && strcmp("//IGNORE//TRANSLIT", charset+clen-18) == 0) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#define _php_check_ignore(x) (0)
|
||||
#endif
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_iconv_string()
|
||||
*/
|
||||
PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len,
|
||||
@@ -628,7 +610,6 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len,
|
||||
char *out_p, *out_buf, *tmp_buf;
|
||||
size_t bsz, result = 0;
|
||||
php_iconv_err_t retval = PHP_ICONV_ERR_SUCCESS;
|
||||
int ignore_ilseq = _php_check_ignore(out_charset);
|
||||
|
||||
*out = NULL;
|
||||
*out_len = 0;
|
||||
@@ -653,17 +634,6 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len,
|
||||
result = iconv(cd, (char **) &in_p, &in_left, (char **) &out_p, &out_left);
|
||||
out_size = bsz - out_left;
|
||||
if (result == (size_t)(-1)) {
|
||||
if (ignore_ilseq && errno == EILSEQ) {
|
||||
if (in_left <= 1) {
|
||||
result = 0;
|
||||
} else {
|
||||
errno = 0;
|
||||
in_p++;
|
||||
in_left--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (errno == E2BIG && in_left > 0) {
|
||||
/* converted string is longer than out buffer */
|
||||
bsz += in_len;
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
--TEST--
|
||||
Bug #48147 (iconv with //IGNORE cuts the string)
|
||||
--SKIPIF--
|
||||
<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$text = "aa\xC3\xC3\xC3\xB8aa";
|
||||
var_dump(iconv("UTF-8", "UTF-8", $text));
|
||||
var_dump(urlencode(iconv("UTF-8", "UTF-8//IGNORE", $text)));
|
||||
// only invalid
|
||||
var_dump(urlencode(iconv("UTF-8", "UTF-8//IGNORE", "\xC3")));
|
||||
// start invalid
|
||||
var_dump(urlencode(iconv("UTF-8", "UTF-8//IGNORE", "\xC3\xC3\xC3\xB8aa")));
|
||||
// finish invalid
|
||||
var_dump(urlencode(iconv("UTF-8", "UTF-8//IGNORE", "aa\xC3\xC3\xC3")));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: iconv(): Detected an illegal character in input string in %s on line %d
|
||||
bool(false)
|
||||
string(10) "aa%C3%B8aa"
|
||||
|
||||
Notice: iconv(): Detected an incomplete multibyte character in input string in %s on line %d
|
||||
string(0) ""
|
||||
string(8) "%C3%B8aa"
|
||||
|
||||
Notice: iconv(): Detected an incomplete multibyte character in input string in %s on line %d
|
||||
string(0) ""
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
json_last_error() failures
|
||||
--SKIPIF--
|
||||
<?php !extension_loaded('json') && die('skip json extension not available') ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(json_last_error());
|
||||
var_dump(json_last_error(TRUE));
|
||||
var_dump(json_last_error('some', 4, 'args', 'here'));
|
||||
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(0)
|
||||
|
||||
Warning: json_last_error() expects exactly 0 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: json_last_error() expects exactly 0 parameters, 4 given in %s on line %d
|
||||
NULL
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
--TEST--
|
||||
json_last_error_msg() failures
|
||||
--SKIPIF--
|
||||
<?php !extension_loaded('json') && die('skip json extension not available') ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(json_last_error_msg());
|
||||
var_dump(json_last_error_msg(TRUE));
|
||||
var_dump(json_last_error_msg('some', 4, 'args', 'here'));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(8) "No error"
|
||||
|
||||
Warning: json_last_error_msg() expects exactly 0 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: json_last_error_msg() expects exactly 0 parameters, 4 given in %s on line %d
|
||||
NULL
|
||||
|
||||
+13
-13
@@ -58,7 +58,7 @@ AC_DEFUN([PHP_LDAP_SASL_CHECKS], [
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
if test "$LDAP_SASL_DIR"; then
|
||||
LDAP_SASL_INCDIR=$LDAP_SASL_DIR/include
|
||||
LDAP_SASL_LIBDIR=$LDAP_SASL_DIR/$PHP_LIBDIR
|
||||
@@ -71,7 +71,7 @@ AC_DEFUN([PHP_LDAP_SASL_CHECKS], [
|
||||
else
|
||||
SASL_LIB="-L$LDAP_SASL_LIBDIR -lsasl2"
|
||||
fi
|
||||
|
||||
|
||||
PHP_CHECK_LIBRARY(sasl2, sasl_version,
|
||||
[
|
||||
PHP_ADD_INCLUDE($LDAP_SASL_INCDIR)
|
||||
@@ -125,7 +125,7 @@ if test "$PHP_LDAP" != "no"; then
|
||||
PHP_ADD_LIBRARY_WITH_PATH(ldap, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
|
||||
|
||||
elif test -f $LDAP_LIBDIR/libssldap50.$SHLIB_SUFFIX_NAME; then
|
||||
if test -n "$LDAP_PTHREAD"; then
|
||||
if test -n "$LDAP_PTHREAD"; then
|
||||
PHP_ADD_LIBRARY($LDAP_PTHREAD)
|
||||
fi
|
||||
PHP_ADD_LIBRARY_WITH_PATH(nspr4, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
|
||||
@@ -138,7 +138,7 @@ if test "$PHP_LDAP" != "no"; then
|
||||
AC_DEFINE(HAVE_NSLDAP,1,[ ])
|
||||
|
||||
elif test -f $LDAP_LIBDIR/libldapssl41.$SHLIB_SUFFIX_NAME; then
|
||||
if test -n "$LDAP_PTHREAD"; then
|
||||
if test -n "$LDAP_PTHREAD"; then
|
||||
PHP_ADD_LIBRARY($LDAP_PTHREAD)
|
||||
fi
|
||||
PHP_ADD_LIBRARY_WITH_PATH(nspr3, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
|
||||
@@ -148,14 +148,14 @@ if test "$PHP_LDAP" != "no"; then
|
||||
AC_DEFINE(HAVE_NSLDAP,1,[ ])
|
||||
|
||||
elif test -f $LDAP_LIBDIR/libldapssl30.$SHLIB_SUFFIX_NAME; then
|
||||
if test -n "$LDAP_PTHREAD"; then
|
||||
if test -n "$LDAP_PTHREAD"; then
|
||||
PHP_ADD_LIBRARY($LDAP_PTHREAD)
|
||||
fi
|
||||
PHP_ADD_LIBRARY_WITH_PATH(ldapssl30, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
|
||||
AC_DEFINE(HAVE_NSLDAP,1,[ ])
|
||||
|
||||
elif test -f $LDAP_LIBDIR/libldap30.$SHLIB_SUFFIX_NAME; then
|
||||
if test -n "$LDAP_PTHREAD"; then
|
||||
if test -n "$LDAP_PTHREAD"; then
|
||||
PHP_ADD_LIBRARY($LDAP_PTHREAD)
|
||||
fi
|
||||
PHP_ADD_LIBRARY_WITH_PATH(ldap30, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
|
||||
@@ -187,7 +187,7 @@ if test "$PHP_LDAP" != "no"; then
|
||||
PHP_ADD_INCLUDE($LDAP_INCDIR)
|
||||
PHP_SUBST(LDAP_SHARED_LIBADD)
|
||||
AC_DEFINE(HAVE_LDAP,1,[ ])
|
||||
|
||||
|
||||
dnl Save original values
|
||||
_SAVE_CPPFLAGS=$CPPFLAGS
|
||||
_SAVE_LIBS=$LIBS
|
||||
@@ -204,8 +204,8 @@ if test "$PHP_LDAP" != "no"; then
|
||||
|
||||
dnl Solaris 2.8 claims to be 2004 API, but doesn't have
|
||||
dnl ldap_parse_reference() nor ldap_start_tls_s()
|
||||
AC_CHECK_FUNCS([ldap_parse_result ldap_parse_reference ldap_start_tls_s ldap_control_find])
|
||||
|
||||
AC_CHECK_FUNCS([ldap_parse_result ldap_parse_reference ldap_start_tls_s])
|
||||
|
||||
dnl
|
||||
dnl SASL check
|
||||
dnl
|
||||
@@ -215,12 +215,12 @@ if test "$PHP_LDAP" != "no"; then
|
||||
|
||||
dnl
|
||||
dnl Sanity check
|
||||
dnl
|
||||
dnl
|
||||
AC_CHECK_FUNC(ldap_bind_s, [], [
|
||||
AC_MSG_ERROR([LDAP build check failed. Please check config.log for more information.])
|
||||
AC_MSG_ERROR([LDAP build check failed. Please check config.log for more information.])
|
||||
])
|
||||
|
||||
|
||||
dnl Restore original values
|
||||
CPPFLAGS=$_SAVE_CPPFLAGS
|
||||
LIBS=$_SAVE_LIBS
|
||||
fi
|
||||
fi
|
||||
@@ -22,7 +22,6 @@ if (PHP_LDAP != "no") {
|
||||
AC_DEFINE('HAVE_LDAP_SASL', 1);
|
||||
AC_DEFINE('HAVE_LDAP_SASL_SASL_H', 1);
|
||||
AC_DEFINE('LDAP_DEPRECATED', 1);
|
||||
AC_DEFINE('HAVE_LDAP_CONTROL_FIND', 1);
|
||||
|
||||
} else {
|
||||
WARNING("ldap not enabled; libraries and headers not found");
|
||||
|
||||
+94
-157
@@ -22,7 +22,7 @@
|
||||
| PHP 4.0 updates: Zeev Suraski <zeev@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
/* $Id$ */
|
||||
#define IS_EXT_MODULE
|
||||
|
||||
@@ -70,21 +70,6 @@
|
||||
#define PHP_LDAP_ESCAPE_FILTER 0x01
|
||||
#define PHP_LDAP_ESCAPE_DN 0x02
|
||||
|
||||
#if defined(LDAP_CONTROL_PAGEDRESULTS) && !defined(HAVE_LDAP_CONTROL_FIND)
|
||||
LDAPControl *ldap_control_find( const char *oid, LDAPControl **ctrls, LDAPControl ***nextctrlp)
|
||||
{
|
||||
assert(nextctrlp == NULL);
|
||||
return ldap_find_control(oid, ctrls);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(LDAP_API_FEATURE_X_OPENLDAP)
|
||||
void ldap_memvfree(void **v)
|
||||
{
|
||||
ldap_value_free((char **)v);
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
LDAP *link;
|
||||
#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
|
||||
@@ -111,15 +96,13 @@ static void _close_ldap_link(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
ldap_linkdata *ld = (ldap_linkdata *)rsrc->ptr;
|
||||
|
||||
ldap_unbind_ext(ld->link, NULL, NULL);
|
||||
ldap_unbind_s(ld->link);
|
||||
#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
|
||||
|
||||
if (ld->rebindproc != NULL) {
|
||||
zval_dtor(ld->rebindproc);
|
||||
FREE_ZVAL(ld->rebindproc);
|
||||
}
|
||||
#endif
|
||||
|
||||
efree(ld);
|
||||
LDAPG(num_links)--;
|
||||
}
|
||||
@@ -142,7 +125,7 @@ static void _free_ldap_result_entry(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{
|
||||
}
|
||||
zend_list_delete(entry->id);
|
||||
efree(entry);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ PHP_INI_BEGIN
|
||||
@@ -211,10 +194,6 @@ PHP_MINIT_FUNCTION(ldap)
|
||||
REGISTER_LONG_CONSTANT("LDAP_OPT_DEBUG_LEVEL", LDAP_OPT_DEBUG_LEVEL, CONST_PERSISTENT | CONST_CS);
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_OPT_DIAGNOSTIC_MESSAGE
|
||||
REGISTER_LONG_CONSTANT("LDAP_OPT_DIAGNOSTIC_MESSAGE", LDAP_OPT_DIAGNOSTIC_MESSAGE, CONST_PERSISTENT | CONST_CS);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LDAP_SASL
|
||||
REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_MECH", LDAP_OPT_X_SASL_MECH, CONST_PERSISTENT | CONST_CS);
|
||||
REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_REALM", LDAP_OPT_X_SASL_REALM, CONST_PERSISTENT | CONST_CS);
|
||||
@@ -319,7 +298,7 @@ PHP_FUNCTION(ldap_connect)
|
||||
{
|
||||
char *host = NULL;
|
||||
int hostlen;
|
||||
long port = LDAP_PORT;
|
||||
long port = 389; /* Default port */
|
||||
#ifdef HAVE_ORALDAP
|
||||
char *wallet = NULL, *walletpasswd = NULL;
|
||||
int walletlen = 0, walletpasswdlen = 0;
|
||||
@@ -327,7 +306,7 @@ PHP_FUNCTION(ldap_connect)
|
||||
int ssl=0;
|
||||
#endif
|
||||
ldap_linkdata *ld;
|
||||
LDAP *ldap = NULL;
|
||||
LDAP *ldap;
|
||||
|
||||
#ifdef HAVE_ORALDAP
|
||||
if (ZEND_NUM_ARGS() == 3 || ZEND_NUM_ARGS() == 4) {
|
||||
@@ -354,46 +333,23 @@ PHP_FUNCTION(ldap_connect)
|
||||
|
||||
ld = ecalloc(1, sizeof(ldap_linkdata));
|
||||
|
||||
{
|
||||
int rc = LDAP_SUCCESS;
|
||||
char *url = host;
|
||||
if (!ldap_is_ldap_url(url)) {
|
||||
int urllen = hostlen + sizeof( "ldap://:65535" );
|
||||
|
||||
if (port <= 0 || port > 65535) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid port number: %ld", port);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
url = emalloc(urllen);
|
||||
snprintf( url, urllen, "ldap://%s:%ld", host ? host : "", port );
|
||||
}
|
||||
|
||||
#ifdef LDAP_API_FEATURE_X_OPENLDAP
|
||||
/* ldap_init() is deprecated, use ldap_initialize() instead.
|
||||
*/
|
||||
rc = ldap_initialize(&ldap, url);
|
||||
#else /* ! LDAP_API_FEATURE_X_OPENLDAP */
|
||||
/* ldap_init does not support URLs.
|
||||
* We must try the original host and port information.
|
||||
*/
|
||||
ldap = ldap_init(host, port);
|
||||
if (ldap == NULL) {
|
||||
efree(ld);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not create session handle");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#endif /* ! LDAP_API_FEATURE_X_OPENLDAP */
|
||||
if (url != host) {
|
||||
efree(url);
|
||||
}
|
||||
if (host != NULL && strchr(host, '/')) {
|
||||
int rc;
|
||||
|
||||
rc = ldap_initialize(&ldap, host);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
efree(ld);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not create session handle: %s", ldap_err2string(rc));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} else {
|
||||
ldap = ldap_init(host, port);
|
||||
}
|
||||
|
||||
#else
|
||||
ldap = ldap_open(host, port);
|
||||
#endif
|
||||
|
||||
if (ldap == NULL) {
|
||||
efree(ld);
|
||||
RETURN_FALSE;
|
||||
@@ -405,7 +361,7 @@ PHP_FUNCTION(ldap_connect)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSL init failed");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
LDAPG(num_links)++;
|
||||
ld->link = ldap;
|
||||
@@ -480,22 +436,7 @@ PHP_FUNCTION(ldap_bind)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
{
|
||||
#ifdef LDAP_API_FEATURE_X_OPENLDAP
|
||||
/* ldap_simple_bind_s() is deprecated, use ldap_sasl_bind_s() instead.
|
||||
*/
|
||||
struct berval cred;
|
||||
|
||||
cred.bv_val = ldap_bind_pw;
|
||||
cred.bv_len = ldap_bind_pw ? ldap_bind_pwlen : 0;
|
||||
rc = ldap_sasl_bind_s(ld->link, ldap_bind_dn, LDAP_SASL_SIMPLE, &cred,
|
||||
NULL, NULL, /* no controls right now */
|
||||
NULL); /* we don't care about the server's credentials */
|
||||
#else /* ! LDAP_API_FEATURE_X_OPENLDAP */
|
||||
rc = ldap_simple_bind_s(ld->link, ldap_bind_dn, ldap_bind_pw);
|
||||
#endif /* ! LDAP_API_FEATURE_X_OPENLDAP */
|
||||
}
|
||||
if ( rc != LDAP_SUCCESS) {
|
||||
if ((rc = ldap_bind_s(ld->link, ldap_bind_dn, ldap_bind_pw, LDAP_AUTH_SIMPLE)) != LDAP_SUCCESS) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to bind to server: %s", ldap_err2string(rc));
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
@@ -519,7 +460,7 @@ static php_ldap_bictx *_php_sasl_setdefs(LDAP *ld, char *sasl_mech, char *sasl_r
|
||||
{
|
||||
php_ldap_bictx *ctx;
|
||||
|
||||
ctx = ber_memalloc(sizeof(php_ldap_bictx));
|
||||
ctx = ber_memalloc(sizeof(php_ldap_bictx));
|
||||
ctx->mech = (sasl_mech) ? ber_strdup(sasl_mech) : NULL;
|
||||
ctx->realm = (sasl_realm) ? ber_strdup(sasl_realm) : NULL;
|
||||
ctx->authcid = (sasl_authc_id) ? ber_strdup(sasl_authc_id) : NULL;
|
||||
@@ -657,8 +598,8 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in
|
||||
ldap_get_option(ldap, LDAP_OPT_SIZELIMIT, old_sizelimit);
|
||||
ldap_set_option(ldap, LDAP_OPT_SIZELIMIT, &sizelimit);
|
||||
#else
|
||||
*old_sizelimit = ldap->ld_sizelimit;
|
||||
ldap->ld_sizelimit = sizelimit;
|
||||
*old_sizelimit = ldap->ld_sizelimit;
|
||||
ldap->ld_sizelimit = sizelimit;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -668,8 +609,8 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in
|
||||
ldap_get_option(ldap, LDAP_OPT_SIZELIMIT, old_timelimit);
|
||||
ldap_set_option(ldap, LDAP_OPT_TIMELIMIT, &timelimit);
|
||||
#else
|
||||
*old_timelimit = ldap->ld_timelimit;
|
||||
ldap->ld_timelimit = timelimit;
|
||||
*old_timelimit = ldap->ld_timelimit;
|
||||
ldap->ld_timelimit = timelimit;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -679,8 +620,8 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in
|
||||
ldap_get_option(ldap, LDAP_OPT_SIZELIMIT, old_deref);
|
||||
ldap_set_option(ldap, LDAP_OPT_DEREF, &deref);
|
||||
#else
|
||||
*old_deref = ldap->ld_deref;
|
||||
ldap->ld_deref = deref;
|
||||
*old_deref = ldap->ld_deref;
|
||||
ldap->ld_deref = deref;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -692,11 +633,11 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
|
||||
{
|
||||
zval *link, *base_dn, **filter, *attrs = NULL, **attr;
|
||||
long attrsonly, sizelimit, timelimit, deref;
|
||||
char *ldap_base_dn = NULL, *ldap_filter = NULL, **ldap_attrs = NULL;
|
||||
char *ldap_base_dn = NULL, *ldap_filter = NULL, **ldap_attrs = NULL;
|
||||
ldap_linkdata *ld = NULL;
|
||||
LDAPMessage *ldap_res;
|
||||
int ldap_attrsonly = 0, ldap_sizelimit = -1, ldap_timelimit = -1, ldap_deref = -1;
|
||||
int old_ldap_sizelimit = -1, old_ldap_timelimit = -1, old_ldap_deref = -1;
|
||||
int ldap_attrsonly = 0, ldap_sizelimit = -1, ldap_timelimit = -1, ldap_deref = -1;
|
||||
int old_ldap_sizelimit = -1, old_ldap_timelimit = -1, old_ldap_deref = -1;
|
||||
int num_attribs = 0, ret = 1, i, errno, argcount = ZEND_NUM_ARGS();
|
||||
|
||||
if (zend_parse_parameters(argcount TSRMLS_CC, "zzZ|allll", &link, &base_dn, &filter, &attrs, &attrsonly,
|
||||
@@ -739,7 +680,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
|
||||
int i, nlinks, nbases, nfilters, *rcs;
|
||||
ldap_linkdata **lds;
|
||||
zval **entry, *resource;
|
||||
|
||||
|
||||
nlinks = zend_hash_num_elements(Z_ARRVAL_P(link));
|
||||
if (nlinks == 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "No links in link array");
|
||||
@@ -781,7 +722,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
|
||||
|
||||
lds = safe_emalloc(nlinks, sizeof(ldap_linkdata), 0);
|
||||
rcs = safe_emalloc(nlinks, sizeof(*rcs), 0);
|
||||
|
||||
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_P(link));
|
||||
for (i=0; i<nlinks; i++) {
|
||||
zend_hash_get_current_data(Z_ARRVAL_P(link), (void **)&entry);
|
||||
@@ -811,12 +752,12 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
|
||||
|
||||
php_set_opts(ld->link, ldap_sizelimit, ldap_timelimit, ldap_deref, &old_ldap_sizelimit, &old_ldap_timelimit, &old_ldap_deref);
|
||||
|
||||
/* Run the actual search */
|
||||
ldap_search_ext(ld->link, ldap_base_dn, scope, ldap_filter, ldap_attrs, ldap_attrsonly, NULL, NULL, NULL, ldap_sizelimit, &rcs[i]);
|
||||
/* Run the actual search */
|
||||
rcs[i] = ldap_search(ld->link, ldap_base_dn, scope, ldap_filter, ldap_attrs, ldap_attrsonly);
|
||||
lds[i] = ld;
|
||||
zend_hash_move_forward(Z_ARRVAL_P(link));
|
||||
}
|
||||
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
/* Collect results from the searches */
|
||||
@@ -853,9 +794,9 @@ cleanup_parallel:
|
||||
|
||||
php_set_opts(ld->link, ldap_sizelimit, ldap_timelimit, ldap_deref, &old_ldap_sizelimit, &old_ldap_timelimit, &old_ldap_deref);
|
||||
|
||||
/* Run the actual search */
|
||||
errno = ldap_search_ext_s(ld->link, ldap_base_dn, scope, ldap_filter, ldap_attrs, ldap_attrsonly, NULL, NULL, NULL, ldap_sizelimit, &ldap_res);
|
||||
|
||||
/* Run the actual search */
|
||||
errno = ldap_search_s(ld->link, ldap_base_dn, scope, ldap_filter, ldap_attrs, ldap_attrsonly, &ldap_res);
|
||||
|
||||
if (errno != LDAP_SUCCESS
|
||||
&& errno != LDAP_SIZELIMIT_EXCEEDED
|
||||
#ifdef LDAP_ADMINLIMIT_EXCEEDED
|
||||
@@ -876,7 +817,7 @@ cleanup_parallel:
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Partial search results returned: Adminlimit exceeded");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
ZEND_REGISTER_RESOURCE(return_value, ldap_res, le_result);
|
||||
}
|
||||
}
|
||||
@@ -961,7 +902,7 @@ PHP_FUNCTION(ldap_count_entries)
|
||||
PHP_FUNCTION(ldap_first_entry)
|
||||
{
|
||||
zval *link, *result;
|
||||
ldap_linkdata *ld;
|
||||
ldap_linkdata *ld;
|
||||
ldap_resultentry *resultentry;
|
||||
LDAPMessage *ldap_result, *entry;
|
||||
|
||||
@@ -1046,7 +987,7 @@ PHP_FUNCTION(ldap_get_entries)
|
||||
if (num_entries == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ldap_result_entry = ldap_first_entry(ldap, ldap_result);
|
||||
if (ldap_result_entry == NULL) {
|
||||
zval_dtor(return_value);
|
||||
@@ -1070,7 +1011,7 @@ PHP_FUNCTION(ldap_get_entries)
|
||||
add_assoc_long(tmp2, "count", num_values);
|
||||
for (i = 0; i < num_values; i++) {
|
||||
add_index_stringl(tmp2, i, ldap_value[i]->bv_val, ldap_value[i]->bv_len, 1);
|
||||
}
|
||||
}
|
||||
ldap_value_free_len(ldap_value);
|
||||
|
||||
attr_len = strlen(attribute);
|
||||
@@ -1099,7 +1040,7 @@ PHP_FUNCTION(ldap_get_entries)
|
||||
#endif
|
||||
|
||||
zend_hash_index_update(Z_ARRVAL_P(return_value), num_entries, (void *) &tmp1, sizeof(zval *), NULL);
|
||||
|
||||
|
||||
num_entries++;
|
||||
ldap_result_entry = ldap_next_entry(ldap, ldap_result_entry);
|
||||
}
|
||||
@@ -1198,7 +1139,7 @@ PHP_FUNCTION(ldap_get_attributes)
|
||||
|
||||
array_init(return_value);
|
||||
num_attrib = 0;
|
||||
|
||||
|
||||
attribute = ldap_first_attribute(ld->link, resultentry->data, &ber);
|
||||
while (attribute != NULL) {
|
||||
ldap_value = ldap_get_values_len(ld->link, resultentry->data, attribute);
|
||||
@@ -1226,7 +1167,7 @@ PHP_FUNCTION(ldap_get_attributes)
|
||||
ber_free(ber, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
add_assoc_long(return_value, "count", num_attrib);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1241,11 +1182,11 @@ PHP_FUNCTION(ldap_get_values_len)
|
||||
char *attr;
|
||||
struct berval **ldap_value_len;
|
||||
int i, num_values, attr_len;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrs", &link, &result_entry, &attr, &attr_len) != SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
|
||||
ZEND_FETCH_RESOURCE(resultentry, ldap_resultentry *, &result_entry, -1, "ldap result entry", le_result_entry);
|
||||
|
||||
@@ -1253,14 +1194,14 @@ PHP_FUNCTION(ldap_get_values_len)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot get the value(s) of attribute %s", ldap_err2string(_get_lderrno(ld->link)));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
num_values = ldap_count_values_len(ldap_value_len);
|
||||
array_init(return_value);
|
||||
|
||||
|
||||
for (i=0; i<num_values; i++) {
|
||||
add_next_index_stringl(return_value, ldap_value_len[i]->bv_val, ldap_value_len[i]->bv_len, 1);
|
||||
}
|
||||
|
||||
|
||||
add_assoc_long(return_value, "count", num_values);
|
||||
ldap_value_free_len(ldap_value_len);
|
||||
|
||||
@@ -1269,7 +1210,7 @@ PHP_FUNCTION(ldap_get_values_len)
|
||||
|
||||
/* {{{ proto string ldap_get_dn(resource link, resource result_entry)
|
||||
Get the DN of a result entry */
|
||||
PHP_FUNCTION(ldap_get_dn)
|
||||
PHP_FUNCTION(ldap_get_dn)
|
||||
{
|
||||
zval *link, *result_entry;
|
||||
ldap_linkdata *ld;
|
||||
@@ -1279,7 +1220,7 @@ PHP_FUNCTION(ldap_get_dn)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr", &link, &result_entry) != SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
|
||||
ZEND_FETCH_RESOURCE(resultentry, ldap_resultentry *, &result_entry, -1, "ldap result entry", le_result_entry);
|
||||
|
||||
@@ -1325,7 +1266,7 @@ PHP_FUNCTION(ldap_explode_dn)
|
||||
add_index_string(return_value, i, ldap_value[i], 1);
|
||||
}
|
||||
|
||||
ldap_memvfree((void **)ldap_value);
|
||||
ldap_value_free(ldap_value);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1339,9 +1280,9 @@ PHP_FUNCTION(ldap_dn2ufn)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &dn, &dn_len) != SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ufn = ldap_dn2ufn(dn);
|
||||
|
||||
|
||||
if (ufn != NULL) {
|
||||
RETVAL_STRING(ufn, 1);
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS
|
||||
@@ -1372,7 +1313,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsa", &link, &dn, &dn_len, &entry) != SUCCESS) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
|
||||
|
||||
@@ -1406,7 +1347,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
|
||||
i--;
|
||||
}
|
||||
efree(num_berval);
|
||||
efree(ldap_mods);
|
||||
efree(ldap_mods);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1417,7 +1358,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
|
||||
} else {
|
||||
num_values = zend_hash_num_elements(Z_ARRVAL_PP(value));
|
||||
}
|
||||
|
||||
|
||||
num_berval[i] = num_values;
|
||||
ldap_mods[i]->mod_bvalues = safe_emalloc((num_values + 1), sizeof(struct berval *), 0);
|
||||
|
||||
@@ -1427,7 +1368,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
|
||||
ldap_mods[i]->mod_bvalues[0] = (struct berval *) emalloc (sizeof(struct berval));
|
||||
ldap_mods[i]->mod_bvalues[0]->bv_len = Z_STRLEN_PP(value);
|
||||
ldap_mods[i]->mod_bvalues[0]->bv_val = Z_STRVAL_PP(value);
|
||||
} else {
|
||||
} else {
|
||||
for (j = 0; j < num_values; j++) {
|
||||
if (zend_hash_index_find(Z_ARRVAL_PP(value), j, (void **) &ivalue) != SUCCESS) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Value array must have consecutive indices 0, 1, ...");
|
||||
@@ -1449,7 +1390,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
|
||||
|
||||
/* check flag to see if do_mod was called to perform full add , gerrit thomson */
|
||||
if (is_full_add == 1) {
|
||||
if ((i = ldap_add_ext_s(ld->link, dn, ldap_mods, NULL, NULL)) != LDAP_SUCCESS) {
|
||||
if ((i = ldap_add_s(ld->link, dn, ldap_mods)) != LDAP_SUCCESS) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Add: %s", ldap_err2string(i));
|
||||
RETVAL_FALSE;
|
||||
} else RETVAL_TRUE;
|
||||
@@ -1457,7 +1398,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
|
||||
if ((i = ldap_modify_ext_s(ld->link, dn, ldap_mods, NULL, NULL)) != LDAP_SUCCESS) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Modify: %s", ldap_err2string(i));
|
||||
RETVAL_FALSE;
|
||||
} else RETVAL_TRUE;
|
||||
} else RETVAL_TRUE;
|
||||
}
|
||||
|
||||
errexit:
|
||||
@@ -1470,7 +1411,7 @@ errexit:
|
||||
efree(ldap_mods[i]);
|
||||
}
|
||||
efree(num_berval);
|
||||
efree(ldap_mods);
|
||||
efree(ldap_mods);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1526,7 +1467,7 @@ PHP_FUNCTION(ldap_delete)
|
||||
|
||||
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
|
||||
|
||||
if ((rc = ldap_delete_ext_s(ld->link, dn, NULL, NULL)) != LDAP_SUCCESS) {
|
||||
if ((rc = ldap_delete_s(ld->link, dn)) != LDAP_SUCCESS) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Delete: %s", ldap_err2string(rc));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -1917,7 +1858,7 @@ PHP_FUNCTION(ldap_err2str)
|
||||
|
||||
/* {{{ proto string ldap_error(resource link)
|
||||
Get the current ldap error string */
|
||||
PHP_FUNCTION(ldap_error)
|
||||
PHP_FUNCTION(ldap_error)
|
||||
{
|
||||
zval *link;
|
||||
ldap_linkdata *ld;
|
||||
@@ -1937,25 +1878,21 @@ PHP_FUNCTION(ldap_error)
|
||||
|
||||
/* {{{ proto bool ldap_compare(resource link, string dn, string attr, string value)
|
||||
Determine if an entry has a specific value for one of its attributes */
|
||||
PHP_FUNCTION(ldap_compare)
|
||||
PHP_FUNCTION(ldap_compare)
|
||||
{
|
||||
zval *link;
|
||||
char *dn, *attr, *value;
|
||||
int dn_len, attr_len, value_len;
|
||||
ldap_linkdata *ld;
|
||||
int errno;
|
||||
struct berval lvalue;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsss", &link, &dn, &dn_len, &attr, &attr_len, &value, &value_len) != SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
lvalue.bv_val = value;
|
||||
lvalue.bv_len = value_len;
|
||||
|
||||
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
|
||||
|
||||
errno = ldap_compare_ext_s(ld->link, dn, attr, &lvalue, NULL, NULL);
|
||||
errno = ldap_compare_s(ld->link, dn, attr, value);
|
||||
|
||||
switch (errno) {
|
||||
case LDAP_COMPARE_TRUE:
|
||||
@@ -1966,7 +1903,7 @@ PHP_FUNCTION(ldap_compare)
|
||||
RETURN_FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Compare: %s", ldap_err2string(errno));
|
||||
RETURN_LONG(-1);
|
||||
}
|
||||
@@ -2005,12 +1942,12 @@ PHP_FUNCTION(ldap_sort)
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
|
||||
/* {{{ proto bool ldap_get_option(resource link, int option, mixed retval)
|
||||
Get the current value of various session-wide parameters */
|
||||
PHP_FUNCTION(ldap_get_option)
|
||||
PHP_FUNCTION(ldap_get_option)
|
||||
{
|
||||
zval *link, *retval;
|
||||
ldap_linkdata *ld;
|
||||
long option;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &link, &option, &retval) != SUCCESS) {
|
||||
return;
|
||||
}
|
||||
@@ -2047,7 +1984,7 @@ PHP_FUNCTION(ldap_get_option)
|
||||
ldap_memfree(timeout);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
if (!timeout) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -2062,7 +1999,7 @@ PHP_FUNCTION(ldap_get_option)
|
||||
|
||||
if (ldap_get_option(ld->link, LDAP_X_OPT_CONNECT_TIMEOUT, &timeout)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
zval_dtor(retval);
|
||||
ZVAL_LONG(retval, (timeout / 1000));
|
||||
} break;
|
||||
@@ -2073,7 +2010,7 @@ PHP_FUNCTION(ldap_get_option)
|
||||
case LDAP_OPT_HOST_NAME:
|
||||
#endif
|
||||
#ifdef HAVE_LDAP_SASL
|
||||
case LDAP_OPT_X_SASL_MECH:
|
||||
case LDAP_OPT_X_SASL_MECH:
|
||||
case LDAP_OPT_X_SASL_REALM:
|
||||
case LDAP_OPT_X_SASL_AUTHCID:
|
||||
case LDAP_OPT_X_SASL_AUTHZID:
|
||||
@@ -2109,13 +2046,13 @@ PHP_FUNCTION(ldap_get_option)
|
||||
|
||||
/* {{{ proto bool ldap_set_option(resource link, int option, mixed newval)
|
||||
Set the value of various session-wide parameters */
|
||||
PHP_FUNCTION(ldap_set_option)
|
||||
PHP_FUNCTION(ldap_set_option)
|
||||
{
|
||||
zval *link, **newval;
|
||||
ldap_linkdata *ld;
|
||||
LDAP *ldap;
|
||||
long option;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zlZ", &link, &option, &newval) != SUCCESS) {
|
||||
return;
|
||||
}
|
||||
@@ -2156,7 +2093,7 @@ PHP_FUNCTION(ldap_set_option)
|
||||
timeout.tv_usec = 0;
|
||||
if (ldap_set_option(ldap, LDAP_OPT_NETWORK_TIMEOUT, (void *) &timeout)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
#elif defined(LDAP_X_OPT_CONNECT_TIMEOUT)
|
||||
case LDAP_X_OPT_CONNECT_TIMEOUT:
|
||||
@@ -2167,7 +2104,7 @@ PHP_FUNCTION(ldap_set_option)
|
||||
timeout = 1000 * Z_LVAL_PP(newval); /* Convert to milliseconds */
|
||||
if (ldap_set_option(ldap, LDAP_X_OPT_CONNECT_TIMEOUT, &timeout)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
#endif
|
||||
/* options with string value */
|
||||
@@ -2176,7 +2113,7 @@ PHP_FUNCTION(ldap_set_option)
|
||||
case LDAP_OPT_HOST_NAME:
|
||||
#endif
|
||||
#ifdef HAVE_LDAP_SASL
|
||||
case LDAP_OPT_X_SASL_MECH:
|
||||
case LDAP_OPT_X_SASL_MECH:
|
||||
case LDAP_OPT_X_SASL_REALM:
|
||||
case LDAP_OPT_X_SASL_AUTHCID:
|
||||
case LDAP_OPT_X_SASL_AUTHZID:
|
||||
@@ -2251,7 +2188,7 @@ PHP_FUNCTION(ldap_set_option)
|
||||
} else {
|
||||
ctrl->ldctl_iscritical = 0;
|
||||
}
|
||||
|
||||
|
||||
++ctrlp;
|
||||
*ctrlp = NULL;
|
||||
zend_hash_move_forward(Z_ARRVAL_PP(newval));
|
||||
@@ -2279,7 +2216,7 @@ PHP_FUNCTION(ldap_set_option)
|
||||
#ifdef HAVE_LDAP_PARSE_RESULT
|
||||
/* {{{ proto bool ldap_parse_result(resource link, resource result, int errcode, string matcheddn, string errmsg, array referrals)
|
||||
Extract information from result */
|
||||
PHP_FUNCTION(ldap_parse_result)
|
||||
PHP_FUNCTION(ldap_parse_result)
|
||||
{
|
||||
zval *link, *result, *errcode, *matcheddn, *errmsg, *referrals;
|
||||
ldap_linkdata *ld;
|
||||
@@ -2289,7 +2226,7 @@ PHP_FUNCTION(ldap_parse_result)
|
||||
int rc, lerrcode, myargcount = ZEND_NUM_ARGS();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrz|zzz", &link, &result, &errcode, &matcheddn, &errmsg, &referrals) != SUCCESS) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
|
||||
@@ -2320,7 +2257,7 @@ PHP_FUNCTION(ldap_parse_result)
|
||||
add_next_index_string(referrals, *refp, 1);
|
||||
refp++;
|
||||
}
|
||||
ldap_memvfree((void**)lreferrals);
|
||||
ldap_value_free(lreferrals);
|
||||
}
|
||||
case 5:
|
||||
zval_dtor(errmsg);
|
||||
@@ -2330,7 +2267,7 @@ PHP_FUNCTION(ldap_parse_result)
|
||||
ZVAL_STRING(errmsg, lerrmsg, 1);
|
||||
ldap_memfree(lerrmsg);
|
||||
}
|
||||
case 4:
|
||||
case 4:
|
||||
zval_dtor(matcheddn);
|
||||
if (lmatcheddn == NULL) {
|
||||
ZVAL_EMPTY_STRING(matcheddn);
|
||||
@@ -2431,7 +2368,7 @@ PHP_FUNCTION(ldap_parse_reference)
|
||||
add_next_index_string(referrals, *refp, 1);
|
||||
refp++;
|
||||
}
|
||||
ldap_memvfree((void**)lreferrals);
|
||||
ldap_value_free(lreferrals);
|
||||
}
|
||||
RETURN_TRUE;
|
||||
}
|
||||
@@ -2448,7 +2385,7 @@ PHP_FUNCTION(ldap_rename)
|
||||
char *dn, *newrdn, *newparent;
|
||||
int dn_len, newrdn_len, newparent_len;
|
||||
zend_bool deleteoldrdn;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsssb", &link, &dn, &dn_len, &newrdn, &newrdn_len, &newparent, &newparent_len, &deleteoldrdn) != SUCCESS) {
|
||||
return;
|
||||
}
|
||||
@@ -2673,11 +2610,11 @@ PHP_FUNCTION(ldap_escape)
|
||||
#ifdef STR_TRANSLATION
|
||||
/* {{{ php_ldap_do_translate
|
||||
*/
|
||||
static void php_ldap_do_translate(INTERNAL_FUNCTION_PARAMETERS, int way)
|
||||
static void php_ldap_do_translate(INTERNAL_FUNCTION_PARAMETERS, int way)
|
||||
{
|
||||
char *value;
|
||||
int result, ldap_len;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &value, &value_len) != SUCCESS) {
|
||||
return;
|
||||
}
|
||||
@@ -2722,7 +2659,7 @@ PHP_FUNCTION(ldap_8859_to_t61)
|
||||
#ifdef LDAP_CONTROL_PAGEDRESULTS
|
||||
/* {{{ proto mixed ldap_control_paged_result(resource link, int pagesize [, bool iscritical [, string cookie]])
|
||||
Inject paged results control*/
|
||||
PHP_FUNCTION(ldap_control_paged_result)
|
||||
PHP_FUNCTION(ldap_control_paged_result)
|
||||
{
|
||||
long pagesize;
|
||||
zend_bool iscritical;
|
||||
@@ -2814,7 +2751,7 @@ lcpr_error_out:
|
||||
|
||||
/* {{{ proto bool ldap_control_paged_result_response(resource link, resource result [, string &cookie [, int &estimated]])
|
||||
Extract paged results control response */
|
||||
PHP_FUNCTION(ldap_control_paged_result_response)
|
||||
PHP_FUNCTION(ldap_control_paged_result_response)
|
||||
{
|
||||
zval *link, *result, *cookie, *estimated;
|
||||
struct berval lcookie;
|
||||
@@ -2857,7 +2794,7 @@ PHP_FUNCTION(ldap_control_paged_result_response)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
lctrl = ldap_control_find(LDAP_CONTROL_PAGEDRESULTS, lserverctrls, NULL);
|
||||
lctrl = ldap_find_control(LDAP_CONTROL_PAGEDRESULTS, lserverctrls);
|
||||
if (lctrl == NULL) {
|
||||
ldap_controls_free(lserverctrls);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "No paged results control response in result");
|
||||
@@ -3181,9 +3118,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_8859_to_t61, 0, 0, 1)
|
||||
ZEND_END_ARG_INFO()
|
||||
#endif
|
||||
/* }}} */
|
||||
|
||||
|
||||
/*
|
||||
This is just a small subset of the functionality provided by the LDAP library. All the
|
||||
This is just a small subset of the functionality provided by the LDAP library. All the
|
||||
operations are synchronous. Referrals are not handled automatically.
|
||||
*/
|
||||
/* {{{ ldap_functions[]
|
||||
@@ -3267,13 +3204,13 @@ const zend_function_entry ldap_functions[] = {
|
||||
|
||||
zend_module_entry ldap_module_entry = { /* {{{ */
|
||||
STANDARD_MODULE_HEADER,
|
||||
"ldap",
|
||||
ldap_functions,
|
||||
PHP_MINIT(ldap),
|
||||
PHP_MSHUTDOWN(ldap),
|
||||
"ldap",
|
||||
ldap_functions,
|
||||
PHP_MINIT(ldap),
|
||||
PHP_MSHUTDOWN(ldap),
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
PHP_MINFO(ldap),
|
||||
PHP_MINFO(ldap),
|
||||
NO_VERSION_YET,
|
||||
PHP_MODULE_GLOBALS(ldap),
|
||||
PHP_GINIT(ldap),
|
||||
|
||||
@@ -2,16 +2,13 @@ Most tests here relies on the availability of an LDAP server configured with TLS
|
||||
|
||||
Client/Server configuration:
|
||||
===========================================================
|
||||
OpenLDAP 2.4.31 has been used with the configuration below.
|
||||
OpenLDAP 2.3.43 has been used with the configuration below.
|
||||
|
||||
Notes:
|
||||
1. A self signed certificate can be generated using:
|
||||
$ openssl req -newkey rsa:1024 -x509 -nodes -out server.pem -keyout server.pem -days 3650
|
||||
It is used for testing ldap_start_tls(), which also requires "TLS_REQCERT never" in client configuration
|
||||
2. An empty LDAP structure is required for the tests to be PASSed (except for base and admin)
|
||||
|
||||
If you use a debian based distribution, prefer the use of dpkg-reconfigure.
|
||||
Otherwise you may alter these configuration files:
|
||||
2. An empty LDAP structure is required for the tests to be PASSed
|
||||
|
||||
(/etc/openldap/)slapd.conf:
|
||||
-----------------------------------------------------------
|
||||
@@ -43,7 +40,6 @@ Tests configuration:
|
||||
The following environment variables may be defined:
|
||||
LDAP_TEST_HOST (default: localhost) Host to connect to
|
||||
LDAP_TEST_PORT (default: 389) Port to connect to
|
||||
LDAP_TEST_BASE (default: dc=my-domain,dc=com) Base to use. May be the ldap root or a subtree. (ldap_search_variation6 will fail if a subtree is used)
|
||||
LDAP_TEST_USER (default: cn=Manager,dc=my-domain,dc=com) DN used for binding
|
||||
LDAP_TEST_SASL_USER (default: Manager) SASL user used for SASL binding
|
||||
LDAP_TEST_PASSWD (default: secret) Password used for plain and SASL binding
|
||||
@@ -54,4 +50,4 @@ Credits:
|
||||
===========================================================
|
||||
Davide Mendolia <idaf1er@gmail.com>
|
||||
Patrick Allaert <patrick.allaert@gmail.com>
|
||||
Côme Bernigaud <mcmic@php.net>
|
||||
|
||||
@@ -12,9 +12,9 @@ require_once('skipifbindfailure.inc');
|
||||
include "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
insert_dummy_data($link, $base);
|
||||
insert_dummy_data($link);
|
||||
|
||||
$dn = "$base";
|
||||
$dn = "dc=my-domain,dc=com";
|
||||
$filter = "(objectclass=person)";
|
||||
|
||||
var_dump(
|
||||
@@ -36,7 +36,7 @@ var_dump(
|
||||
include "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
remove_dummy_data($link, $base);
|
||||
remove_dummy_data($link);
|
||||
?>
|
||||
--EXPECTF--
|
||||
resource(%d) of type (ldap result)
|
||||
@@ -57,7 +57,7 @@ array(4) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
["dn"]=>
|
||||
string(%d) "cn=userA,%s"
|
||||
string(28) "cn=userA,dc=my-domain,dc=com"
|
||||
}
|
||||
[1]=>
|
||||
array(4) {
|
||||
@@ -73,7 +73,7 @@ array(4) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
["dn"]=>
|
||||
string(%d) "cn=userB,%s"
|
||||
string(28) "cn=userB,dc=my-domain,dc=com"
|
||||
}
|
||||
[2]=>
|
||||
array(4) {
|
||||
@@ -89,7 +89,7 @@ array(4) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
["dn"]=>
|
||||
string(%d) "cn=userC,cn=userB,%s"
|
||||
string(37) "cn=userC,cn=userB,dc=my-domain,dc=com"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
["dn"]=>
|
||||
string(%d) "cn=userA,%s"
|
||||
string(28) "cn=userA,dc=my-domain,dc=com"
|
||||
}
|
||||
}
|
||||
resource(%d) of type (ldap result)
|
||||
@@ -131,7 +131,7 @@ array(4) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
["dn"]=>
|
||||
string(%d) "cn=userA,%s"
|
||||
string(28) "cn=userA,dc=my-domain,dc=com"
|
||||
}
|
||||
[1]=>
|
||||
array(4) {
|
||||
@@ -147,7 +147,7 @@ array(4) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
["dn"]=>
|
||||
string(%d) "cn=userB,%s"
|
||||
string(28) "cn=userB,dc=my-domain,dc=com"
|
||||
}
|
||||
[2]=>
|
||||
array(4) {
|
||||
@@ -163,7 +163,7 @@ array(4) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
["dn"]=>
|
||||
string(%d) "cn=userC,cn=userB,%s"
|
||||
string(37) "cn=userC,cn=userB,dc=my-domain,dc=com"
|
||||
}
|
||||
}
|
||||
===DONE===
|
||||
+17
-30
@@ -1,14 +1,13 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Default values are "localhost", "cn=Manager,dc=my-domain,dc=com", and password "secret".
|
||||
Default values are "localhost", "root", database "test" and empty password.
|
||||
Change the LDAP_TEST_* environment values if you want to use another configuration.
|
||||
*/
|
||||
|
||||
$host = getenv("LDAP_TEST_HOST") ? getenv("LDAP_TEST_HOST") : "localhost";
|
||||
$port = getenv("LDAP_TEST_PORT") ? getenv("LDAP_TEST_PORT") : 389;
|
||||
$base = getenv("LDAP_TEST_BASE") ? getenv("LDAP_TEST_BASE") : "dc=my-domain,dc=com";
|
||||
$user = getenv("LDAP_TEST_USER") ? getenv("LDAP_TEST_USER") : "cn=Manager,$base";
|
||||
$user = getenv("LDAP_TEST_USER") ? getenv("LDAP_TEST_USER") : "cn=Manager,dc=my-domain,dc=com";
|
||||
$sasl_user = getenv("LDAP_TEST_SASL_USER") ? getenv("LDAP_TEST_SASL_USER") : "Manager";
|
||||
$passwd = getenv("LDAP_TEST_PASSWD") ? getenv("LDAP_TEST_PASSWD") : "secret";
|
||||
$protocol_version = getenv("LDAP_TEST_OPT_PROTOCOL_VERSION") ? getenv("LDAP_TEST_OPT_PROTOCOL_VERSION") : 3;
|
||||
@@ -21,28 +20,16 @@ function ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version)
|
||||
return $link;
|
||||
}
|
||||
|
||||
function insert_dummy_data($link, $base) {
|
||||
// Create root if not there
|
||||
$testBase = ldap_read($link, $base, '(objectClass=*)', array('objectClass'));
|
||||
if (ldap_count_entries($link, $testBase) < 1) {
|
||||
ldap_add(
|
||||
$link, "$base", array(
|
||||
"objectClass" => array(
|
||||
"top",
|
||||
"organization",
|
||||
"dcObject"
|
||||
),
|
||||
"o" => "php ldap tests"
|
||||
)
|
||||
);
|
||||
}
|
||||
ldap_add($link, "o=test,$base", array(
|
||||
function insert_dummy_data($link) {
|
||||
ldap_add($link, "dc=my-domain,dc=com", array(
|
||||
"objectClass" => array(
|
||||
"top",
|
||||
"organization"),
|
||||
"o" => "test",
|
||||
"top",
|
||||
"dcObject",
|
||||
"organization"),
|
||||
"dc" => "my-domain",
|
||||
"o" => "my-domain",
|
||||
));
|
||||
ldap_add($link, "cn=userA,$base", array(
|
||||
ldap_add($link, "cn=userA,dc=my-domain,dc=com", array(
|
||||
"objectclass" => "person",
|
||||
"cn" => "userA",
|
||||
"sn" => "testSN1",
|
||||
@@ -50,14 +37,14 @@ function insert_dummy_data($link, $base) {
|
||||
"telephoneNumber" => "xx-xx-xx-xx-xx",
|
||||
"description" => "user A",
|
||||
));
|
||||
ldap_add($link, "cn=userB,$base", array(
|
||||
ldap_add($link, "cn=userB,dc=my-domain,dc=com", array(
|
||||
"objectclass" => "person",
|
||||
"cn" => "userB",
|
||||
"sn" => "testSN2",
|
||||
"userPassword" => "oopsIDitItAgain",
|
||||
"description" => "user B",
|
||||
));
|
||||
ldap_add($link, "cn=userC,cn=userB,$base", array(
|
||||
ldap_add($link, "cn=userC,cn=userB,dc=my-domain,dc=com", array(
|
||||
"objectclass" => "person",
|
||||
"cn" => "userC",
|
||||
"sn" => "testSN3",
|
||||
@@ -65,10 +52,10 @@ function insert_dummy_data($link, $base) {
|
||||
));
|
||||
}
|
||||
|
||||
function remove_dummy_data($link, $base) {
|
||||
ldap_delete($link, "cn=userC,cn=userB,$base");
|
||||
ldap_delete($link, "cn=userA,$base");
|
||||
ldap_delete($link, "cn=userB,$base");
|
||||
ldap_delete($link, "o=test,$base");
|
||||
function remove_dummy_data($link) {
|
||||
ldap_delete($link, "cn=userC,cn=userB,dc=my-domain,dc=com");
|
||||
ldap_delete($link, "cn=userA,dc=my-domain,dc=com");
|
||||
ldap_delete($link, "cn=userB,dc=my-domain,dc=com");
|
||||
ldap_delete($link, "dc=my-domain,dc=com");
|
||||
}
|
||||
?>
|
||||
@@ -13,7 +13,7 @@ require "connect.inc";
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
|
||||
var_dump(
|
||||
ldap_add($link, "dc=my-domain,$base", array(
|
||||
ldap_add($link, "dc=my-domain,dc=com", array(
|
||||
"objectClass" => array(
|
||||
"top",
|
||||
"dcObject",
|
||||
@@ -23,7 +23,7 @@ var_dump(
|
||||
)),
|
||||
ldap_get_entries(
|
||||
$link,
|
||||
ldap_search($link, "$base", "(o=my-domain)")
|
||||
ldap_search($link, "dc=my-domain,dc=com", "(o=my-domain)")
|
||||
)
|
||||
);
|
||||
?>
|
||||
@@ -34,9 +34,9 @@ require "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
|
||||
ldap_delete($link, "dc=my-domain,$base");
|
||||
ldap_delete($link, "dc=my-domain,dc=com");
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
array(2) {
|
||||
["count"]=>
|
||||
@@ -77,7 +77,7 @@ array(2) {
|
||||
["count"]=>
|
||||
int(3)
|
||||
["dn"]=>
|
||||
string(%d) "dc=my-domain,%s"
|
||||
string(19) "dc=my-domain,dc=com"
|
||||
}
|
||||
}
|
||||
===DONE===
|
||||
@@ -15,12 +15,12 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
// Too few parameters
|
||||
var_dump(ldap_add());
|
||||
var_dump(ldap_add($link));
|
||||
var_dump(ldap_add($link, "$base"));
|
||||
var_dump(ldap_add($link, "dc=my-domain,dc=com"));
|
||||
|
||||
// Too many parameters
|
||||
var_dump(ldap_add($link, "$base", array(), "Additional data"));
|
||||
var_dump(ldap_add($link, "dc=my-domain,dc=com", array(), "Additional data"));
|
||||
|
||||
var_dump(ldap_add($link, "$base", array()));
|
||||
var_dump(ldap_add($link, "dc=my-domain,dc=com", array()));
|
||||
|
||||
// Invalid DN
|
||||
var_dump(
|
||||
@@ -34,14 +34,14 @@ var_dump(
|
||||
// Duplicate entry
|
||||
for ($i = 0; $i < 2; $i++)
|
||||
var_dump(
|
||||
ldap_add($link, "dc=my-domain,$base", array(
|
||||
"objectClass" => array(
|
||||
"top",
|
||||
"dcObject",
|
||||
"organization"),
|
||||
"dc" => "my-domain",
|
||||
"o" => "my-domain",
|
||||
))
|
||||
ldap_add($link, "dc=my-domain,dc=com", array(
|
||||
"objectClass" => array(
|
||||
"top",
|
||||
"dcObject",
|
||||
"organization"),
|
||||
"dc" => "my-domain",
|
||||
"o" => "my-domain",
|
||||
))
|
||||
);
|
||||
var_dump(ldap_error($link), ldap_errno($link));
|
||||
|
||||
@@ -64,7 +64,7 @@ var_dump(
|
||||
|
||||
// Invalid attribute
|
||||
var_dump(
|
||||
ldap_add($link, "$base", array(
|
||||
ldap_add($link, "dc=my-domain,dc=com", array(
|
||||
"objectClass" => array(
|
||||
"top",
|
||||
"dcObject",
|
||||
@@ -78,7 +78,7 @@ var_dump(
|
||||
);
|
||||
|
||||
var_dump(
|
||||
ldap_add($link, "$base", array(array( "Oops"
|
||||
ldap_add($link, "dc=my-domain,dc=com", array(array( "Oops"
|
||||
)))
|
||||
/* Is this correct behaviour to still have "Undefined attribute type" as error/errno?
|
||||
,
|
||||
@@ -94,7 +94,7 @@ require "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
|
||||
ldap_delete($link, "dc=my-domain,$base");
|
||||
ldap_delete($link, "dc=my-domain,dc=com");
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: ldap_add() expects exactly 3 parameters, 0 given in %s on line %d
|
||||
|
||||
@@ -11,10 +11,10 @@ Patrick Allaert <patrickallaert@php.net>
|
||||
require "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
insert_dummy_data($link, $base);
|
||||
insert_dummy_data($link);
|
||||
var_dump(
|
||||
ldap_compare($link, "cn=userA,$base", "sn", "testSN1"),
|
||||
ldap_compare($link, "cn=userA,$base", "telephoneNumber", "yy-yy-yy-yy-yy")
|
||||
ldap_compare($link, "cn=userA,dc=my-domain,dc=com", "sn", "testSN1"),
|
||||
ldap_compare($link, "cn=userA,dc=my-domain,dc=com", "telephoneNumber", "yy-yy-yy-yy-yy")
|
||||
);
|
||||
?>
|
||||
===DONE===
|
||||
@@ -23,7 +23,7 @@ var_dump(
|
||||
include "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
remove_dummy_data($link, $base);
|
||||
remove_dummy_data($link);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
|
||||
@@ -11,7 +11,7 @@ Patrick Allaert <patrickallaert@php.net>
|
||||
require "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
insert_dummy_data($link, $base);
|
||||
insert_dummy_data($link);
|
||||
|
||||
// Too few parameters
|
||||
var_dump(ldap_compare($link));
|
||||
@@ -22,7 +22,7 @@ var_dump(ldap_compare($link, $link, $link));
|
||||
var_dump(ldap_compare($link, $link, $link, $link, "Additional data"));
|
||||
|
||||
var_dump(
|
||||
ldap_compare($link, "cn=userNotAvailable,$base", "sn", "testSN1"),
|
||||
ldap_compare($link, "cn=userNotAvailable,dc=my-domain,dc=com", "sn", "testSN1"),
|
||||
ldap_error($link),
|
||||
ldap_errno($link)
|
||||
);
|
||||
@@ -33,7 +33,7 @@ var_dump(
|
||||
include "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
remove_dummy_data($link, $base);
|
||||
remove_dummy_data($link);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: ldap_compare() expects exactly 4 parameters, 1 given in %s on line %d
|
||||
|
||||
@@ -13,7 +13,7 @@ require "connect.inc";
|
||||
|
||||
// too many arguments
|
||||
var_dump(ldap_connect(null, null, null));
|
||||
var_dump(ldap_connect("ldap://$host:$port/$base"));
|
||||
var_dump(ldap_connect("ldap://$host:$port/dc=my-domain,dc=com"));
|
||||
|
||||
$links = array();
|
||||
$links[0] = ldap_connect($host, $port);
|
||||
|
||||
@@ -12,10 +12,10 @@ require_once('skipifbindfailure.inc');
|
||||
include "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
insert_dummy_data($link, $base);
|
||||
insert_dummy_data($link);
|
||||
|
||||
$dn = "$base";
|
||||
$filter = "(cn=user*)";
|
||||
$dn = "dc=my-domain,dc=com";
|
||||
$filter = "(cn=*)";
|
||||
var_dump(
|
||||
ldap_control_paged_result($link, 1),
|
||||
$result = ldap_search($link, $dn, $filter, array('cn')),
|
||||
@@ -28,11 +28,11 @@ var_dump(
|
||||
include "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
remove_dummy_data($link, $base);
|
||||
remove_dummy_data($link);
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
resource(%d) of type (ldap result)
|
||||
resource(6) of type (ldap result)
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
@@ -50,7 +50,7 @@ array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
["dn"]=>
|
||||
string(%d) "cn=userA,%s"
|
||||
string(28) "cn=userA,dc=my-domain,dc=com"
|
||||
}
|
||||
}
|
||||
===DONE===
|
||||
@@ -12,10 +12,10 @@ require_once('skipifbindfailure.inc');
|
||||
include "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
insert_dummy_data($link, $base);
|
||||
insert_dummy_data($link);
|
||||
|
||||
$dn = "$base";
|
||||
$filter = "(cn=user*)";
|
||||
$dn = "dc=my-domain,dc=com";
|
||||
$filter = "(cn=*)";
|
||||
var_dump(
|
||||
ldap_control_paged_result($link, 2),
|
||||
$result = ldap_search($link, $dn, $filter, array('cn')),
|
||||
@@ -28,11 +28,11 @@ var_dump(
|
||||
include "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
remove_dummy_data($link, $base);
|
||||
remove_dummy_data($link);
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
resource(%d) of type (ldap result)
|
||||
resource(6) of type (ldap result)
|
||||
array(3) {
|
||||
["count"]=>
|
||||
int(2)
|
||||
@@ -50,7 +50,7 @@ array(3) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
["dn"]=>
|
||||
string(%d) "cn=userA,%s"
|
||||
string(28) "cn=userA,dc=my-domain,dc=com"
|
||||
}
|
||||
[1]=>
|
||||
array(4) {
|
||||
@@ -66,7 +66,7 @@ array(3) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
["dn"]=>
|
||||
string(%d) "cn=userB,%s"
|
||||
string(28) "cn=userB,dc=my-domain,dc=com"
|
||||
}
|
||||
}
|
||||
===DONE===
|
||||
@@ -12,10 +12,10 @@ require_once('skipifbindfailure.inc');
|
||||
include "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
insert_dummy_data($link, $base);
|
||||
insert_dummy_data($link);
|
||||
|
||||
$dn = "$base";
|
||||
$filter = "(cn=user*)";
|
||||
$dn = "dc=my-domain,dc=com";
|
||||
$filter = "(cn=*)";
|
||||
$cookie = '';
|
||||
var_dump(
|
||||
ldap_control_paged_result($link, 2, true, $cookie),
|
||||
@@ -33,7 +33,7 @@ var_dump(
|
||||
include "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
remove_dummy_data($link, $base);
|
||||
remove_dummy_data($link);
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
@@ -55,7 +55,7 @@ array(3) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
["dn"]=>
|
||||
string(%d) "cn=userA,%s"
|
||||
string(28) "cn=userA,dc=my-domain,dc=com"
|
||||
}
|
||||
[1]=>
|
||||
array(4) {
|
||||
@@ -71,7 +71,7 @@ array(3) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
["dn"]=>
|
||||
string(%d) "cn=userB,%s"
|
||||
string(28) "cn=userB,dc=my-domain,dc=com"
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
@@ -94,7 +94,7 @@ array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
["dn"]=>
|
||||
string(%d) "cn=userC,cn=userB,%s"
|
||||
string(37) "cn=userC,cn=userB,dc=my-domain,dc=com"
|
||||
}
|
||||
}
|
||||
===DONE===
|
||||
@@ -11,8 +11,8 @@ Patrick Allaert <patrickallaert@php.net>
|
||||
require "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
insert_dummy_data($link, $base);
|
||||
$result = ldap_search($link, "$base", "(objectclass=person)");
|
||||
insert_dummy_data($link);
|
||||
$result = ldap_search($link, "dc=my-domain,dc=com", "(objectclass=person)");
|
||||
var_dump(ldap_count_entries($link, $result));
|
||||
?>
|
||||
===DONE===
|
||||
@@ -21,7 +21,7 @@ var_dump(ldap_count_entries($link, $result));
|
||||
include "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
remove_dummy_data($link, $base);
|
||||
remove_dummy_data($link);
|
||||
?>
|
||||
--EXPECT--
|
||||
int(3)
|
||||
|
||||
@@ -11,7 +11,7 @@ Patrick Allaert <patrickallaert@php.net>
|
||||
require "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
ldap_add($link, "dc=my-domain,$base", array(
|
||||
ldap_add($link, "dc=my-domain,dc=com", array(
|
||||
"objectClass" => array(
|
||||
"top",
|
||||
"dcObject",
|
||||
@@ -21,8 +21,8 @@ ldap_add($link, "dc=my-domain,$base", array(
|
||||
));
|
||||
|
||||
var_dump(
|
||||
ldap_delete($link, "dc=my-domain,$base"),
|
||||
@ldap_search($link, "dc=my-domain,$base", "(o=my-domain)")
|
||||
ldap_delete($link, "dc=my-domain,dc=com"),
|
||||
@ldap_search($link, "dc=my-domain,dc=com", "(o=my-domain)")
|
||||
);
|
||||
?>
|
||||
===DONE===
|
||||
@@ -32,7 +32,7 @@ require "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
|
||||
ldap_delete($link, "dc=my-domain,$base");
|
||||
ldap_delete($link, "dc=my-domain,dc=com");
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
|
||||
@@ -17,7 +17,7 @@ var_dump(ldap_delete());
|
||||
var_dump(ldap_delete($link));
|
||||
|
||||
// Too many parameters
|
||||
var_dump(ldap_delete($link, "$base", "Additional data"));
|
||||
var_dump(ldap_delete($link, "dc=my-domain,dc=com", "Additional data"));
|
||||
|
||||
// Invalid DN
|
||||
var_dump(
|
||||
@@ -28,7 +28,7 @@ var_dump(
|
||||
|
||||
// Deleting unexisting data
|
||||
var_dump(
|
||||
ldap_delete($link, "dc=my-domain,$base"),
|
||||
ldap_delete($link, "dc=my-domain,dc=com"),
|
||||
ldap_error($link),
|
||||
ldap_errno($link)
|
||||
);
|
||||
|
||||
@@ -11,7 +11,7 @@ Patrick Allaert <patrickallaert@php.net>
|
||||
require "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
@ldap_add($link, "badDN $base", array(
|
||||
@ldap_add($link, "badDN dc=my-domain,dc=com", array(
|
||||
"objectClass" => array(
|
||||
"top",
|
||||
"dcObject",
|
||||
|
||||
@@ -11,7 +11,7 @@ Patrick Allaert <patrickallaert@php.net>
|
||||
require "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
@ldap_add($link, "badDN $base", array(
|
||||
@ldap_add($link, "badDN dc=my-domain,dc=com", array(
|
||||
"objectClass" => array(
|
||||
"top",
|
||||
"dcObject",
|
||||
|
||||
Loaded 100 of 307 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user