php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62040 bcompiler compile failed
Submitted: 2012-05-15 16:14 UTC Modified: 2013-01-14 09:57 UTC
Votes:6
Avg. Score:5.0 ± 0.0
Reproduced:5 of 5 (100.0%)
Same Version:3 (60.0%)
Same OS:2 (40.0%)
From: zhihong dot chen dot cn at gmail dot com Assigned:
Status: Duplicate Package: bcompiler (PECL)
PHP Version: 5.4.3 OS: ubuntu 10.04.04 LTS
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: zhihong dot chen dot cn at gmail dot com
New email:
PHP Version: OS:

 

 [2012-05-15 16:14 UTC] zhihong dot chen dot cn at gmail dot com
Description:
------------
Comipile bcompiler as module for php 5.4.3
Using c.php to compiler hello application t.php into t.phpc
Compiling t.php , then run php t.phpc will cause segmentfault.

Test script:
---------------
c.php

<?PHP
$fh = fopen('t.phpc', "w");
bcompiler_write_header($fh);
$res = bcompiler_write_file($fh, 't.php');
bcompiler_write_footer($fh);
fclose($fh);

t.php

<?PHP
echo 'Hello World'.PHP_EOL;


Expected result:
----------------
t.phpc should print hello world

Actual result:
--------------
Segmentation fault


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-05-15 18:41 UTC] sixd@php.net
-Status: Open +Status: Feedback
 [2012-05-15 18:41 UTC] sixd@php.net
Can you add a backtrace? See https://bugs.php.net/bugs-generating-backtrace.php
 [2012-05-16 11:15 UTC] zhihong dot chen dot cn at gmail dot com
-Status: Feedback +Status: Open
 [2012-05-16 11:15 UTC] zhihong dot chen dot cn at gmail dot com
When I try to build with 5.4.3, the error shows:


 cc -Iext/bcompiler/ -I/home/antony/soft/php-5.4.3/ext/bcompiler/ -DPHP_ATOM_INC 
-I/home/antony/soft/php-5.4.3/include -I/home/antony/soft/php-5.4.3/main -
I/home/antony/soft/php-5.4.3 -I/home/antony/soft/php-5.4.3/ext/date/lib -
I/home/antony/soft/php-5.4.3/ext/ereg/regex -I/usr/include/libxml2 -
I/home/antony/soft/php-5.4.3/ext/sqlite3/libsqlite -I/home/antony/soft/php-
5.4.3/TSRM -I/home/antony/soft/php-5.4.3/Zend -I/usr/include -g -
fvisibility=hidden -O0 -Wall -c /home/antony/soft/php-
5.4.3/ext/bcompiler/bcompiler_zend.c -o ext/bcompiler/bcompiler_zend.o
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c: In function 
‘apc_serialize_hashtable’:
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:188: warning: passing 
argument 1 of ‘apc_serialize_zstring’ discards qualifiers from pointer target 
type
/home/antony/soft/php-5.4.3/ext/bcompiler/php_bcompiler.h:298: note: expected 
‘char *’ but argument is of type ‘const char *’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c: In function 
‘apc_serialize_zvalue_value’:
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:475: error: 
‘IS_CLASS’ undeclared (first use in this function)
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:475: error: (Each 
undeclared identifier is reported only once
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:475: error: for each 
function it appears in.)
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:476: error: 
‘IS_SCALAR’ undeclared (first use in this function)
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:477: error: 
‘IS_NUMERIC’ undeclared (first use in this function)
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c: In function 
‘apc_deserialize_zvalue_value’:
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:555: error: 
‘IS_CLASS’ undeclared (first use in this function)
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:556: error: 
‘IS_SCALAR’ undeclared (first use in this function)
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:557: error: 
‘IS_NUMERIC’ undeclared (first use in this function)
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c: In function 
‘apc_serialize_arg_info’:
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:639: error: 
‘zend_arg_info’ has no member named ‘return_reference’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:639: error: 
‘zend_arg_info’ has no member named ‘return_reference’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:640: error: 
‘zend_arg_info’ has no member named ‘required_num_args’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:640: error: 
‘zend_arg_info’ has no member named ‘required_num_args’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c: In function 
‘apc_create_arg_info’:
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:670: error: 
‘zend_arg_info’ has no member named ‘return_reference’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:670: error: 
‘zend_arg_info’ has no member named ‘return_reference’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:671: error: 
‘zend_arg_info’ has no member named ‘required_num_args’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:671: error: 
‘zend_arg_info’ has no member named ‘required_num_args’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c: In function 
‘apc_serialize_zend_property_info’:
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:777: warning: passing 
argument 1 of ‘apc_serialize_zstring’ discards qualifiers from pointer target 
type
/home/antony/soft/php-5.4.3/ext/bcompiler/php_bcompiler.h:298: note: expected 
‘char *’ but argument is of type ‘const char *’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c: In function 
‘apc_serialize_zend_class_entry’:
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:858: warning: passing 
argument 1 of ‘apc_serialize_zstring’ discards qualifiers from pointer target 
type
/home/antony/soft/php-5.4.3/ext/bcompiler/php_bcompiler.h:298: note: expected 
‘char *’ but argument is of type ‘const char *’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:872: warning: passing 
argument 1 of ‘apc_serialize_zstring’ discards qualifiers from pointer target 
type
/home/antony/soft/php-5.4.3/ext/bcompiler/php_bcompiler.h:298: note: expected 
‘char *’ but argument is of type ‘const char *’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:886: error: 
‘zend_class_entry’ has no member named ‘constants_updated’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:886: error: 
‘zend_class_entry’ has no member named ‘constants_updated’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:933: error: 
‘zend_class_entry’ has no member named ‘builtin_functions’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:934: error: 
‘zend_class_entry’ has no member named ‘builtin_functions’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:941: error: 
‘zend_class_entry’ has no member named ‘builtin_functions’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:967: warning: passing 
argument 1 of ‘apc_serialize_zstring’ discards qualifiers from pointer target 
type
/home/antony/soft/php-5.4.3/ext/bcompiler/php_bcompiler.h:298: note: expected 
‘char *’ but argument is of type ‘const char *’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:977: error: 
‘zend_class_entry’ has no member named ‘filename’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:979: error: 
‘zend_class_entry’ has no member named ‘line_start’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:979: error: 
‘zend_class_entry’ has no member named ‘line_start’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:980: error: 
‘zend_class_entry’ has no member named ‘line_end’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:980: error: 
‘zend_class_entry’ has no member named ‘line_end’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:981: error: 
‘zend_class_entry’ has no member named ‘doc_comment’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:981: error: 
‘zend_class_entry’ has no member named ‘doc_comment_len’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:982: error: 
‘zend_class_entry’ has no member named ‘doc_comment_len’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:982: error: 
‘zend_class_entry’ has no member named ‘doc_comment_len’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c: In function 
‘apc_deserialize_zend_class_entry’:
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1092: error: 
‘zend_class_entry’ has no member named ‘constants_updated’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1092: error: 
‘zend_class_entry’ has no member named ‘constants_updated’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1187: error: 
‘zend_class_entry’ has no member named ‘builtin_functions’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1189: error: 
‘zend_class_entry’ has no member named ‘builtin_functions’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1191: error: 
‘zend_class_entry’ has no member named ‘builtin_functions’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1240: error: 
‘zend_class_entry’ has no member named ‘filename’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1241: error: 
‘zend_class_entry’ has no member named ‘line_start’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1241: error: 
‘zend_class_entry’ has no member named ‘line_start’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1242: error: 
‘zend_class_entry’ has no member named ‘line_end’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1242: error: 
‘zend_class_entry’ has no member named ‘line_end’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1243: error: 
‘zend_class_entry’ has no member named ‘doc_comment’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1244: error: 
‘zend_class_entry’ has no member named ‘doc_comment_len’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1244: error: 
‘zend_class_entry’ has no member named ‘doc_comment_len’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c: In function 
‘apc_serialize_zend_op_array’:
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1566: warning: 
passing argument 1 of ‘apc_serialize_string’ discards qualifiers from pointer 
target type
/home/antony/soft/php-5.4.3/ext/bcompiler/php_bcompiler.h:297: note: expected 
‘char *’ but argument is of type ‘const char *’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1571: error: 
‘zend_op_array’ has no member named ‘size_literal’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1571: error: 
‘zend_op_array’ has no member named ‘size_literal’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1579: error: 
‘zend_op_array’ has no member named ‘size’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1579: error: 
‘zend_op_array’ has no member named ‘size’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1602: error: 
‘zend_op_array’ has no member named ‘current_brk_cont’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1602: error: 
‘zend_op_array’ has no member named ‘current_brk_cont’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1614: error: 
‘zend_op_array’ has no member named ‘start_op’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1615: error: 
‘zend_op_array’ has no member named ‘return_reference’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1615: error: 
‘zend_op_array’ has no member named ‘return_reference’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1616: error: 
‘zend_op_array’ has no member named ‘done_pass_two’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1616: error: 
‘zend_op_array’ has no member named ‘done_pass_two’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1617: warning: 
passing argument 1 of ‘bcompiler_handle_filename’ discards qualifiers from 
pointer target type
/home/antony/soft/php-5.4.3/ext/bcompiler/php_bcompiler.h:296: note: expected 
‘char *’ but argument is of type ‘const char *’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1631: warning: 
passing argument 1 of ‘apc_serialize_string’ discards qualifiers from pointer 
target type
/home/antony/soft/php-5.4.3/ext/bcompiler/php_bcompiler.h:297: note: expected 
‘char *’ but argument is of type ‘const char *’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1635: error: 
‘zend_op_array’ has no member named ‘pass_rest_by_reference’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1635: error: 
‘zend_op_array’ has no member named ‘pass_rest_by_reference’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1637: error: 
‘zend_op_array’ has no member named ‘backpatch_count’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1637: error: 
‘zend_op_array’ has no member named ‘backpatch_count’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1649: error: 
‘zend_op_array’ has no member named ‘size_var’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1649: error: 
‘zend_op_array’ has no member named ‘size_var’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1684: warning: 
passing argument 1 of ‘apc_serialize_zstring’ discards qualifiers from pointer 
target type
/home/antony/soft/php-5.4.3/ext/bcompiler/php_bcompiler.h:298: note: expected 
‘char *’ but argument is of type ‘const char *’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c: In function 
‘apc_deserialize_zend_op_array’:
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1713: error: 
‘zend_op_array’ has no member named ‘size_literal’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1713: error: 
‘zend_op_array’ has no member named ‘size_literal’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1729: error: 
‘zend_op_array’ has no member named ‘size’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1729: error: 
‘zend_op_array’ has no member named ‘size’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1743: error: 
‘zend_op_array’ has no member named ‘current_brk_cont’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1743: error: 
‘zend_op_array’ has no member named ‘current_brk_cont’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1756: error: 
‘zend_op_array’ has no member named ‘start_op’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1758: error: 
‘zend_op_array’ has no member named ‘return_reference’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1758: error: 
‘zend_op_array’ has no member named ‘return_reference’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1759: error: 
‘zend_op_array’ has no member named ‘done_pass_two’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1759: error: 
‘zend_op_array’ has no member named ‘done_pass_two’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1805: error: 
‘zend_op_array’ has no member named ‘pass_rest_by_reference’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1805: error: 
‘zend_op_array’ has no member named ‘pass_rest_by_reference’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1806: error: 
‘zend_op_array’ has no member named ‘backpatch_count’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1806: error: 
‘zend_op_array’ has no member named ‘backpatch_count’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1818: error: 
‘zend_op_array’ has no member named ‘size_var’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1818: error: 
‘zend_op_array’ has no member named ‘size_var’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1819: error: 
‘zend_op_array’ has no member named ‘size_var’
/home/antony/soft/php-5.4.3/ext/bcompiler/bcompiler_zend.c:1820: error: 
‘zend_op_array’ has no member named ‘size_var’
make: *** [ext/bcompiler/bcompiler_zend.lo] Error 1
 [2012-05-16 18:03 UTC] zhihong dot chen dot cn at gmail dot com
-Summary: bcompiler segmentfault +Summary: bcompiler compile failed
 [2012-05-16 18:03 UTC] zhihong dot chen dot cn at gmail dot com
Bcompiler build failed instead of segmentfault
 [2012-08-03 04:28 UTC] roberto at spadim dot com dot br
well i don´t have time to test and translate code of php 5.3 to php 5.4
but here is a nice page to help you changing php 5.3 code to php 5.4

http://www.php.net/releases/NEWS_5_4_0_alpha1.txt


check this part:

- Improved Zend Engine memory usage: (Dmitry)
  . Replaced zend_function.pass_rest_by_reference by 
    ZEND_ACC_PASS_REST_BY_REFERENCE in zend_function.fn_flags.
  . Replaced zend_function.return_reference by ZEND_ACC_RETURN_REFERENCE
    in zend_function.fn_flags.
  . Removed zend_arg_info.required_num_args as it was only needed for internal
    functions. Now the first arg_info for internal functions (which has special
    meaning) is represented by zend_internal_function_info structure.
  . Moved zend_op_array.size, size_var, size_literal, current_brk_cont,
    backpatch_count into CG(context) as they are used only during compilation.
  . Moved zend_op_array.start_op into EG(start_op) as it's used only for 
    'interactive' execution of single top-level op-array.
  . Replaced zend_op_array.done_pass_two by ZEND_ACC_DONE_PASS_TWO in
    zend_op_array.fn_flags.
  . op_array.vars array is trimmed (reallocated) during pass_two.
  . Replaced zend_class_entry.constants_updated by ZEND_ACC_CONSTANTS_UPDATED
    in zend_class_entry.ce_flags.
  . Reduced the size of zend_class_entry by sharing the same memory space
    by different information for internal and user classes.
    See zend_class_entry.info union. 
  . Reduced size of temp_variable.


just some structs were changed... i think it´s not dificult to repair...
 [2013-01-14 09:23 UTC] jandanson at soloeurope dot com
Please, can someone fix this and mark as duplicate of issue #60618
 [2013-01-14 09:57 UTC] alan_k@php.net
-Status: Open +Status: Duplicate
 [2013-01-14 09:57 UTC] alan_k@php.net
dupe of  #60618
 [2013-06-18 16:29 UTC] vahidhwp at gmail dot com
Hi,
Try to compile PHP 5.3 from http://php.net/downloads.php . The bcompiler package didn't work with PHP 5.4 package.

and here is the complete solution:

Install php 5.3.26

Intall BCompiler1.0.9 from source code on ubuntu 12.10:
1-download latest version from http://pecl.php.net/package/bcompiler
2- extract archive: # tar xzvf bcompiler-1.0.2.tgz
3- # cd bcompiler-1.0.2
4- # type php : php is hashed (/usr/local/bin/php)
5- # export PHP_PREFIX=/usr/local/bin/php
6- # phpize
7- #  ./configure --enable-bcompiler
8- # make
9- # make test
10-# make install
11-# sudo gedit /etc/php5/apache2/php.ini
12- add last to line and close: extension=bcompiler.so
13-# service apache2 restart
14- make a test.php containing: <?php phpinfo();?> and check bcompiler extension

Best Regards
Vahid Moslemi
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 01:01:30 2024 UTC