php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64529 Ran out of opcode space
Submitted: 2013-03-27 05:23 UTC Modified: 2013-03-27 08:56 UTC
From: hannes dot magnusson at gmail dot com Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.4Git-2013-03-27 (Git) OS: MacOSX
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: hannes dot magnusson at gmail dot com
New email:
PHP Version: OS:

 

 [2013-03-27 05:23 UTC] hannes dot magnusson at gmail dot com
Description:
------------
Interactive mode seems completely broken

Test script:
---------------
$ php -v
PHP 5.4.14-dev (cli) (built: Mar 18 2013 17:25:33) (DEBUG)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
bjori@anden:~/....$ php -n -m
[PHP Modules]
Core
date
ereg
json
libxml
openssl
pcntl
pcre
posix
Reflection
SPL
standard
xml
zlib

[Zend Modules]

bjori@anden:~/.... $ php -n -a
Interactive mode enabled

echo "hello world";
<C-d>echo "hello world";
Ran out of opcode space!
You should probably consider writing this huge script into a file!



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-03-27 08:20 UTC] laruence@php.net
-Status: Open +Status: Verified
 [2013-03-27 08:20 UTC] laruence@php.net
confirm this bug
 [2013-03-27 08:23 UTC] laruence@php.net
introduced by https://github.com/php/php-src/commit/f2df6a4a

cg(context).opcodes_size accidentally set by release_lable to zero..
 [2013-03-27 08:23 UTC] laruence@php.net
-Assigned To: +Assigned To: dmitry
 [2013-03-27 08:56 UTC] laruence@php.net
I got three ways FYI:

1. one way is set a initialize value to CG(context).opcodes_size before any 
compiling. like:
$ git diff
diff --git a/Zend/zend.c b/Zend/zend.c
index fc443d9..a3b82b5 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -1301,6 +1301,7 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval 
**retval, int file_co
                 CG(interactive) = 0;
             } else {
                 CG(interactive) = 1;
+                CG(context).opcodes_size = 8192;
             }
         }



2. second way is, doesn't restore the intialize (invalid) CG(context),  I think it 
should be better:
$ git diff
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 766a2de..54ba614 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -2326,7 +2326,7 @@ void zend_release_labels(TSRMLS_D) /* {{{ */
 		zend_hash_destroy(CG(context).labels);
 		FREE_HASHTABLE(CG(context).labels);
 	}
-	if (!zend_stack_is_empty(&CG(context_stack))) {
+	if (zend_stack_count(&CG(context_stack)) > 1) {
 		zend_compiler_context *ctx;

 		zend_stack_top(&CG(context_stack), (void**)&ctx);



3. does push initialized context into context_stack, this way we need more codes 
to check before every push to content_stack.. seems not very good..


thanks
 [2013-03-27 20:10 UTC] dmitry@php.net
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=85e5e60777209c13c71785da31af86a5e0a98d92
Log: Fixed bug #64529 (Ran out of opcode space)
 [2013-03-27 20:10 UTC] dmitry@php.net
-Status: Verified +Status: Closed
 [2014-10-07 23:19 UTC] stas@php.net
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=85e5e60777209c13c71785da31af86a5e0a98d92
Log: Fixed bug #64529 (Ran out of opcode space)
 [2014-10-07 23:30 UTC] stas@php.net
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=85e5e60777209c13c71785da31af86a5e0a98d92
Log: Fixed bug #64529 (Ran out of opcode space)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 13:01:29 2024 UTC