Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用 Yaf debug 模式出现问题 #389

Closed
freeaquar opened this issue Feb 2, 2018 · 9 comments
Closed

使用 Yaf debug 模式出现问题 #389

freeaquar opened this issue Feb 2, 2018 · 9 comments

Comments

@freeaquar
Copy link

系统: Darwin bogon 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
PHP版本: PHP 7.2.0
Yaf 版本: 3.0.7-dev

使用 HTTP 请求可以正常返回
使用 Cli 模式时候, 使用 Yaf_Request_Simple 构造 Request
在代码中执行: new Yaf_Application($this->config); 时候, 有以下错误

  1. FirstTest::testRequestCli
    [1] 75752 segmentation fault phpunit tests/FirstTest.php

-- core 信息 --

@freeaquar
Copy link
Author

还有一个建议, 能不能将 Debug 模式改成从环境变量之类的获取, 而不是需要重新编译

@motecshine
Copy link

看样子是xdebug 扩展引起的,有最小实现代码吗?你去看下xdebug扩展是否支持php7.2

@freeaquar
Copy link
Author

我切换到 php7.0.27 只以 debug 模式安装 yaf 扩展依然不行

@laruence
Copy link
Owner

怎么重现呢? 有重现脚本么

@freeaquar
Copy link
Author

有, 已整理好经发到你的 laruence@php.net 邮箱了, 邮件标题是
<github issues: 使用 Yaf debug 模式出现问题 #389>

@freeaquar
Copy link
Author

邮件发送不成功

单独使用 Yaf debug 并没有问题, 当使用 PHPUnit 运行单元测试的时候, 创建 Application 会出现问题
复现代码已经尽量极简, 并打成一个 tar.gz 放在百度云盘上

链接: https://pan.baidu.com/s/1ggdwZvH 密码: ugrp

  1. 本次测试修改的地方

application/controllers/Index.php
conf/application.ini
tests/
vendor/
cli.php
index.php

  1. 我的 Nginx 配置

server {
listen 80;

root /Users/fang/projs/online/yafdemo;
index index.html index.htm index.php;

if (!-e $request_filename) {
    rewrite ^/(.*)  /index.php/$1 last;
}

location / {
    include fastcgi.conf;
    fastcgi_pass 127.0.0.1:9000;
}

}

测试情况:

  1. 正常网络请求

请求:
curl "http://127.0.0.1/index?x=123"

响应:
Strict Standards: Yaf_Application::__construct(): Yaf is running in debug mode in /Users/didi/projs/online/yafdemo/index.php on line 5

"$_GET: 123"

  1. 根目录 cli.php

进入项目根目录:

$ php cli.php
PHP Strict Standards: Yaf_Application::__construct(): Yaf is running in debug mode in /Users/didi/projs/online/yafdemo/cli.php on line 5

Strict Standards: Yaf_Application::__construct(): Yaf is running in debug mode in /Users/didi/projs/online/yafdemo/cli.php on line 5
"$_GET: 123"

  1. 使用 PHPUnit

测试文件放在 tests/ 目录下

$ vendor/phpunit/phpunit/phpunit
PHPUnit 6.5.7 by Sebastian Bergmann and contributors.

"before"
[1] 64944 segmentation fault vendor/phpunit/phpunit/phpunit

@freeaquar
Copy link
Author

只有加 --enable-yaf-debug 编译后才会出现以上问题, 正常编译可以正常运行

@laruence
Copy link
Owner

laruence commented Mar 1, 2018

应该已经修复, 你试试拉取master的代码重新编译下跑跑验证下. 谢谢报告 :)

@freeaquar
Copy link
Author

可以了, 多谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants