Edit report at https://bugs.php.net/bug.php?id=64529&edit=1

 ID:                 64529
 Updated by:         dmi...@php.net
 Reported by:        hannes dot magnusson at gmail dot com
 Summary:            Ran out of opcode space
-Status:             Verified
+Status:             Closed
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   MacOSX
 PHP Version:        5.4Git-2013-03-27 (Git)
 Assigned To:        dmitry
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of dmi...@zend.com
Revision: 
http://git.php.net/?p=php-src.git;a=commit;h=85e5e60777209c13c71785da31af86a5e0a98d92
Log: Fixed bug #64529 (Ran out of opcode space)


Previous Comments:
------------------------------------------------------------------------
[2013-03-27 08:56:22] larue...@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 08:23:19] larue...@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:20:57] larue...@php.net

confirm this bug

------------------------------------------------------------------------
[2013-03-27 05:23:53] 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!




------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=64529&edit=1

Reply via email to