【PHP】PHP5.4.0版本号ChangeLog具体解释(上)

前言

随着大量的框架使用composer和namespace,渐渐的线上环境也从以前的5.3变成了5.4或者5.5甚至5.6,随着7月份PHP7的公布,会有不少其它的公司採用新版本号。php

以前很久就想写这种一片文章,来讲明下各个版本号的差别。此次算是拿出时间了。html

此次的是第一篇,眼下规划写三篇java

  • PHP5.4.0
  • PHP5.5.0
  • PHP5.6.0

一方面是对本身的知识的整理,一方面是对本身的一次提高。web

官方说明

官方文档地址 http://php.net/ChangeLog-5.php#5.4.0算法

具体说明

01 Mar 2012

原文sql

  • autoconf 2.59+ is now supported (and required) for generating the configure script with ./buildconf. Autoconf 2.60+ is desirable otherwise the configure help order may be incorrect.

翻译编程

autoconf 2.59 +现在支持(需要)生成配置脚本/ buildconf。autoconf 2.60 +是理想的配置,不然有多是不对的。windows

autoconf

php编译安装的时候需要的依赖软件。因此新版本号相应配套的软件也要换成最新的对性能来说才保险啊~api

Removed legacy features 移除的特性

原文数组

  • break/continue $var syntax.
  • Safe mode and all related ini options.
  • register_globals and register_long_arrays ini options.
  • import_request_variables().
  • allow_call_time_pass_reference.
  • define_syslog_variables ini option and its associated function.
  • highlight.bg ini option.
  • Session bug compatibility mode (session.bug_compat_42 and session.bug_compat_warn ini options).
  • session_is_registered(), session_register() and session_unregister() functions.
  • y2k_compliance ini option.
  • magic_quotes_gpc, magic_quotes_runtime and magic_quotes_sybase ini options. get_magic_quotes_gpc, get_magic_quotes_runtime are kept but always return false, set_magic_quotes_runtime raises an E_CORE_ERROR.
  • Removed support for putenv(“TZ=..”) for setting the timezone.
  • Removed the timezone guessing algorithm in case the timezone isn’t set with date.timezone or date_default_timezone_set(). Instead of a guessed timezone, “UTC” is now used instead.

翻译

  • break/continue$ var语法。
  • 安全模式和所有相关的INI选项。
  • register_globals和register_long_arrays INI选项。
  • import_request_variables()。
  • allow_call_time_pass_reference。

  • define_syslog_variables INI选项及其相关的功能。

  • highlight.bg INI选项。

  • 会话错误兼容模式(session.bug_compat_42和session.bug_compat_warn INI选项)。

  • session_is_registered(),session_register()和session_unregister()功能。
  • y2k_compliance INI选项。
  • magic_quotes_gpc,magic_quotes_runtime和magic_quotes_sybase INI选项。get_magic_quotes_gpc。get_magic_quotes_runtime保存但始终返回false,set_magic_quotes_runtime引起e_core_error。
  • 再也不支持putenv(“TZ = ..”)设置时区。
  • 假设不设置时区与时区date.timezone或date_default_timezone_set()除去推測算法。

    而不是推測的时区,“UTC”现在是用来取代。

我是拿百度翻译来的我会乱说吗? =_=

break/continue

移除了break/continue $var语法

在5.4以前,咱们可以经过传递后面的參数来控制跳出或者中止若干层的循环,然而在5.4.0的版本号以后,就去除了这个特性。

break $c;
continue $c;

break and continue accepts a number, that specify the number of nested loops, that should be breaked up, or continued.

參考资料

PHP 的安全模式是为了试图解决共享服务器(shared-server)安全问题而设立的。

在结构上,试图在 PHP 层上解决问题是不合理的,但改动 web 服务器层和操做系统层显得很是不现实。所以不少人,特别是 ISP。眼下使用安全模式。

语言的发展是在不断的进步的啊,也是一个不断试错改错的过程。^_^

  • 保安措施和安全模式,也就是移除了php.ini中所有safe_mode相关的配置项
  • 被安全模式限制或屏蔽的函数 。

    在安全限制模式下,有些函数不能被使用。

    这个限制也将被移除

參考资料

register_globals and register_long_arrays ini options.

这两个配置项因为性能关系被移除了。

參考资料

import_request_variables()

import_request_variables — 将 GET/POST/Cookie 变量导入到全局做用域中

bool import_request_variables ( string types[,string prefix ] )
将 GET/POST/Cookie 变量导入到全局做用域中。假设你禁止了 register_globals,但又想用到一些全局变量,那么此函数就很是实用。

你可以使用 types 參数指定需要导入的变量。可以用字母‘G’、‘P’和‘C’分别表示 GET、POST 和 Cookie。这些字母不区分大写和小写,因此你可以使用‘g’、‘p’和‘c’的不论什么组合。POST 包括了经过 POST 方法上传的文件信息。注意这些字母的顺序,当使用“gp”时。POST 变量将使用一样的名字覆盖 GET 变量。

不论什么 GPC 之外的字母都将被忽略。

prefix 參数做为变量名的前缀,置于所有被导入到全局做用域的变量以前。因此假设你有个名为“userid”的 GET 变量,同一时候提供了“pref_”做为前缀,那么你将得到一个名为 $pref_userid 的全局变量。

假设你对导入其它全局变量(好比 SERVER 变量)感兴趣,请考虑使用 extract()。

參考资料

allow_call_time_pass_reference

是否启用在函数调用时强制參数被依照引用传递。此方法已不被同意并在 PHP/Zend 将来的版本号中很是可能再也不支持。鼓舞使用的方法是在函数定义中指定哪些參数应该用引用传递。鼓舞你们尝试关闭此选项并确保脚本可以正常运行。以确保该脚本也能在将来的版本号中运行(每次使用此特性都会收到一条警告,參数会被按值传递而不是依照引用传递)。

在函数调用时经过引用传递參数是不推荐的,因为它影响到了代码的整洁。假设函数的參数没有声明做为引用传递,函数可以经过未写入文档的方法改动其參数。要避免其反作用,最好仅在函数声明时指定那个參数需要经过引用传递。

參考资料

define_syslog_variables

初始化syslog相关的设置项,从这个版本号进行了移除。

define_syslog_variables()仅仅定义了全局变量。

常数已经永远的定义,假设日志模块载入。你do not需要调用这个使用syslog常数。

也就是咱们假设想要使用syslog相关的參数。直接调用便可,不需要进行手动初始化。

參考资料

highlight.bg ini option.

Colors for Syntax Highlighting mode. Anything that’s acceptable in would work.

和这个高亮相关配置项还有如下几个,对代码高亮的颜色进行配置
- highlight.comment
- highlight.default
- highlight.html
- highlight.keyword
- highlight.string

參考资料

Session bug compatibility mode

php.ini中有说明
这是php4.3.0之后才有的安全设置。
出于安全的考虑php不建议你打开register_globals开关
但若关闭了register_globals(默认)时,session变量将不被本身主动转换成全局变量
此时传统的session变量注冊方式session_register就失去意义了(session_register是把一个全局变量注冊成session变量),因为訪问session变量需要使用 SESSION

仅仅 _SESSION数组就可以了,而无须再用session_register注冊了。

以避免产生混乱

开关session.bug_compat_42 和 session.bug_compat_warn 就是为了检查此类状况而设置的

參考资料

session_is_registered(), session_register() and session_unregister() functions.

这里提到的三个session相关的函数

  • session_is_registered()
  • session_register()
  • session_unregister()

这些是session相关的注冊相关的函数。

參考资料

y2k_compliance ini option.

这。。

是关于2000的时候的千年虫的配置项。

參考资料

magic_quotes_gpc

magic_quotes_gpc。magic_quotes_runtime和magic_quotes_sybase INI选项。

get_magic_quotes_gpc,get_magic_quotes_runtime保存但始终返回false,set_magic_quotes_runtime引起e_core_error。

这个配置被撤销以后。假设再使用就会引起错误。

Removed support for putenv(“TZ=..”) for setting the timezone

再也不支持putenv(“TZ = ..”)设置时区,也就是不能再经过这个函数来设置时区相关的环境配置了.

加入 setting 到服务器环境变量。 环境变量仅存活于当前请求期间。

在请求结束时环境会恢复到初始状态。

设置特定的环境变量也有多是一个潜在的安全漏洞。 safe_mode_allowed_env_vars 包括了一个以逗号分隔的前缀列表。 在安全模式下,用户可以仅能改动用该指令设定的前缀名称的指令。 默认状况下,用户仅可以改动以 PHP_ 开头的环境变量(好比 PHP_FOO=BAR)。

注意:假设此指令是空的,PHP赞成用户设定随意环境变量!

可见这个函数真是危急啊。

。。

參考资料

Removed the timezone guessing algorithm in case the timezone isn’t set with date.timezone or date_default_timezone_set(). Instead of a guessed timezone, “UTC” is now used instead.

假设不设置时区与时区date.timezone或date_default_timezone_set()除去推測算法。

而不是推測的时区,“UTC”现在是用来取代。

date_default_timezone_set() 设定用于所有日期时间函数的默认时区。

Note:
自 PHP 5.1.0 起(此版本号日期时间函数被重写了),假设时区不合法则每个对日期时间函数的调用都会产生一条 E_NOTICE 级别的错误信息,假设使用系统设定或 TZ 环境变量则还会产生 E_STRICT 级别的信息。

參考资料

Moved extensions to PECL 移动扩展PECL

原文

  • ext/sqlite. (Note: the ext/sqlite3 and ext/pdo_sqlite extensions are not affected)

翻译

  • EXT / SQLite。(注:EXT / sqlite3和EXT / pdo_sqlite扩展不受影响)

ext/sqlite

This package is not maintained anymore and has been superseded. Package has moved to channel http://php.net/sqlite, package .
这个包是否是保持了与已被取代。包已经转移到渠道http://php.net/sqlite。包。

也就是说这个sqlite从pecl转移到了SQLite的扩展中。

參考资料

General improvements 通常的改进

原文

  • Added short array syntax support ([1,2,3]), see UPGRADING guide for full details.
  • Added binary numbers format (0b001010).
  • Added support for Class::{expr}() syntax.
  • Added multibyte support by default. Previously php had to be compiled with –enable-zend– multibyte. Now it can be enabled or disabled through zend.multibyte directive in php.ini.
  • Removed compile time dependency from ext/mbstring.
  • Added support for Traits.
  • Added closure $this support back.
  • Added array dereferencing support.
  • Added callable typehint.
  • Added indirect method call through array. #47160.
  • Added DTrace support.
  • Added class member access on instantiation (e.g. (new foo)->bar()) support.
  • <?

    =is now always available regardless of the short_open_tag setting.

  • Implemented Zend Signal Handling (configurable option –enable-zend-signals, off by default).
  • Improved output layer, see README.NEW-OUTPUT-API for internals.
  • lmproved unix build system to allow building multiple PHP binary SAPIs and one SAPI module the same time. #53271, #52419.
  • Implemented closure rebinding as parameter to bindTo.
  • Improved the warning message of incompatible arguments.
  • Improved ternary operator performance when returning arrays.
  • Changed error handlers to only generate docref links when the docref_root INI setting is not empty.
  • Changed silent conversion of array to string to produce a notice.
  • Changed default value of “default_charset” php.ini option from ISO-8859-1 to UTF-8.
  • Changed silent casting of null/”/false into an Object when adding a property into a warning.
  • Changed E_ALL to include E_STRICT.
  • Disabled windows CRT warning by default, can be enabled again using the ini directive windows_show_crt_warnings.
  • Fixed bug #55378: Binary number literal returns float number though its value is small enough.

翻译

  • 加入短数组语法支持([1,2,3])。详情见升级指南。
  • 加入二进制格式(0b001010)。

  • 添加支持类::{ }()表达式的语法。
  • 加入多字节默认支持。曾经的PHP必须编译——使Zend字节。

    现在可以启用或禁用经过zend.multibyte指令在php.ini。

  • 从EXT / mbstring编译时依赖。
  • 添加支持的特征。
  • 加入关闭美圆的支持。
  • 加入数组引用的支持。
  • 加入可赎回typehint。
  • 添加间接方法调用经过阵列。

    # 47160。

  • 加入DTrace支持。
  • 加入类成员訪问实例(好比(新富)-> bar())支持。

  • <?=永远是现在可用的short_open_tag设置。
  • 实现Zend信号处理(可配置的选项——启用Zend信号。默认关闭)。
  • 改进的输出层,看到readme.new-output-api内部。

  • 改进的UNIX系统赞成创建建设多个PHP二进制SAPIs和SAPI模块一样的时间。# 53271,# 52419。

  • 实施关闭绑定參数的结合。
  • 改进的相互矛盾的警告信息。
  • 三元运算符返回时阵列性能改进。
  • 改变错误处理程序仅仅产生docref连接时,docref_root ini设置不空。
  • 改变数组字符串生成通知无声的转换。

  • 改变默认值“default_charset”的选项从ISO-8859-1为UTF-8。

  • 改变沉默铸造空/”/假为对象加入属性到一个警告。

  • 改变e_all包括e_strict。
  • 禁用Windows CRT警告默认状况下,可以再次启用使用INI指令windows_show_crt_warnings。

  • 固定的错误# 55378:二进制数的文本返回浮点数的值足够小,尽管。

发现这么翻译还不如不翻译看的明确。

。。。

short array syntax support 短数组支持

<?php $array = array( "foo" => "bar", "bar" => "foo", ); // 自 PHP 5.4 起 $array = [ "foo" => "bar", "bar" => "foo", ]; ?>

參考资料

binary numbers format 二进制直接量

从PHP5.4開始, 咱们可以直接在代码中书写二进制直接量了. 这个在定义一些标志位的时候, 尤其方便.

$bin  = 0b1101;
echo $bin;

//13

參考资料

support for Class::{expr}() syntax

Makes PHP more flexible, when calling class/object methods.

$method = 'method';

$test = new Test();

$test->method();
$test->$method();
$test->{'method'}();

Test::method();
Test::$method();
Test::{'method'}();

參考资料

multibyte support 多字节支持

加入多字节默认支持。曾经的PHP必须编译——使Zend字节。现在可以启用或禁用经过zend.multibyte指令在php.ini。

參考资料

Removed compile time dependency from ext/mbstring

从EXT / mbstring编译时依赖

Added support for Traits

自 PHP 5.4.0 起。PHP 实现了代码复用的一个方法,称为 traits。

Traits 是一种为相似 PHP 的单继承语言而准备的代码复用机制。Trait 为了下降单继承语言的限制。使开发者可以自由地在不一样层次结构内独立的类中复用方法集。Traits 和类组合的语义是定义了一种方式来下降复杂性。避免传统多继承和混入类(Mixin)相关的典型问题。

Trait 和一个类相似。但仅仅旨在用细粒度和一致的方式来组合功能。Trait 不能经过它自身来实例化。它为传统继承添加了水平特性的组合;也就是说。应用类的成员不需要继承

參考资料

Added closure $this support back

用于表明 匿名函数 的类.

匿名函数(在 PHP 5.3 中被引入)会产生这个类型的对象。

在过去,这个类被以为是一个实现细节,但现在可以依赖它作一些事情。

自 PHP 5.4 起。这个类带有一些方法,赞成在匿名函数建立后对其进行不少其它的控制。

除了此处列出的方法,另外一个 __invoke 方法。这是为了与其它实现了 __invoke()魔术方法 的对象保持一致性,但调用匿名函数的过程与它无关。

待续。。

參考资料

Added array dereferencing support

可以说上是直接获取数组中的元素吧,对于咱们来讲仍是很是方便的。能省下一个变量。

在曾经, 咱们假设定义一个返回数组的函数:

<?php function foo() { return array(1, 2, 3); }

那么, 假设我要获取返回数组中的第二个元素, 就仅仅能:

<?

php list(, $mid, ) = foo(); //或者: $tmp = $foo(); $mid = $tmp[1];

而从5.4開始, 咱们就不需要这么麻烦了, 仅仅需要:

<?php $mid = foo()[1];

另外, 也可以使用引用:

<?

php function &getTable() { return $GLOBALS; } getTable()["foo"] = "laruence"; echo $foo; //laruence

參考资料

函数类型提示(Callable typehint)

要想了解这个首先需要了解的是类型约束

PHP 5 可以使用类型约束。函数的參数可以指定必须为对象(在函数原型里面指定类的名字),接口。数组(PHP 5.1 起)或者 callable(PHP 5.4 起)。只是假设使用 NULL 做为參数的默认值。那么在调用函数的时候依旧可以使用 NULL 做为实參。

假设一个类或接口指定了类型约束。则其所有的子类或实现也都如此。

类型约束不能用于标量类型如 int 或 string。Traits 也不一样意

/** * 測试函数 * 第一个參数必须为 OtherClass 类的一个对象 */
    public function test(OtherClass $otherclass) {
        echo $otherclass->var;
    }

当中的OtherClass 就是咱们的类型约束

在PHP5.4版本号中。新增了Callable类型的类型约束

<?

php function foo(callable $callback) { }
<?php
foo("false"); //Catchable fatal error: Argument 1 passed to foo() must be callable *
foo("printf"); //okey
foo(function(){}); //okey

class A {
    static function show() {
    }
}

foo(array("A", "show")); //okey

參考资料

indirect method call through array 经过间接方法调用的数组

这里在后面另外一个#47160的bug.

<?

php // For 5.2.x as well. class Thing { static function DoesStuff() { echo 'Hello, World'; } } $f = array('Thing', 'DoesStuff'); $f(); //返回 Hello, World ?

>

依照bug页面上的,以前的版本号就会返回错误,现在已经好啦~

<?php


class Hello {
    //这是一个静态的方法
   static public function world($x) {
     echo "Hello, $x\n";
   }
}


function hello_world($x) {
   echo "Hello, $x\n";
}

 //数组中包括了三个。第一个数组。第二个匿名函数,第三个字符串
$callbacks = array(
   array('Hello', 'world'),
   function ($x) { echo "Hello, $x\n"; },
   'hello_world'
);

 //循环了数组
foreach ($callbacks as $k => $callback) {
   if (is_callable($callback)) { //检測參数是否为合法的可调用结构
     $callback($k);  //而后就把本身的key值做为參数传递过去了 
   }
}


//RESULT:
//Hello, 0 指向了Hello的world静态方法
//Hello, 1 參数自己就是匿名函数,是可以直接运行的
//Hello, 2 做为字符串的參数可以找到一样名字的方法,因此运行了


//CalvinLee
?>

上面的第一个栗子说明了咱们可以经过数组的形式直接调用方法。确认回调函数,经过array('类','方法')的方式进行直接调用。

这是一个因为bug形成的新特性。

參考资料

DTrace 支持

DTrace(全称Dynamic Tracing),也称为动态跟踪。是由 Sun™ 开发的一个用来在生产和试验性生产系统上找出系统瓶颈的工具,可以对内核(kernel)和用户应用程序(user application)进行动态跟踪并且对系统运行不构成不论什么危急的技术。

在不论什么状况下它都不是一个调试工具。 而是一个实时系统分析寻找出性能及其它问题的工具。

也就是这个调试工具可以直接支持PHP辣!可以进行更深层次的代码调试。

有时间可以研究一下这个怎么用。

。。

參考资料

在实例化类成员的訪问支持

class Test {
    public function foo() {
        return $this;
    }

    public function bar() {
        return 'oh hai';
    }
}

$t = (new Test)->foo();

print $t->bar();

咱们可以直接调用啦啦啦~

很是方便的样子。

參考资料

<?= 短标签

PHP5.4里默认开启了短标签设置。支持了行内的短标签 <?= ?>

<?php
$a = 2;
?>
<?=$a?>

这个短标签直接输出了,因此是用于行内的。

參考资料

Zend Signal Handling

实现Zend Signal Handling(可配置的选项——–enable-zend-signals,默认关闭)

新的机制, 叫作zend signal, 它的理念, 来自Yahoo的”延迟信号处理”(Yahoo signal deferring mechanism), 然后, facebook把这套理念加入了PHP中, 为了提高PHP+Apache 1.X下PHP调用ap_block/ap_unblock的性能

參考资料

Improved output layer, see README.NEW-OUTPUT-API for internals

改进的输出层,看到readme.new-output-api内部

看起来像是内核的输出层改动。但是实在是找不到资料,不知道怎么理解这一条。QAQ

multiple PHP binary SAPIs and one SAPI module 多个PHP二进制SAPIs和SAPI模块

改进的UNIX系统赞成创建建设多个PHP二进制SAPIs和SAPI模块一样的时间。#53271, #52419.

这里在后面提到了两个bug。

Using configure options –enable-cgi and –enable-fpm together will not produce the php-cgi binary.

两个配置一块儿的时候就不会产生php-cgi的二进制。
两个模块做为配置项的时候会编译失败。

參考资料

Implemented closure rebinding as parameter to bindTo 实施关闭又一次绑定的參数结合

Closure::bind — 复制一个闭包,绑定指定的$this对象和类做用域。
Closures: Object extension 关闭对象扩展

这里需要理解一个Closure的概念。Closure 类,匿名函数类。

匿名函数(在 PHP 5.3 中被引入)会产生这个类型的对象。在过去。这个类被以为是一个实现细节,但现在可以依赖它作一些事情。自 PHP 5.4 起。这个类带有一些方法。赞成在匿名函数建立后对其进行不少其它的控制

<?php class APP { public $var = 25; public function __construct() { } public function get($callback) { if (!is_callable($callback)) { throw new InvalidArgumentException('Paran must be callable.'); } // $callback->bindTo($this); // $callback->bindTo($this, $this); // $callback(); //上面的回调方法找不到绑定的对象。如下的方法是用一个新的变量来作绑定函数的结果。而后运行 $callback1 = $callback->bindTo($this, $this); $callback1(); } } $app = new APP(); $app->get(function() use ($app) {//做为本身的匿名函数 echo '<pre>'; var_dump($app); echo '<br />'; var_dump($this); }); ?

>

參考资料

Improved the warning message of incompatible arguments 改进的不兼容的參数的警告信息

就是字面上的意思。。。

Improved ternary operator performance when returning arrays 三元运算符返回时数组性能改进

优化了数组的时候的性能,当返回值是array的时候速度获得了提高。

參考资料
- http://www.laruence.com/2011/11/04/2258.html
- http://grokbase.com/t/php/php-internals/11aeyhp2ek/ternary-operator-performance-improvements
- http://php.net/manual/en/language.operators.comparison.php

Changed error handlers 改变错误处理程序仅仅产生docref连接时,docref_root ini设置不空

当配置文件 php.ini 中的 docref_root 的值为空的时候。更改了 docref links 指向的连接。

也就是对默认的指向的错误提醒的页面链接进行了改动.

改动默认值不属于很是重要的功能,对于这种更新对项目来讲不是特别的重要。

新的错误信息格式包括了相应的參考页面。该页面对错误进行具体描写叙述,或者描写叙述了致使该发生错误的函数。为了提供手冊的页面。你可以在PHP官方站点下载相应语言的手冊,并在ini中设置网址到本地相应的地址。假设你的本地手冊拷贝可以使用”/manual/” 訪问,你就可以简单的设置 docref_root=/manual/。另外你还需要设置 docref_ext 匹配你本地文件的后缀名 docref_ext=.html。固然也可以设置一个外部的參考地址。

好比你可以设置 docref_root=http://manual/en/ 或者 docref_root=”http://landonize.it/?how=url&theme=classic&filter=Landon &url=http%3A%2F%2Fwww.php.net%2F”

一般需要在 docref_root 后面以 “/”结尾, 但是在以上的另一种演示样例状况中没必要这么设置。

Note:

因为这么作可以高速定位和查看到函数的说明,因此它对你的开发会很是实用。

建议永远不要再生产系统中使用 (好比系统被链接到互联网对外提供服务)。

參考资料

Changed silent conversion of array to string to produce a notice 改变了数组转换字符串的提醒

木有看明确。

。。。

參考资料

Changed default value of “default_charset” php.ini option from ISO-8859-1 to UTF-8 改变默认值“default_charset”的选项从ISO-8859-1为UTF-8

默认设置是UTF-8.

PHP always outputs a character encoding by default in the Content-type: header. To disable sending of the charset, simply set it to be empty.

有趣的是此次发现了国内的project师的提交的bug~

參考资料

Changed silent casting of null/”/false into an Object when adding a property into a warning 当一个对象中有空的属性时加入了一个警告

当给一个对象加入一个属性的时候,扔掉null或者false会返回一个警告

Changed E_ALL to include E_STRICT E_ALL中包括了E_STRICT

參考资料

Disabled windows CRT warning by default, can be enabled again using the ini directive windows_show_crt_warnings 禁用Windows CRT警告默认状况下,可以再次启用使用INI指令windows_show_crt_warnings

windows CRT

Visual Studio 2012 更新 1 支持的 Windows 8,Windows Server 2012,Windows 7,Windows Server 2008中,Windows Vista,Windows XP Service Pack 3 (SP3) C 运行库,x86 的 Windows XP Service Pack 2 (SP2) x64 和 Windows Server 2003 Service Pack 2 (SP2) x86 和 x64 的。 所有这些操做系统支持 Windows 应用程序编程接口 (API) (API) 提供和 Unicode 支持。 此外,所有 Win32 应用程序中使用多字节字符集 (MBCS)。

This directive shows the Windows CRT warnings when enabled. These warnings were displayed by default until PHP 5.4.0.

This directive shows the Windows CRT warnings when enabled. These warnings were displayed by default until PHP 5.4.0.

參考资料

Fixed bug #55378: Binary number literal returns float number though its value is small enough 固定的错误# 55378:二进制数的文本返回浮点数尽管其值足够小

上面提到过这个版本号支持了直接的二进制的输出。因此这条就是修复返回二进制转换的浮点数的错误。

Test script: --------------- <?

php var_dump(0b1111111); var_dump(0b1111111111111111); Expected result: ---------------- int(127) int(65535) Actual result: -------------- int(127) float(65535)

參考资料

Improved Zend Engine memory usage 改进的内存使用Zend引擎

原文

  • Improved parse error messages.
  • Replaced zend_function.pass_rest_by_reference by ZEND_ACC_PASS_REST_BY_REFERENCE in zend_function.fn_flags.
  • Replaced zend_function.return_reference by ZEND_ACC_RETURN_REFERENCE in zend_function.fn_flags.
  • Removed zend_arg_info.required_num_args as it was only needed for internal functions. Now the first arg_info for internal functions (which has special meaning) is represented by zend_internal_function_info structure.
  • Moved zend_op_array.size, size_var, size_literal, current_brk_cont, backpatch_count into CG(context) as they are used only during compilation.
  • Moved zend_op_array.start_op into EG(start_op) as it’s used only for ‘interactive’ execution of single top-level op-array.
  • Replaced zend_op_array.done_pass_two by ZEND_ACC_DONE_PASS_TWO in zend_op_array.fn_flags.
    op_array.vars array is trimmed (reallocated) during pass_two.
  • Replaced zend_class_entry.constants_updated by ZEND_ACC_CONSTANTS_UPDATED in zend_class_entry.ce_flags.
  • Reduced the size of zend_class_entry by sharing the same memory space by different information for internal and user classes. See zend_class_entry.info union.
  • Reduced size of temp_variable.

翻译

  • 改进的解析错误消息。

  • 经过更换zend_function.pass_rest_by_reference zend_acc_pass_rest_by_reference在zend_function.fn_flags。

  • 经过更换zend_function.return_reference zend_acc_return_reference在zend_function.fn_flags。

  • 删除zend_arg_info.required_num_args因为这仅仅是内部功能的需要。现在内部功能的第一arg_info(具备特殊意义的zend_internal_function_info结构表示)。

  • 移动zend_op_array.size,size_var,size_literal,current_brk_cont,backpatch_count为CG(上下文)做为他们在编译过程当中仅仅使用。

  • 移动zend_op_array.start_op成如(start_op)它仅仅用于“单顶级运算阵列交互运行。

  • 经过更换zend_op_array.done_pass_two zend_acc_done_pass_two在zend_op_array.fn_flags。

  • op_array.vars阵列在pass_two修剪(又一次分配)。

  • 经过更换zend_class_entry.constants_updated zend_acc_constants_updated在zend_class_entry.ce_flags。

  • 下降zend_class_entry大小由内部和用户类不一样信息共享一样的内存空间。看到zend_class_entry.info联盟。

  • temp_variable缩小。

这部分的说明是关于zend引擎相关的,按眼下个人水平还不是能很是明确的理解这些的含义。

Improved Zend Engine, performance tweaks and optimizations 改进的Zend引擎,性能调整和优化

原文

  • Inlined most probable code-paths for arithmetic operations directly into executor.
  • Eliminated unnecessary iterations during request startup/shutdown.
  • Changed $GLOBALS into a JIT autoglobal, so it’s initialized only if used. (this may affect opcode caches!)
  • Improved performance of @ (silence) operator.
  • Simplified string offset reading. $str[1][0] is now a legal construct.
  • Added caches to eliminate repeatable run-time bindings of functions, classes, constants, methods and properties.
  • Added concept of interned strings. All strings constants known at compile time are allocated in a single copy and never changed.
  • ZEND_RECV now always has IS_CV as its result.
  • ZEND_CATCH has to be used only with constant class names.
  • ZEND_FETCH_DIM_? may fetch array and dimension operands in different order.
  • Simplified ZEND_FETCH_*_Roperations. They can’t be used with the EXT_TYPE_UNUSEDflag any more. This is a very rare and useless case. ZEND_FREE might be required after them instead.
  • Split ZEND_RETURN into two new instructions ZEND_RETURN and ZEND_RETURN_BY_REF.
  • Optimized access to global constants using values with pre-calculated hash_values from the literals table.
  • Optimized access to static properties using executor specialization. A constant class name may be used as a direct operand of ZEND_FETCH_* instruction without previous ZEND_FETCH_CLASS.
  • zend_stack and zend_ptr_stack allocation is delayed until actual usage.

翻译

  • 内联最可能的代码路径,直接进入运行算术运算。

  • 消除没必要要的迭代请求启动/关机时。

  • 改变成一个JIT autoglobal =美圆。因此它的初始化,假设使用。

    (这可能会影响操做码缓存!

  • 改进的性能”(沉默)算子。

  • 简化的字符串偏移阅读。

    $str [ 1 ] [ 0 ]现在的法律构建。

  • 消除反复的运行时绑定的功能,加入缓存类,常量。方法和属性。

  • 拘留字符串加入的概念。所有字符串常量在编译时被分配在一个单拷贝,永远都不会改变的。

  • zend_recv现在老是is_cv做为结果。

  • zend_catch现在仅仅需要进行不断的类名称。

  • zend_fetch_dim_?可以把不一样排列和尺寸数。

  • 简化zend_fetch_ * _r操做。他们不能用不论什么ext_type_unused旗。这是一个很是可贵的和没用的状况下。- zend_free可能在他们的要求。

  • zend_return分裂为两个新的指令zend_return和zend_return_by_ref。

  • 优化訪问全局常量使用的值与预先计算的hash_values从文字表。

  • 优化訪问静态属性用遗嘱运行人专业化。一个恒定的类的名称可以做为直接操做数指令没有曾经的zend_fetch_class zend_fetch_ *。

  • zend_stack和zend_ptr_stack分配延迟到实际使用。

  • 改进的Zend引擎。性能调整和优化

机翻好渣。。。。。

等我长发及腰,再来看这个可好QAQ

Other improvements to Zend Engine 在Zend引擎改进

原文

  • Added an optimization which saves memory and emalloc/efree calls for empty HashTables.
  • Added ability to reset user opcode handlers.
  • Changed the structure of op_array.opcodes. The constant values are moved from opcode operands into a separate literal table.
  • Fixed (disabled) inline-caching for ZEND_OVERLOADED_FUNCTION methods.
  • Fixed bug #43200 (Interface implementation / inheritence not possible in abstract classes).

    翻译

  • 添加了一个优化。节省内存和emalloc /饱和需要空表。

  • 新增能力重置用户操做处理程序。

  • 改变了op_array.opcodes结构。

    该常数的值是从操做码操做数为一个单独的文字表。

  • 固定(禁用)为zend_overloaded_function方法内联缓存。

  • 固定的错误# 43200(接口的实现/继承抽象类不可能)。

PHP结构

zend引擎做为底层。仍是需要我理解更深刻再去看啦~

后记

关于PHP

PHP做为流行的脚本语言,上手很是快,但是这并不表明这个一个糟糕的语言,从这个版本号的更新记录。我也看到了每次的改进。以及社区内你们的努力。

此次作ChangeLog的整理大概会写三个文章共六篇,因为这个Log实在是太长了仍是写一半先发出去比較好~

引用的资料在每个小结后面都有。方便本身和你们查阅。

假设发现描写叙述错误。请务必评论或者私信我,假设有错,发现了就不能再错下去~

关于整理资料

咱们依靠网络。天天在接触着很是多的新闻和资料。对咱们来说,从这些里面找出实用的知识并吸取仍是有必定难度的,特别是国内糟糕的博客环境。一个文章公布出来以后会有好多站点抄袭抓取。内容还不全。对于刚開始学习的人会形成负面影响,且珍惜。

关于我的成长

当有一个大目标的时候,才干够转化成小目标进行运行。 运行力永远放在第一位。