Press "Enter" to skip to content


最近同事”神经病”同学的项目中, 发现一个问题.

用firefox打开多个tab, 每个tab都去请求同一个URL(尽量同时), 会发现, 这些请求, 会被浏览器串行化.

也就是说, 浏览器会在第一个页面请求结束以后, 再发起第二个请求,


error_log("start . " . getmypid(). "\n");
error_log("end . " . getmypid() . "\n");

Filed in GNU C/C++, PHP应用
with 12 Comments

PHP RFC: 让PHP的foreach支持list

上个月, 终于算加入了PHP developer team, 一直以来最大的障碍就是语言, 现在想起来, 当年真应该更加认真努力的去学习英语.

得到的第一个任务是: 解决一个feature request, 请求在allow foreach($array as list($a,$b)

大意是说, 希望PHP能支持如下语法:

foreach (array(array(24,2333), array(31,4666)) as $k => list($a, $b)) {
    printf("key:%s, a=>%s, b=>%s\n", $k, $a, $b);
/** output:
key:0, a=>24, b=>2333
key:1, a=>31, b=>4666

实现这个功能, 入手点就是去改写PHP的语法分析逻辑, 具体的实现我会再后面附上对PHP5.4的patch.

Filed in PHP源码分析, 转载
with 8 Comments

Zend Parameters Parser新增类型描述符介绍

从PHP5.3开始, zend_parse_paramters_*函数新增了如下几个新的类型描述符:

f  - function or array containing php method call info (returned as
      zend_fcall_info and zend_fcall_info_cache)
H  - array or HASH_OF(object) (returned as HashTable*)
L  - long, limits out-of-range numbers to LONG_MAX/LONG_MIN (long)
Z  - the actual zval (zval**)
*  - variable arguments list (0 or more)
+  - variable arguments list (1 or more)

这也使得我们做扩展开发的时候, 能更加轻松的处理输入参数, 得到想要的值.

Filed in PHP应用, PHP源码分析
with 3 Comments


PHP5.3刚出来不久, PHP6孕育中的同时, PHP5.4又放出了第一个alpha版本.


Added: Traits language construct
Added: Array dereferencing support
Added: DTrace support
Improved: Improved Zend Engine memory usage and performance
Moved: ext/sqlite moved to pecl (sqlite3 support is still built-in)

Removed: break/continue $var syntax
Removed: register_globals, allow_call_time_pass_reference, and register_long_arrays ini options
Removed: session_is_regisitered(), session_registered(), and session_unregister()


Filed in PHP应用, 随笔
with 16 Comments