首页 > 开发 > PHP > 正文

PHP 4.1.0 出版公告(中英对照版)1

2024-05-04 22:56:42
字体:
来源:转载
供稿:网友


收集最实用的网页特效代码!

php 4.1.0 release announcement

php 4.1.0 出版公告(1)

after a lengthy qa process, php 4.1.0 is finally out.
download at http://www.php.net/downloads.php !

php 4.1.0 includes several other key improvements:
- a new input interface for improved security (read below)

一个新的输入界面来提高安全性

- highly improved performance in general

极大提高了性能

- revolutionary performance and stability improvements under
windows. the multithreaded server modules under windows (isapi,
apache, etc.) perform as much as 30 times faster under load! we
want to thank brett brewer and his team in microsoft for working
with us to improve php for windows.

windows 下革命性的性能和稳定性。多线程服务器模块提供了快30倍的性能。

- versioning support for extensions. right now it's barely being
used, but the infrastructure was put in place to support separate
version numbers for different extensions. the negative side effect
is that loading extensions that were built against old versions of
php will now result in a crash, instead of in a nice clear message.
make sure you only use extensions built with php 4.1.0.

扩展翻译支持,现在他还很少用到,但是放置了基础构造来支持某些不同版本号的扩展模块。负面影响是他和老版本的扩展模块冲突。你需要确定使用了 php4.1.0的扩展模块。

- turn-key output compression support

支持 turn-key 输出压缩

- *lots* of fixes and new functions

修正了很多地方,增加了许多函数。

as some of you may notice, this version is quite historical, as it's
the first time in history we actually incremented the middle digit! :)
the two key reasons for this unprecedented change were the new input
interface, and the broken binary compatibility of modules due to the
versioning support.

{没看懂!!呵呵!以后看懂了再翻译}

following is a description of the new input mechanism. for a full
list of changes in php 4.1.0, scroll down to the end of this section.

下面是新的输入机制的描述。完整的更改列表请看后面

-----------------------------------

security: new input mechanism

安全:新的输入机制

first and foremost, it's important to stress that regardless of
anything you may read in the following lines, php 4.1.0 *supports*
the old input mechanisms from older versions. old applications
should go on working fine without modification!

首先,也是最重要的,必须强调对下面内容足够重视是非常重要的。php 4.1.0 支持旧的输入机制。老的应用程序仍然可以运行,不用修改。

now that we have that behind us, let's move on :)

下面是内容

for various reasons, php setups which rely on register_globals
being on (i.e., on form, server and environment variables becoming
a part of the global namespace, automatically) are very often
exploitable to various degrees. for example, the piece of code:

由于各种原因,php需要设置 register_globlas on(例如在标单,服务器,环境变量自动成为全局命名空间的一部分),他们经常被不同程度的干扰。下面是一段代码:

<?php
if (authenticate_user()) {
$authenticated = true;
}
...
?>

may be exploitable, as remote users can simply pass on 'authenticated'
as a form variable, and then even if authenticate_user() returns false,
$authenticated will actually be set to true. while this looks like a
simple example, in reality, quite a few php applications ended up being
exploitable by things related to this misfeature.

可以通过表单里面传送 authenticated 变量来欺骗,即使 authenticate_user()返回false,$authenticated 仍然被设置为true.这只是一个非常简单的例子,实际上,相当多的程序被类似的错误特性欺骗

while it is quite possible to write secure code in php, we felt that the
fact that php makes it too easy to write insecure code was bad, and we've
decided to attempt a far-reaching change, and deprecate register_globals.
obviously, because the vast majority of the php code in the world relies
on the existence of this feature, we have no plans to actually remove it
from php anytime in the foreseeable future, but we've decided to encourage
people to shut it off whenever possible.

当然,完全可以书写安全的php代码,我们觉得事实上,php使得书写不安全代码变得非常容易是非常糟糕的事情。我们决定尝试一个 far-reaching 改变。反对 register_globals.很显然,由于多数代码依赖于这个特征,我们没有办法在将来的某个时刻真正删除它。但是我们决定鼓励人们关闭它

to help users build php applications with register_globals being off,
we've added several new special variables that can be used instead of the
old global variables. there are 7 new special arrays:

为了在关闭 register_globals 情况下帮助用户创建 php 应用程序,我们增加了一些新的特殊变量来代替老的全局变量使用。他们是7个新的特殊数组:

$_get - contains form variables sent through get

包含着通过get发来的变量

$_post - contains form variables sent through post

包含着通过post发送来的变量

$_cookie - contains http cookie variables

包含着http cookie 的变量

$_server - contains server variables (e.g., remote_addr)

包含着服务器变量(如 remote_addr)

$_env - contains the environment variables

包含着环境变量

$_request - a merge of the get variables, post variables and cookie variables.
in other words - all the information that is coming from the user,
and that from a security point of view, cannot be trusted.

是 get/post/cookie 变量的集合,也就是说,所有的来自用户和安全表单的信息。但是从安全角度来看,不能够信任它们。

$_session - contains http variables registered by the session module

包含着所有session模块注册的http变量

now, other than the fact that these variables contain this special information,
they're also special in another way - they're automatically global in any
scope. this means that you can access them anywhere, without having to
'global' them first. for example:

现在,事实上这些变量包含着特殊的信息,他们在任何环境下同样是自动的全局变量。也就是说你可以在任何地方存取他们,不需要全局化他们。例如:

function example1()
{
print $_get["name"]; // works, 'global $_get;' is not necessary!

//不需要声明 $_get 是全局变量
}

would work fine! we hope that this fact would ease the pain in migrating
old code to new code a bit, and we're confident it's going to make writing
new code easier. another neat trick is that creating new entries in the
$_session array will automatically register them as session variables, as
if you called session_register(). this trick is limited to the session
module only - for example, setting new entries in $_env will *not* perform
an implicit putenv().

运行的很好。我们希望这个情况可以使得旧代码移植能够容易一些,我们确信它能使书写新代码更容易。另外一个窍门是创建新的 $_session 数组入口会自动注册他们为session b变量,就好像调用 session_register()一样。这个窍门仅适用于 session 模块。例如,设置新的 $_env 入口不会隐含执行 putenv()。

php 4.1.0 still defaults to have register_globals set to on. it's a
transitional version, and we encourage application authors, especially
public ones which are used by a wide audience, to change their applications
to work in an environment where register_globals is set to off. of course,
they should take advantage of the new features supplied in php 4.1.0 that
make this transition much easier.

php 4.1.0 默认还是设置 register_globals 为on,她是过渡版本,我们程序做着,特别是被广泛接受的,改变他们的应用程序,使得在 register_globals 为 off 情况下也能工作。当然,他们需要使用 php 4.1.0 的新特征来使得转换更容易些。

as of the next semi-major version of php, new installations of php will
default to having register_globals set to off. no worries! existing
installations, which already have a php.ini file that has register_globals
set to on, will not be affected. only when you install php on a brand new
machine (typically, if you're a brand new user), will this affect you, and
then too - you can turn it on if you choose to.

在下一个不完全版本力,将会魔人设置 register_globals 为off.不用担心,已经安装好的,php.ini 里面已经设置 register_globals 为on 的,不会受到影响。只有在你安装php为一个新机器时(一般是一个新用户)才会影响你,你可以选择打开它。

note: some of these arrays had old names, e.g. $http_get_vars. these names
still work, but we encourage users to switch to the new shorter, and
auto-global versions.

注意:这些数组中的几个有老的名字,例如 $http_get_vars. 这些名字依然工作。我们建议使用新的更短的自动全局化的变量。

thanks go to shaun clowes ([email protected]) for pointing out this
problem and for analyzing it.

-------------------------------------

full list of changes

完整的改变列表

10 dec 2001, version 4.1.0
- worked around a bug in the mysql client library that could cause php to hang
when using unbuffered queries. (zeev)

处理了在mysql客户端库里使用未缓冲的查询引起php挂起的问题。

- fixed a bug which caused set_time_limit() to affect all subsequent requests to running apache child process. (zeev)

修正了使得set_time_limit()影响所有的子请求来运行apache子进程的问题

- removed the sablotron extension in favor of the new xslt extension. (sterling)

去掉了 sablotron 模块,使用新的 xslt 扩展模块

- fixed a bug in wddx deserialization that would sometimes corrupt the root element if it was a scalar one. (andrei)

修正了 wddx 反序列化时如果是标量可能破坏根元素的问题

- make imagecolorat() and imagecolorsforindex() work with truecolor images. (rasmus)

使得 imagecolorat 和 imagecolorsforindex()可以工作于 tryecolor 图像

- fixed a bug in preg_match_all() that would return results under improper indices in certain cases. (andrei)

修正了preg_match_all()在某些情况下返回不恰当索引的结果

- fixed a crash in str_replace() that would happen if search parameter was an array and one of the replacements resulted in subject string being empty. (andrei)

修正了一个str_replace()的隐患,在搜索参数是一个数组,条件字符串替换结果中的一个是空的时候发生。

- fixed mysql extension to work with mysql 4.0. (jani)

修正了 mysql 扩展模块,可以工作于 mysql 4.0

- fixed a crash bug within cobalt systems. patch by [email protected] (jani)

修正了一个 cobalt 系统力的漏洞

- bundled dan libby's xmlrpc-epi extension.

捆绑了 dan libby 的 xmlrpc-epi 扩展模块

- introduced extension version numbers. (stig)

引入了许多扩展模块

- added version_compare() function. (stig)

增加了 version_compare() 函数

- fixed pg_last_notice() (could cause random crashes in postgresql applications, even if they didn't use pg_last_notice()). (zeev)

修正了 pg_last_notice()(可能在 postgresql 应用程序引起随机的崩溃,即使没有使用这个函数

- fixed dom-xml's error reporting, so e_warning errors are given instead of e_error error's, this allows you to trap errors thrown by domxml functions. (sterling)

修正了 dom-xml 的错误报告, 使用 e_warning 错误代替 e_error 的错误。这让你可以使用 domxml 函数捕捉异常

- fixed a bug in the mcrypt extension, where list destructors were not properly being allocated.(sterling)

修正了 mcrypt 扩展的错误,列表析构没有正确的定位

- better interbase blob, null and error handling. (patch by jeremy bettis)

更好的 intercase 的 blob,null 和 错误处理

- fixed a crash bug in array_map() if the input arrays had string or non-sequential keys. also modified it so that if a single array is passed, its keys are preserved in the resulting array. (andrei)

修正了 array_map() 在输入数组有字符串或者不连续关键字的崩溃错误。同时修改了在传递单个数组时,结果数组将保留她的关键字。

- fixed a crash in dbase_replace_record. (patch by [email protected])

修正了 dbase_replace_record 的缺陷

- fixed a crash in msql_result(). (zeev)

修正了 msql_result() 的一个缺陷

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表