php-src/README.UPDATE_5_2

1023 lines
37 KiB
Plaintext
Raw Normal View History

2006-09-11 22:10:18 +08:00
PHP 5.2 UPDATE INFO
2006-05-15 03:23:19 +08:00
2006-09-11 22:10:18 +08:00
===============================
Changes in PHP datetime support
===============================
2006-09-11 22:10:18 +08:00
Since PHP 5.1, there has been an extension named 'date' in the PHP core. This
is the new implementation of PHP's datetime support. Although it will attempt
to guess your system's timezone setting, you should set the timezone manually.
You can do this in any of three ways:
1) in your php.ini using the date.timezone INI directive
2) on your system using the TZ environmental variable
3) from your script using the convenience function date_default_timezone_set()
All supported timezones are listed in the PHP Manual at
http://www.php.net/manual/timezones.php.
With the advent of PHP 5.2, there are object representations of the date and
timezone, named DateTime and DateTimeZone respectively. You can see the methods
and constants available to the new classes by running
php --rc DateTime
php --rc DateTimeZone
2006-11-01 01:24:51 +08:00
under PHP CLI - or see the PHP Manual under Date/Time functions, or the 'NEW
FEATURES' section below. All methods map to existing procedural date functions.
2006-09-11 22:10:18 +08:00
==================================
Items from the NEWS file explained
==================================
2006-05-15 03:23:19 +08:00
- Added new error mode E_RECOVERABLE_ERROR. (Derick, Marcus, Tony)
2006-09-11 22:10:18 +08:00
Some of the existing E_ERROR conditions have been converted to something that
you can catch with a user-defined error handler. If an E_RECOVERABLE_ERROR is
not handled, it will behave in the same way as E_ERROR behaves in all versions
of PHP. Errors of this type are logged as 'Catchable fatal error'.
- Changed E_ALL error reporting mode to include E_RECOVERABLE_ERROR. (Marcus)
2006-09-11 22:10:18 +08:00
This change means that the value of the E_ALL error_reporting constant is now
2006-11-01 01:24:51 +08:00
6143, where the previous value was 2047. If you are setting the error_reporting
2006-09-11 22:10:18 +08:00
mode from either the Apache config file or the .htaccess files, you will need
to adjust the value accordingly. The same applies if you use the numeric value
rather than the constant in your PHP scripts.
2006-05-15 03:23:19 +08:00
- Added support for constructors in interfaces to force constructor signature
checks in implementations. (Marcus)
2006-09-11 22:10:18 +08:00
Starting with PHP 5.2, interfaces can have constructors. However, if you choose
to declare a constructor in an interface, each class implementing that interface
MUST include a constructor with a signature matching that of the base interface
constructor. By 'signature' we mean the parameter and return type definitions,
including any type hints and including whether the data is passed by reference
or by value.
2006-05-15 03:23:19 +08:00
2006-09-10 00:54:01 +08:00
- Changed __toString to be called wherever applicable. (Marcus)
2006-05-15 03:23:19 +08:00
2006-09-11 22:10:18 +08:00
The magic method __toString() will now be called in a string context, that
is, anywhere an object is used as a string. When implementing your __toString()
method in a class, you should be aware that the script will terminate if
your function throws an exception.
The PHP 5.0/5.1 fallback - returning a string that contains the object
identifier - has been dropped in PHP 5.2. It became problematic because
an object identifier cannot be considered unique. This change will mean
that your application is flawed if you have relied on the object identifier
as a return value. An attempt to use that value as a string will now result
in a catchable fatal error (see above).
Even with __toString(), objects cannot be used as array indices or keys. We
may add built-in hash support for this at a later date, but for PHP 5.2 you
will need to either provide your own hashing or use the new SPL function
spl_object_hash().
2006-05-15 03:23:19 +08:00
- Added RFC2397 (data: stream) support. (Marcus)
2006-09-11 22:10:18 +08:00
The introduction of the 'data' URL scheme has the potential to lead to a
change of behaviour under Windows. If you are working with an NTFS
2006-11-01 01:24:51 +08:00
file system and making use of meta streams in your application, and if you
2006-09-11 22:10:18 +08:00
just happen to be using a file with the name 'data:' that is accessed without
any path information - it won't work any more. The fix is to use the 'file:'
protocol when accessing it.
There is information about the RFC at http://www.faqs.org/rfcs/rfc2397.html.
2006-07-24 20:15:28 +08:00
- Added allow_url_include ini directive to complement allow_url_fopen. (Rasmus)
2006-09-11 22:10:18 +08:00
This useful option makes it possible to differentiate between standard
file operations on remote files, and the inclusion of remote files. While the
former is usually desirable, the latter can be a security risk if used naively.
Starting with PHP 5.2, you can allow remote file operations while
disallowing the inclusion of remote files in local scripts. In fact, this
is the default configuration.
2006-08-07 16:34:40 +08:00
- Dropped abstract static class functions. (Marcus)
2006-09-11 22:10:18 +08:00
Due to an oversight, PHP 5.0 and 5.1 allowed abstract static functions in
classes. In PHP 5.2, only interfaces can have them.
- Removed extensions (Derick, Tony)
The filepro and hwapi extensions have been moved to PECL and are no longer
part of the PHP distribution. The PECL package version of these extensions
2006-11-01 01:24:51 +08:00
will be created according to user demand.
2006-09-11 22:10:18 +08:00
- Added extensions (Rasmus, Derick, Pierre)
The JSON extension implements the JavaScript Object Notation (JSON)
data interchange format. This extension is enabled by default.
The Filter extension validates and filters data, and is designed for
use with insecure data such as user input. This extension is enabled
by default; the default mode RAW does not impact input data in any way.
The Zip extension enables you to transparently read or write ZIP
compressed archives and the files inside them.
2006-11-01 01:24:51 +08:00
Please refer to the NEW FEATURES section below or to the PHP Manual
for details.
2006-09-11 22:10:18 +08:00
- Improved memory manager and increased default memory limit (Dmitry)
The new memory manager allocates less memory and works faster than the
previous incarnation. It allocates memory from the system in large blocks,
and then manages the heap by itself. The memory_limit value in php.ini is
checked, not for each emalloc() call (as before), but for actual blocks
requested from the system. This means that memory_limit is far more
accurate than it used to be, since the old memory manager didn't calculate
all the memory overhead used by the malloc library.
Thanks to this new-found accuracy memory usage may appear to have increased,
although actually it has not. To accommodate this apparent increase, the
default memory_limit setting was also increased - from 8 to 16 megabytes.
- Changed priority of PHPRC environment variable on win32 (Dmitry)
The PHPRC environment variable now takes priority over the path stored
in the Windows registry.
2006-11-01 01:24:51 +08:00
- CLI SAPI no longer checks cwd for php.ini or the php-cli.ini file (Edin)
2006-09-11 22:10:18 +08:00
2006-11-01 01:24:51 +08:00
In PHP 5.1 an undocumented feature was added that made the CLI binary check
the current working directory for a PHP configuration file, potentially
leading to unpredictable behavior if an unexpected configuration file were
read. This functionality was removed in 5.2, and PHP will no longer search
CWD for the presence of php.ini or php-cli.ini files.
2006-09-11 22:10:18 +08:00
2006-11-01 01:24:51 +08:00
- Added a notice when performing modulus 0 operation (Tony)
2006-11-01 01:24:51 +08:00
In earlier versions of PHP, performing integer % 0 did not emit any
warning messages, instead returning an unexpected return value of FALSE.
As of PHP 5.2 this operation will emit an E_WARNING, as is the case in all
other instances where division by zero is performed.
2006-10-07 05:03:35 +08:00
2006-11-01 01:24:51 +08:00
- As a side-effect of a change made to prevent duplicate error messages
when error_tracking is On [Ilia], it is now necessary to return FALSE
from your error handler in order to populate $php_errormsg. This allows
you to fine-grain the levels of the messages stored.
==============================
Backwards incompatible changes
==============================
In the PHP core
===============
getrusage() will return NULL when passed incompatible arguments
2006-11-09 20:35:12 +08:00
As of 5.2.1 #See http://cvs.php.net/viewvc.cgi/php-src/ext/standard/microtime.c?r1=1.57&r2=1.58 && ?r1=1.53.2.2&r2=1.53.2.2.2.1
In ext/zip
==========
ZipArchive::setCommentName() now returns TRUE on success
ZipArchive::setCommentIndex() now return TRUE on success
2006-11-09 20:35:12 +08:00
As of 5.2.1 #See http://cvs.php.net/viewvc.cgi/php-src/ext/zip/php_zip.c?r1=1.1.2.15&r2=1.1.2.16
In ext/spl
==========
SplFileObject::getFilename() now returns the filename, not relative/path/to/file
As of 5.2.1 #See http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_directory.c?r1=1.45.2.27.2.10&r2=1.45.2.27.2.11
2006-11-01 01:24:51 +08:00
==================
NEW ERROR MESSAGES
==================
In the PHP core
===============
<?php
2006-11-01 01:24:51 +08:00
print 10%0;
/* Warning: Division by zero in filename on line n */
echo " ";
session_regenerate_id();
/* Warning: session_regenerate_id(): Cannot regenerate session id - headers already sent in filename on line n */
str_word_count("string", 4);
/* Warning: str_word_count(): Invalid format value 4 in filename on line n */
strripos("foo", "f", 4);
/* Notice: strripos(): Offset is greater than the length of haystack string in filename on line n */
strrpos("foo", "f", 4);
/* Notice: strrpos(): Offset is greater than the length of haystack string in filename on line n */
/* when allow_url_include is OFF (default) */
include "data:;base64,PD9waHAgcGhwaW5mbygpOz8+";
/* Warning: include(): URL file-access is disabled in the server configuration in filename on line n */
/* when allow_url_include is OFF (default) */
include "php://input";
/* Warning: include(): URL file-access is disabled in the server configuration in filename on line n */
2006-11-09 20:35:12 +08:00
As of 5.2.1 #See http://cvs.php.net/viewvc.cgi/php-src/ext/standard/php_fopen_wrapper.c?r1=1.45.2.4.2.3&r2=1.45.2.4.2.4
?>
2006-11-01 01:24:51 +08:00
OO related in the PHP core
==========================
<?php
2006-11-01 01:24:51 +08:00
interface foo {
}
class bar implements foo, foo {
}
2006-11-01 01:24:51 +08:00
/* Fatal error: Class bar cannot implement previously implemented interface foo in filename on line n */
class foo {
public $bar;
function __get($var)
{
return $this->bar;
}
}
$foo = new foo;
$bar =& $foo->prop;
2006-11-01 01:24:51 +08:00
/* Notice: Indirect modification of overloaded property foo::$prop has no effect in filename on line n */
class foo implements iterator {
public function current() {
}
public function next() {
}
public function key() {
}
public function valid() {
}
public function rewind() {
}
}
$foo = new foo();
2006-11-01 01:24:51 +08:00
foreach($foo as &$ref) {}
/* Fatal error: An iterator cannot be used with foreach by reference in filename on line n */
class foo {
private function __construct() {
}
}
class bar extends foo {
public function __construct() {
parent::__construct();
2006-11-01 01:24:51 +08:00
/* Fatal error: Cannot call private foo::__construct() in filename on line n */
}
}
new bar;
abstract class foo {
abstract static function bar();
2006-11-01 01:24:51 +08:00
/* Strict Standards: Static function foo::bar() should not be abstract in filename on line n */
}
stream_filter_register("", "class");
2006-11-01 01:24:51 +08:00
/* Warning: stream_filter_register(): Filter name cannot be empty in filename on line n */
stream_filter_register("filter", "");
2006-11-01 01:24:51 +08:00
/* Warning: stream_filter_register(): Class name cannot be empty in filename on line n */
class foo {
public function __toString() {
throw new Exception;
}
}
try {
print new foo;
/* Fatal error: Method foo::__toString() must not throw an exception in filename on line n */
} catch(Exception $e) {}
class foo {}
$foo = new foo;
print $foo;
/* Catchable fatal error: Object of class foo could not be converted to string in filename on line n */
?>
2006-11-01 01:24:51 +08:00
In the bzip2 extension
======================
<?php
2006-11-01 01:24:51 +08:00
bzopen("", "w");
/* Warning: bzopen(): filename cannot be empty in filename on line n */
bzopen("foo", "a");
/* Warning: bzopen(): 'a' is not a valid mode for bzopen(). Only 'w' and 'r' are supported in filename on line n */
$fp = fopen("foo", "w");
bzopen($fp, "r");
/* Warning: bzopen(): cannot read from a stream opened in write only mode in filename on line n */
?>
In the date extension
=====================
<?php
strtotime("today", "now");'
/* Warning: strtotime() expects parameter 2 to be long, string given in filename on line n */
new DateTime(new stdclass);
/* Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct() expects parameter 1 to be string, object given' in filename:n */
2006-11-09 20:35:12 +08:00
As of 5.2.1 #See http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.33&r2=1.43.2.45.2.34
?>
2006-11-01 01:24:51 +08:00
In the dBase extension
======================
<?php
2006-11-01 01:24:51 +08:00
dbase_open("foo", -1);
/* Warning: Invalid access mode -1 in filename on line n */
dbase_open("foo", null);
/* Warning: The filename cannot be empty in filename on line n */
As of 5.2.1 #See http://cvs.php.net/viewvc.cgi/php-src/ext/dbase/dbase.c?r1=1.74.2.2.2.5&r2=1.74.2.2.2.6&diff_format=u
?>
2006-11-01 01:24:51 +08:00
In the mcrypt extension
=======================
<?php
2006-11-01 01:24:51 +08:00
$key = "this is a secret key";
$td = mcrypt_module_open('tripledes', '', 'ecb', '');
$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
mcrypt_generic_init($td, $key, $iv);
$encrypted_data = mcrypt_generic($td, "");
/* Warning: mcrypt_generic(): An empty string was passed in filename on line n */
?>
2006-11-01 01:24:51 +08:00
In the oci8 extension
=====================
<?php
2006-11-01 01:24:51 +08:00
oci_connect("user", "pass", "db", "bogus_charset");
/* Warning: Invalid character set name: bogus_charset in filename on line n */
$oci = oci_connect("user", "pass", "db");
oci_password_change($oci, "", "old", "new");
/* Warning: username cannot be empty in filename on line n */
oci_password_change($oci, "user", "", "new");
/* Warning: old password cannot be empty in filename on line n */
oci_password_change($oci, "user", "old", "");
/* Warning: new password cannot be empty in filename on line n */
?>
2006-11-01 01:24:51 +08:00
In the SPL extension
====================
<?php
2006-11-01 01:24:51 +08:00
$obj = new SplFileObject(__FILE__);
$obj->fgetcsv("foo");
/* Warning: SplFileObject::fgetcsv(): delimiter must be a character in filename on line n */
$obj->fgetcsv(",", "foo");
/* Warning: SplFileObject::fgetcsv(): enclosure must be a character in filename on line n */
?>
In the sysvmsg extension
========================
<?php
/* Warning: maximum size of the message has to be greater then zero in filename on line n */
?>
In the Zip extension
====================
<?php
$obj = new ZipArchive();
$obj->open("archive.zip");
$obj->setCommentName("", "comment");'
/* Notice: ZipArchive::setCommentName(): Empty string as entry name in filename on line n */
$obj->getCommentName("");
/* Notice: ZipArchive::getCommentName(): Empty string as entry name in filename on line n */
2006-11-09 20:35:12 +08:00
As of 5.2.1 #See http://cvs.php.net/viewvc.cgi/php-src/ext/zip/php_zip.c?r1=1.1.2.15&r2=1.1.2.16
?>
============
NEW FEATURES
============
2006-11-01 01:24:51 +08:00
New extensions
==============
Filter
Methods:
mixed filter_has_var(constant type, string variable_name)
- Returns true if the variable with the name 'name' exists in source
int filter_id(string filtername)
- Returns the filter ID belonging to a named filter
mixed filter_input(constant type, string variable_name [, long filter [, mixed options]])
- Returns the filtered variable 'name'* from source `type`
mixed filter_input_array(constant type, [, mixed options]])
- Returns an array with all arguments defined in 'definition'
array filter_list()
- Returns a list of all supported filters
mixed filter_var(mixed variable [, long filter [, mixed options]])
- Returns the filtered version of the variable.
mixed filter_var_array(array data, [, mixed options]])
- Returns an array with all arguments defined in 'definition'
JSON
2006-11-01 01:24:51 +08:00
Methods:
mixed json_decode(string json[, boolean assoc=0])
- Decodes a JSON string into a PHP object/associative array
string json_encode(mixed parameter)
- Takes a object or an array and returns a JSON encoded string
Zip
Class constants:
ZipArchive::CHECKCONS
ZipArchive::CM_DEFAULT
ZipArchive::CM_DEFLATE
ZipArchive::CM_DEFLATE64
2006-11-01 01:24:51 +08:00
ZipArchive::CM_IMPLODE
ZipArchive::CM_PKWARE_IMPLODE
ZipArchive::CM_REDUCE_1
ZipArchive::CM_REDUCE_2
ZipArchive::CM_REDUCE_3
ZipArchive::CM_REDUCE_4
2006-11-01 01:24:51 +08:00
ZipArchive::CM_SHRINK
ZipArchive::CM_STORE
ZipArchive::CREATE
ZipArchive::ER_CHANGED
2006-11-01 01:24:51 +08:00
ZipArchive::ER_CLOSE
ZipArchive::ER_COMPNOTSUPP
2006-11-01 01:24:51 +08:00
ZipArchive::ER_CRC
ZipArchive::ER_DELETED
ZipArchive::ER_EOF
2006-11-01 01:24:51 +08:00
ZipArchive::ER_EXISTS
ZipArchive::ER_INCONS
ZipArchive::ER_INTERNAL
ZipArchive::ER_INVAL
2006-11-01 01:24:51 +08:00
ZipArchive::ER_MEMORY
ZipArchive::ER_MULTIDISK
ZipArchive::ER_NOENT
ZipArchive::ER_NOZIP
2006-11-01 01:24:51 +08:00
ZipArchive::ER_OK
ZipArchive::ER_OPEN
ZipArchive::ER_READ
ZipArchive::ER_REMOVE
2006-11-01 01:24:51 +08:00
ZipArchive::ER_RENAME
ZipArchive::ER_SEEK
ZipArchive::ER_TMPOPEN
ZipArchive::ER_WRITE
ZipArchive::ER_ZIPCLOSED
ZipArchive::ER_ZLIB
ZipArchive::EXCL
ZipArchive::FL_COMPRESSED
ZipArchive::FL_NOCASE
ZipArchive::FL_NODIR
ZipArchive::FL_UNCHANGED
ZipArchive::OVERWRITE
Functions:
void zip_close(resource zip)
- Close a Zip archive
void zip_entry_close(resource zip_ent)
- Close a zip entry
int zip_entry_compressedsize(resource zip_entry)
2006-11-01 01:24:51 +08:00
- Return the compressed size of a Zip entry
string zip_entry_compressionmethod(resource zip_entry)
- Return a string containing the compression method used on a particular entry
2006-11-01 01:24:51 +08:00
int zip_entry_filesize(resource zip_entry)
- Return the actual filesize of a Zip entry
string zip_entry_name(resource zip_entry)
- Return the name given a Zip entry
bool zip_entry_open(resource zip_dp, resource zip_entry [, string mode])
- Open a Zip File, pointed by the resource entry
mixed zip_entry_read(resource zip_entry [, int len])
- Read from an open directory entry
resource zip_open(string filename)
- Create new zip using source URI for output
resource zip_read(resource zip)
- Returns the next file in the archive
Methods:
bool ZipArchive::addFile(string filepath[, string entryname[, int start [, int length]]])
- Add a file in a Zip archive using its path and the name to use
bool ZipArchive::addFromString(string name, string content)
- Add a file using content and the entry name
2006-11-01 01:24:51 +08:00
void ZipArchive::close()
- close the zip archive
bool ZipArchive::deleteIndex(int index)
- Delete a file using its index
bool ZipArchive::deleteName(string name)
- Delete a file using its index
2006-11-01 01:24:51 +08:00
bool ZipArchive::extractTo(string pathto[, mixed files])
- Extract one or more file from a zip archive to a specified destination
string ZipArchive::getArchiveComment()
- Returns the Zip archive comment
string ZipArchive::getCommentIndex(int index)
- Returns the comment of an entry using its index
string ZipArchive::getCommentName(string name)
- Returns the comment of an entry using its name
string ZipArchive::getFromName(string entryname[, int len [, int flags]])
- get the contents of an entry using its name
string ZipArchive::getFromIndex(string entryname[, int len [, int flags]])
- get the contents of an entry using its index
2006-11-01 01:24:51 +08:00
string ZipArchive::getNameIndex(int index [, int flags])
- Returns the name of the file at position index
resource ZipArchive::getStream(string entryname)
2006-11-01 01:24:51 +08:00
- Get a stream for an entry using its name
int ZipArchive::locateName(string filename[, int flags])
- Returns the index of the entry named filename in the archive
mixed ZipArchive::open(string source [, int flags])
- Create new zip using source URI for output, return TRUE on success or the error code
bool ZipArchive::renameIndex(int index, string new_name)
- Rename an entry selected by its index to new_name
bool ZipArchive::renameName(string name, string new_name)
- Rename an entry selected by its name to new_name
bool ZipArchive::setArchiveComment(string name, string comment)
- Set or remove (NULL/'') the comment of the archive
bool ZipArchive::setCommentIndex(int index, string comment)
- Set or remove (NULL/'') the comment of an entry using its index
bool ZipArchive::setCommentName(string name, string comment)
- Set or remove (NULL/'') the comment of an entry using its Name
array ZipArchive::statIndex(int index[, int flags])
- Returns the zip entry information using its index
array ZipArchive::statName(string filename[, int flags])
- Returns the information about a the zip entry filename
bool ZipArchive::unchangeAll()
- All changes made to the archive are reverted
bool ZipArchive::unchangeArchive()
- Revert all global changes to the archive. For now, this only reverts archive comment changes
bool ZipArchive::unchangeIndex(int index)
- Changes to the file at position index are reverted
bool ZipArchive::unchangeName(string name)
- Changes to the file named 'name' are reverted
2006-11-01 01:24:51 +08:00
New classes
===========
DateTime:
Constants:
DateTime::ATOM
DateTime::COOKIE
DateTime::ISO8601
DateTime::RFC822
DateTime::RFC850
DateTime::RFC1036
DateTime::RFC1123
DateTime::RFC2822
DateTime::RFC3339
DateTime::RSS
DateTime::W3C
Methods:
DateTime::__construct([string time[, DateTimeZone object]])
- Returns new DateTime object
2006-11-03 15:27:52 +08:00
string DateTime::format(string format)
- Returns date formatted according to given format
2006-11-03 15:27:52 +08:00
long DateTime::getOffset()
- Returns the DST offset
2006-11-03 15:27:52 +08:00
DateTimeZone DateTime::getTimezone()
2006-11-01 01:24:51 +08:00
- Return new DateTimeZone object relative to give DateTime
2006-11-03 15:27:52 +08:00
void DateTime::modify(string modify)
2006-11-01 01:24:51 +08:00
- Alters the timestamp
array DateTime::parse(string date)
- Returns associative array with detailed info about given date
2006-11-03 15:27:52 +08:00
void DateTime::setDate(long year, long month, long day)
- Sets the date
2006-11-03 15:27:52 +08:00
void DateTime::setISODate(long year, long week[, long day])
- Sets the ISO date
2006-11-03 15:27:52 +08:00
void DateTime::setTime(long hour, long minute[, long second])
2006-11-01 01:24:51 +08:00
- Sets the time
2006-11-03 15:27:52 +08:00
void DateTime::setTimezone(DateTimeZone object)
2006-11-01 01:24:51 +08:00
- Sets the timezone for the DateTime object
2006-11-01 01:24:51 +08:00
DateTimeZone:
Methods:
DateTimeZone DateTimeZone::__construct(string timezone)
- Returns new DateTimeZone object
2006-11-03 15:27:52 +08:00
string DateTimeZone::getName()
- Returns the name of the timezone
2006-11-03 15:27:52 +08:00
long DateTimeZone::getOffset(DateTime object)
- Returns the timezone offset
2006-11-03 15:27:52 +08:00
array DateTimeZone::getTransitions()
2006-11-01 01:24:51 +08:00
- Returns numerically indexed array containing associative array for all transitions for the timezone
2006-11-01 01:24:51 +08:00
RecursiveRegexIterator:
extends RegexIterator
implements OuterIterator, Traversable, Iterator, RecursiveIterator
Methods:
RecursiveRegexIterator::__construct(RecursiveIterator it, string regex [, int mode [, int flags [, int preg_flags]]])
Create an RecursiveRegexIterator from another recursive iterator and a regular expression
RecursiveRegexIterator RecursiveRegexIterator::getChildren()
Return the inner iterator's children contained in a RecursiveRegexIterator
bool RecursiveRegexIterator::hasChildren()
Check whether the inner iterator's current element has children
2006-11-01 01:24:51 +08:00
RegexIterator:
extends FilterIterator
implements Iterator, Traversable, OuterIterator
Constants:
RecursiveRegexIterator::ALL_MATCHES
RecursiveRegexIterator::GET_MATCH
RecursiveRegexIterator::MATCH
RecursiveRegexIterator::REPLACE
RecursiveRegexIterator::SPLIT
RecursiveRegexIterator::USE_KEY
Properties:
public $replacement
Methods:
RegexIterator::__construct(Iterator it, string regex [, int mode [, int flags [, int preg_flags]]])
- Create an RegexIterator from another iterator and a regular expression
bool RegexIterator::accept()
- Match (string)current() against regular expression
bool RegexIterator::getFlags()
- Returns current operation flags
bool RegexIterator::getMode()
- Returns current operation mode
bool RegexIterator::getPregFlags()
- Returns current PREG flags (if in use or NULL)
bool RegexIterator::setFlags(int new_flags)
- Set operation flags
bool RegexIterator::setMode(int new_mode)
- Set new operation mode
bool RegexIterator::setPregFlags(int new_flags)
- Set PREG flags
New methods
===========
In ext/dom
==========
DOMDocument:
DOMDocument::registerNodeClass(string baseclass, string extendedclass)
- Register extended class used to create base node type
DOMElement:
DOMElement::setIDAttribute(string name, boolean isId)
- Declares the attribute specified by name to be of type ID
DOMElement::setIDAttributeNode(DOMAttr idAttr, boolean isId)
- Declares the attribute specified by node to be of type ID
2006-11-01 01:24:51 +08:00
DOMElement::setIDAttributeNS(string namespaceURI, string localName, boolean isId)
- Declares the attribute specified by local name and namespace URI to be of type ID
DOMNode:
DOMNode::C14N([bool exclusive [, bool with_comments [, array xpath [, array ns_prefixes]]]])
- Canonicalize nodes to a string
DOMNode::C14NFile(string uri [, bool exclusive [, bool with_comments [, array xpath [, array ns_prefixes]]]])
- Canonicalize nodes to a file
2006-11-01 01:24:51 +08:00
DOMNode::getNodePath()
- Gets an xpath for a node
2006-11-01 01:24:51 +08:00
In ext/soap
===========
SoapServer:
SoapServer::setObject(object obj)
- Sets object which will handle SOAP requests
2006-11-01 01:24:51 +08:00
In ext/spl
==========
ArrayObject:
int ArrayObject::asort(void)
- Sort the entries by values
int ArrayObject::ksort(void)
- Sort the entries by key
2006-11-01 01:24:51 +08:00
int ArrayObject::natcasesort(void)
- Sort the entries by key using case insensitive "natural order" algorithm.
int ArrayObject::natsort(void)
- Sort the entries by values using "natural order" algorithm.
int ArrayObject::uasort(callback cmp_function)
- Sort the entries by values user defined function
int ArrayObject::uksort(callback cmp_function)
- Sort the entries by key using user defined function.
2006-11-01 01:24:51 +08:00
AppendIterator:
ArrayIterator AppendIterator::getArrayIterator()
Get access to inner ArrayIterator
int AppendIterator::getIteratorIndex()
Get index of iterator
2006-11-01 01:24:51 +08:00
CachingIterator:
bool CachingIterator::getCache()
Return the cache
int CachingIterator::getFlags()
Return the internal flags
2006-11-01 01:24:51 +08:00
bool CachingIterator::offsetExists(mixed index)
Return whether the requested index exists
string CachingIterator::offsetGet(mixed index)
- Return the internal cache if used
void CachingIterator::offsetSet(mixed index, mixed newval)
- Set given index in cache
void CachingIterator::offsetUnset(mixed index)
- Unset given index in cache
void CachingIterator::setFlags()
Set the internal flags
2006-11-01 01:24:51 +08:00
SplFileObject:
array("delimiter" =>, "enclosure" =>) SplFileObject::getCsvControl(void)
- Get the delimiter and enclosure character used in fgetcsv
void SplFileObject::setCsvControl([string delimiter = ',' [, string enclosure = '"']])
- Set the delimiter and enclosure character used in fgetcsv
XMLReader:
boolean XMLReader::setSchema(string filename)
Use W3C XSD schema to validate the document as it is processed. Activation is only possible before the first Read()
In ext/zip
==========
ZipArchive:
bool addEmptyDir(string dirname)
Creates an empty directory in the archive
2006-11-09 20:35:12 +08:00
As of 5.2.1 #See http://cvs.php.net/viewvc.cgi/php-src/ext/zip/php_zip.c?r1=1.1.2.15&r2=1.1.2.16
2006-11-01 01:24:51 +08:00
New class constants
===================
In ext/pdo
==========
PDO::ATTR_DEFAULT_FETCH_MODE
PDO::FETCH_PROPS_LATE
In ext/spl
==========
CachingIterator::FULL_CACHE
CachingIterator::TOSTRING_USE_INNER
SplFileObject::READ_AHEAD
SplFileObject::READ_CSV
2006-11-01 01:24:51 +08:00
SplFileObject::SKIP_EMPTY
2006-11-01 01:24:51 +08:00
New functions
=============
2006-11-01 01:24:51 +08:00
In the PHP core
===============
array array_fill_keys(array keys, mixed val)
- Create an array using the elements of the first parameter as keys, each initialized to val
array error_get_last()
- Get the last occurred error as associative array. Returns NULL if there hasn't been an error yet
string image_type_to_extension(int imagetype [, bool include_dot])
- Get file extension for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype
int memory_get_peak_usage([real_usage])
- Returns the peak allocated by PHP memory
array timezone_abbreviations_list()
- Returns associative array containing DST, offset and the timezone name
array timezone_identifiers_list()
- Returns numerically indexed array with all timezone identifiers
string timezone_name_from_abbr(string abbr[, long gmtOffset[, long isdst]])
- Returns the timezone name from abbreviation
As of 5.2.1: #See http://cvs.php.net/viewvc.cgi/php-src/ext/standard/streamsfuncs.c?r1=1.58.2.6.2.9&r2=1.58.2.6.2.10&diff_format=u
int stream_socket_shutdown(resource stream, int how)
- Causes all or part of a full-duplex connection on the socket associated with stream to be shut down
2006-11-01 01:24:51 +08:00
In ext/mbstring
===============
array mb_list_encodings_alias_names([string encoding])
- Returns an array of all supported entity encodings
mixed mb_list_mime_names([string encoding])
- Returns an array or string of all supported mime names
int mb_stripos(string haystack, string needle [, int offset [, string encoding]])
- Finds position of first occurrence of a string within another, case insensitive
string mb_stristr(string haystack, string needle[, bool part[, string encoding]])
- Finds first occurrence of a string within another, case insensitive
2006-11-01 01:24:51 +08:00
string mb_strrchr(string haystack, string needle[, bool part[, string encoding]])
- Finds the last occurrence of a character in a string within another
string mb_strrichr(string haystack, string needle[, bool part[, string encoding]])
- Finds the last occurrence of a character in a string within another, case insensitive
2006-11-01 01:24:51 +08:00
int mb_strripos(string haystack, string needle [, int offset [, string encoding]])
- Finds position of last occurrence of a string within another, case insensitive
string mb_strstr(string haystack, string needle[, bool part[, string encoding]])
- Finds first occurrence of a string within another
In ext/ming
===========
As of 5.2.1: See http://cvs.php.net/viewvc.cgi/php-src/ext/ming/ming.c?r1=1.79.2.4.2.4&r2=1.79.2.4.2.5&diff_format=u
void ming_setSWFCompression(int num)
- Sets output compression
void swfmovie::namedanchor(string name)
- Creates anchor
void swfmovie::protect([string pasword])
- Protects
2006-11-01 01:24:51 +08:00
In ext/openssl
==============
resource openssl_csr_get_public_key(mixed csr)
2006-11-01 01:24:51 +08:00
- Extracts public key from a CERT and prepares it for use
array openssl_csr_get_subject(mixed csr [, bool use_short_names])
- Returns the subject of a CERT
array openssl_pkey_get_details(resource key)
- returns an array with the key details (bits, pkey, type)
2006-11-01 01:24:51 +08:00
In ext/spl
==========
string spl_object_hash(object obj)
- Return hash id for given object
int iterator_apply(Traversable it, mixed function [, mixed params])
- Calls a function for every element in an iterator
2006-11-01 01:24:51 +08:00
In ext/pcre
===========
int preg_last_error(void)
2006-11-01 01:24:51 +08:00
- Returns the error code of the last regex execution
2006-11-01 01:24:51 +08:00
In ext/pgsql
============
mixed pg_field_table(resource result, int field_number[, bool oid_only])
- Returns the name of the table field belongs to, or table's oid if oid_only is true
2006-11-01 01:24:51 +08:00
In ext/posix
============
bool posix_initgroups(string name, int base_group_id)
- Calculate the group access list for the user specified in name
2006-11-01 01:24:51 +08:00
In ext/gmp
==========
resource gmp_nextprime(resource a)
- Finds next prime of a
2006-11-01 01:24:51 +08:00
In ext/xmlwriter
================
bool xmlwriter_full_end_element(resource xmlwriter)
- End current element - returns FALSE on error
bool xmlwriter_write_raw(resource xmlwriter, string content)
- Write text - returns FALSE on error
2007-01-07 00:50:55 +08:00
As of 5.2.1 #See http://cvs.php.net/viewvc.cgi/php-src/ext/xmlwriter/php_xmlwriter.c?r1=1.20.2.12.2.8&r2=1.20.2.12.2.9
bool xmlwriter_start_dtd_entity(resource xmlwriter, string name, bool isparam)
- Create start DTD Entity - returns FALSE on error
bool xmlwriter_end_dtd_entity(resource xmlwriter)
- End current DTD Entity - returns FALSE on error
bool xmlwriter_write_dtd_entity(resource xmlwriter, string name, string content [, bool pe [, string pubid [, string sysid [, string ndataid]]]])
2007-01-07 00:50:55 +08:00
- Write full DTD Entity tag - returns FALSE on error
2006-11-01 01:24:51 +08:00
New optional parameters
=======================
2006-11-01 01:24:51 +08:00
In the PHP core
===============
- string base64_decode(string str[, bool strict=false]) (strict)
- bool setcookie(string name [, string value [, int expires [, string path [, string domain [, bool secure[, bool httponly=false]]]]]] (httponly)
- bool setrawcookie(string name [, string value [, int expires [, string path [, string domain [, bool secure[, bool httponly=false]]]]]] (httponly)
2006-10-25 05:16:24 +08:00
- void session_set_cookie_params(int lifetime [, string path [, string domain [, bool secure[, bool httponly]]]]) (httponly)
- int memory_get_usage([bool real_usage=false]) (real_usage)
2006-11-01 01:24:51 +08:00
In ext/curl
===========
- array curl_multi_info_read(resource mh [, long msgs_in_queue]) (msgs_in_queue)
In ext/imap
===========
- resource imap_open ( string mailbox, string username, string password [, int options[, int n_retries]]) (n_retries)
- bool imap_reopen(resource stream_id, string mailbox [, int options [, int n_retries]]) (n_retries)
2006-11-09 20:35:12 +08:00
As of 5.2.1 #See http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.7&r2=1.208.2.7.2.8
2006-11-01 01:24:51 +08:00
In ext/mbstring
===============
- int mb_strrpos(string haystack, string needle [, int offset [, string encoding]]) (offset)
In ext/ming
2006-11-09 20:35:12 +08:00
===========
- int swfmovie::streamMP3(mixed file [, float skip]) (skip)
2006-11-09 20:35:12 +08:00
As of 5.2.1 #See http://cvs.php.net/viewvc.cgi/php-src/ext/ming/ming.c?r1=1.79.2.4.2.3&r2=1.79.2.4.2.4
2006-11-01 01:24:51 +08:00
In ext/openssl
==============
- int openssl_verify(string data, string signature, mixed key [, int signature_algo]) (signature_algo)
In ext/pgsql
============
- string pg_escape_bytea([resource connection,] string data) (connection)
- string pg_escape_string([resource connection,] string data) (connection)
In ext/simplexml
================
- SimpleXMLElement::__construct(string data [, int options [, bool data_is_url [, string ns [, bool is_prefix]]]]) (ns, is_prefix)
- SimpleXMLElement SimpleXMLElement::attributes([string ns [, bool is_prefix]]) (is_prefix)
- SimpleXMLElement SimpleXMLElement::children([string ns [, bool is_prefix]]) (is_prefix)
- SimpleXMLElement simplexml_load_file(string filename [, string class_name [, int options [, string ns [, bool is_prefix]]]]) (ns, is_prefix)
- SimpleXMLElement simplexml_load_string(string data [, string class_name [, int options [, string ns [, bool is_prefix]]]]) (ns, is_prefix)
In ext/spl
==========
- array iterator_to_array(Traversable it [, bool use_keys = true]) (use_keys)
As of 5.2.1 #See http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.20&r2=1.73.2.30.2.21
2006-11-01 01:24:51 +08:00
In ext/xmlreader
================
- boolean XMLReader::open(string URI [, string encoding [, int options]]) (encoding, options)
- boolean XMLReader::XML(string source [, string encoding [, int options]]) (encoding, options)
2006-11-01 01:24:51 +08:00
New INI settings
================
allow_url_include PHP_INI_SYSTEM, default: false
pcre.backtrack_limit PHP_INI_ALL, default: 100000
pcre.recursion_limit PHP_INI_ALL, default: 100000
session.cookie_httponly PHP_INI_ALL, default: false
2006-10-25 05:43:51 +08:00
2006-11-01 01:24:51 +08:00
New global constants
====================
In the PHP core
===============
- M_EULER
- M_LNPI
- M_SQRT3
- M_SQRTPI
- PATHINFO_FILENAME
- PREG_BACKTRACK_LIMIT_ERROR
- PREG_BAD_UTF8_ERROR
- PREG_INTERNAL_ERROR
- PREG_NO_ERROR
- PREG_RECURSION_LIMIT_ERROR
- UPLOAD_ERR_EXTENSION
As of 5.2.1: (See http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.13&r2=1.409.2.6.2.14&diff_format=u)
- STREAM_SHUT_RD
- STREAM_SHUT_WR
- STREAM_SHUT_RDWR
2006-11-01 01:24:51 +08:00
In ext/curl
===========
2006-10-25 20:58:46 +08:00
- CURLE_FILESIZE_EXCEEDED
- CURLE_FTP_SSL_FAILED
2006-11-01 01:24:51 +08:00
- CURLE_LDAP_INVALID_URL
2006-10-25 20:58:46 +08:00
- CURLFTPAUTH_DEFAULT
- CURLFTPAUTH_SSL
- CURLFTPAUTH_TLS
2006-11-01 01:24:51 +08:00
- CURLFTPSSL_ALL
- CURLFTPSSL_CONTROL
2006-10-25 05:43:51 +08:00
- CURLFTPSSL_NONE
- CURLFTPSSL_TRY
2006-11-01 01:24:51 +08:00
- CURLOPT_FTP_SSL
- CURLOPT_FTPSSLAUTH
2006-10-25 05:43:51 +08:00
In ext/ming
===========
As of 5.2.1: See http://cvs.php.net/viewvc.cgi/php-src/ext/ming/ming.c?r1=1.79.2.4.2.4&r2=1.79.2.4.2.5&diff_format=u
- SWFTEXTFIELD_USEFONT
- SWFTEXTFIELD_AUTOSIZE
- SWF_SOUND_NOT_COMPRESSED
- SWF_SOUND_ADPCM_COMPRESSED
- SWF_SOUND_MP3_COMPRESSED
- SWF_SOUND_NOT_COMPRESSED_LE
- SWF_SOUND_NELLY_COMPRESSED
- SWF_SOUND_5KHZ
- SWF_SOUND_11KHZ
- SWF_SOUND_22KHZ
- SWF_SOUND_44KHZ
- SWF_SOUND_8BITS
- SWF_SOUND_16BITS
- SWF_SOUND_MONO
- SWF_SOUND_STEREO
2006-11-01 01:24:51 +08:00
In ext/openssl
==============
2006-10-25 05:43:51 +08:00
- OPENSSL_VERSION_NUMBER
2006-11-01 01:24:51 +08:00
- OPENSSL_VERSION_TEXT
2006-10-25 05:43:51 +08:00
2006-11-01 01:24:51 +08:00
In ext/snmp
===========
2006-10-25 05:43:51 +08:00
- SNMP_OID_OUTPUT_FULL
- SNMP_OID_OUTPUT_NUMERIC
2006-11-01 01:24:51 +08:00
In ext/sysvmsg
==============
2006-10-25 05:43:51 +08:00
- MSG_EAGAIN
- MSG_ENOMSG