php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18085 Segmentation Fault on eval("\$this->variable");
Submitted: 2002-07-01 05:47 UTC Modified: 2002-10-17 21:59 UTC
Votes:3
Avg. Score:4.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:1 (33.3%)
From: Sky at quit-clan dot de Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0CVS-2002-07-01 OS: SuSE Linux 8.0
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: Sky at quit-clan dot de
New email:
PHP Version: OS:

 

 [2002-07-01 05:47 UTC] Sky at quit-clan dot de
The following PHP code, executed as commandline script with php-4.3.0-dev-zend2-alpha2 gives a segmentation fault. php-4.2.1 doesnt have this problem.

#!/usr/sbin/php -f
<?php

  class mytest {
    
    function test()
    {
      echo "Hello\n";
    }
    
    function killmyself()
    {
      eval("\$this->test();");
    }
  }
  
  $iwill = new mytest;
  $iwill->killmyself();
  
  echo "Sucessful.\n";
  
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-24 11:01 UTC] paulo at isnet dot com dot br
It also happens with properties or any reference to $this inside an eval.

If we do:

$self=$this;
eval('$self->test();');

It works fine. I'm using the Windows version of the same PHP release above.
 [2002-10-17 21:59 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Fri Feb 13 13:00:01 2026 UTC