2

我正在学习 Symfony Jobeet 教程,在尝试从我的设备文件中加载数据时遇到分段错误。

PHP 5.2.6-1+lenny8 和 Suhosin-Patch 0.9.6.2 (cli), S symfony 版本 1.4.5

我正在使用 Doctrine 插件。

我的固定装置如下:

/data/fixtures/categories.yml

JobeetCategory:
  design:
    name: Design
  programming:
    name: Programming
  manager:
    name: Manager
  administrator:
    name: Administrator

/data/fixtures/jobs.yml

JobeetJob:
  job_sensio_labs:
    JobeetCategory: programming
    type:         full-time
    company:      Sensio Labs
    logo:         sensio-labs.gif
    url:          http://www.sensiolabs.com/
    position:     Web Developer
    location:     Paris, France
    description:  |
      You've already developed websites with symfony and you want to work
      with Open-Source technologies. You have a minimum of 3 years
      experience in web development with PHP or Java and you wish to
      participate to development of Web 2.0 sites using the best
      frameworks available.
    how_to_apply: |
      Send your resume to fabien.potencier [at] sensio.com
    is_public:    true
    is_activated: true
    token:        job_sensio_labs
    email:        job@example.com
    expires_at:   '2010-10-10'

  job_extreme_sensio:
    JobeetCategory:  design
    type:         part-time
    company:      Extreme Sensio
    logo:         extreme-sensio.gif
    url:          http://www.extreme-sensio.com/
    position:     Web Designer
    location:     Paris, France
    description:  |
      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
      eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
      enim ad minim veniam, quis nostrud exercitation ullamco laboris
      nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
      in reprehenderit in.

      Voluptate velit esse cillum dolore eu fugiat nulla pariatur.
      Excepteur sint occaecat cupidatat non proident, sunt in culpa
      qui officia deserunt mollit anim id est laborum.
    how_to_apply: |
      Send your resume to fabien.potencier [at] sensio.com
    is_public:    true
    is_activated: true
    token:        job_extreme_sensio
    email:        job@example.com
    expires_at:   '2010-10-10'

  expired_job:
    JobeetCategory: programming
    company:        Sensio Labs
    position:       Web Developer
    location:       Paris, France
    description:    Lorem ipsum dolor sit amet, consectetur adipisicing elit.
    how_to_apply:   Send your resume to lorem.ipsum [at] dolor.sit
    is_public:      true
    is_activated:   true
    created_at:     '2005-12-01 00:00:00'
    token:          job_expired
    email:          job@example.com
<?php for ($i = 100; $i <= 130; $i++): ?>
  job_<?php echo $i ?>:
    JobeetCategory: programming
    company:      Company <?php echo $i."\n" ?>
    position:     Web Developer
    location:     Paris, France
    description:  Lorem ipsum dolor sit amet, consectetur adipisicing elit.
    how_to_apply: |
      Send your resume to lorem.ipsum [at] company_<?php echo $i ?>.sit
    is_public:    true
    is_activated: true
    token:        job_<?php echo $i."\n" ?>
    email:        job@example.com

<?php endfor ?>

我完全按照教程的说明进行操作,我在第 7 天 ( http://www.symfony-project.org/jobeet/1_4/Doctrine/en/07 ) 在工作类别模块创建然后更新数据库。

我真的不确定是什么原因造成的。

有任何想法吗?

谢谢

4

3 回答 3

2

分段错误通常是不正确的操作码缓存或损坏的模块。我会先禁用像 apc 这样的操作码缓存,如果问题仍然存在,请一次继续禁用 php-modules 以确定哪个给你带来问题。

如果即使这样也不起作用,请尝试升级 php(5.2.13 或 5.3.2 被认为是稳定的),如果问题在最小用例中仍然存在,请向 bugs.php.net 报告错误。

于 2010-07-18T16:54:32.243 回答
1

为了争论,我想分享我解决类似错误的方法。

我正在审查的夹具逻辑中存在问题,该逻辑将返回相同的代码:分段错误

基本上,相同的 var 在被声明并作为方法中的参数传递后在循环中被覆盖,是的,我知道,多么有趣:)

因此,通过定义其他变量并正确重新分配它们,错误完全消失了......

希望能帮助其他人像我一样到达这个页面!

关于您的情况,如果其他答案没有解决它,您可能需要尝试通过添加;来更正模板部分中的代码 在 endfor 关闭指令之后。

于 2014-09-16T12:56:04.903 回答
0

当我在处理 symfony 项目时发生这种情况时,我首先检查日志,但并不总是能找到解决方案。如果没有,我从我正在编写的项目中运行一些 symfony 命令,以查看控制台中是否显示了一些描述的错误。

我还检查了我所做的最后更改并尝试回滚部分代码。

上次发生在我身上是因为 yml 文件中的参数不正确,只是一个“父”类。

希望它有助于思考如何思考这个问题。

于 2016-07-20T14:33:03.530 回答