Code Monkey home page Code Monkey logo

php-mustache's People

Contributors

adambaratz avatar cmb69 avatar jbboehr avatar remicollet avatar stubbs avatar sunpoet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-mustache's Issues

Deprecate and/or remove VM

The virtual machine implementation does not support lambdas, is more brittle, and, based on my last benchmarks, not significantly faster than the AST interpreter. We should deprecate and or remove it.

See also: #21

Error compiling on OS X

I'm getting an error when compiling on OS X. I'm not a C developer so I have no idea where to start debugging this; looking for some advice! Installation output below.

M

➜  builds  git clone git://github.com/jbboehr/php-mustache.git 
Cloning into 'php-mustache'...
remote: Reusing existing pack: 1585, done.
remote: Total 1585 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (1585/1585), 2.35 MiB | 1.00 MiB/s, done.
Resolving deltas: 100% (864/864), done.
Checking connectivity... done.
Checking out files: 100% (186/186), done.
➜  builds  cd php-mustache 
➜  php-mustache git:(master) git submodule update --init --recursive
Submodule 'mustache' (git://github.com/jbboehr/libmustache.git) registered for path 'mustache'
Submodule 'spec' (git://github.com/jbboehr/mustache-spec.git) registered for path 'spec'
Cloning into 'mustache'...
remote: Reusing existing pack: 666, done.
remote: Total 666 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (666/666), 217.23 KiB | 0 bytes/s, done.
Resolving deltas: 100% (411/411), done.
Checking connectivity... done.
Submodule path 'mustache': checked out '862d858f771deddb80ba6b581a968da490a1abcb'
Submodule 'spec' (git://github.com/jbboehr/mustache-spec.git) registered for path 'spec'
Cloning into 'spec'...
remote: Reusing existing pack: 632, done.
remote: Counting objects: 29, done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 661 (delta 3), reused 28 (delta 3)
Receiving objects: 100% (661/661), 171.22 KiB | 0 bytes/s, done.
Resolving deltas: 100% (311/311), done.
Checking connectivity... done.
Submodule path 'mustache/spec': checked out 'b96be9fd4c6d6984828d93169fe7e86d8a8aec2f'
Cloning into 'spec'...
remote: Reusing existing pack: 632, done.
remote: Counting objects: 29, done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 661 (delta 3), reused 28 (delta 3)
Receiving objects: 100% (661/661), 171.22 KiB | 0 bytes/s, done.
Resolving deltas: 100% (311/311), done.
Checking connectivity... done.
Submodule path 'spec': checked out '72233f3ffda9e33915fd3022d0a9ebbcce265acd'
➜  php-mustache git:(master) phpize
Configuring for:
PHP Api Version:         20121113
Zend Module Api No:      20121212
Zend Extension Api No:   220121212
➜  php-mustache git:(master) ./configure --enable-mustache
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-apple-darwin12.4.0
checking host system type... x86_64-apple-darwin12.4.0
checking target system type... x86_64-apple-darwin12.4.0
checking for PHP prefix... /usr/local/Cellar/php55/5.5.12
checking for PHP includes... -I/usr/local/Cellar/php55/5.5.12/include/php -I/usr/local/Cellar/php55/5.5.12/include/php/main -I/usr/local/Cellar/php55/5.5.12/include/php/TSRM -I/usr/local/Cellar/php55/5.5.12/include/php/Zend -I/usr/local/Cellar/php55/5.5.12/include/php/ext -I/usr/local/Cellar/php55/5.5.12/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/Cellar/php55/5.5.12/lib/php/extensions/no-debug-non-zts-20121212
checking for PHP installed headers prefix... /usr/local/Cellar/php55/5.5.12/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ supports C++11 features by default... no
checking whether g++ supports C++11 features with -std=gnu++11... yes
checking whether to enable mustache support... yes, shared
checking whether tcmalloc support is present and requested... no
checking libmustache location... yes, shared
checking for libmustache files... found source in ./mustache/src
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... no
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking how to run the C++ preprocessor... g++ -E
checking the maximum length of command line arguments... 196608
checking command to parse /usr/bin/nm output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fno-common
checking if cc PIC flag -fno-common works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin12.4.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... no
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fno-common
checking if g++ PIC flag -fno-common works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin12.4.0 dyld
(cached) (cached) checking how to hardcode library paths into programs... immediate
configure: creating ./config.status
config.status: creating config.h
➜  php-mustache git:(master) make
/bin/sh /Users/mif08/builds/php-mustache/libtool --mode=compile g++  -I. -I/Users/mif08/builds/php-mustache -DPHP_ATOM_INC -I/Users/mif08/builds/php-mustache/include -I/Users/mif08/builds/php-mustache/main -I/Users/mif08/builds/php-mustache -I/usr/local/Cellar/php55/5.5.12/include/php -I/usr/local/Cellar/php55/5.5.12/include/php/main -I/usr/local/Cellar/php55/5.5.12/include/php/TSRM -I/usr/local/Cellar/php55/5.5.12/include/php/Zend -I/usr/local/Cellar/php55/5.5.12/include/php/ext -I/usr/local/Cellar/php55/5.5.12/include/php/ext/date/lib -I/Users/mif08/builds/php-mustache/mustache/src  -DHAVE_CONFIG_H  -g -O2 -std=gnu++11   -c /Users/mif08/builds/php-mustache/php_mustache.cpp -o php_mustache.lo 
mkdir .libs
 g++ -I. -I/Users/mif08/builds/php-mustache -DPHP_ATOM_INC -I/Users/mif08/builds/php-mustache/include -I/Users/mif08/builds/php-mustache/main -I/Users/mif08/builds/php-mustache -I/usr/local/Cellar/php55/5.5.12/include/php -I/usr/local/Cellar/php55/5.5.12/include/php/main -I/usr/local/Cellar/php55/5.5.12/include/php/TSRM -I/usr/local/Cellar/php55/5.5.12/include/php/Zend -I/usr/local/Cellar/php55/5.5.12/include/php/ext -I/usr/local/Cellar/php55/5.5.12/include/php/ext/date/lib -I/Users/mif08/builds/php-mustache/mustache/src -DHAVE_CONFIG_H -g -O2 -std=gnu++11 -c /Users/mif08/builds/php-mustache/php_mustache.cpp  -fno-common -DPIC -o .libs/php_mustache.o
In file included from /Users/mif08/builds/php-mustache/php_mustache.cpp:2:
In file included from ./php_mustache.hpp:5:
In file included from ./php_mustache.h:24:
In file included from /usr/local/Cellar/php55/5.5.12/include/php/main/php.h:34:
In file included from /usr/local/Cellar/php55/5.5.12/include/php/Zend/zend.h:286:
/usr/local/Cellar/php55/5.5.12/include/php/Zend/zend_hash.h:266:2: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
        register ulong hash = 5381;
        ^~~~~~~~~
/usr/local/Cellar/php55/5.5.12/include/php/Zend/zend_hash.h:353:2: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
        ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_update(ht, idx, pData, nDataSize, pDest));
        ^
/usr/local/Cellar/php55/5.5.12/include/php/Zend/zend_hash.h:348:2: note: expanded from macro 'ZEND_HANDLE_NUMERIC'
        ZEND_HANDLE_NUMERIC_EX(key, length, idx, return func);                                  \
        ^
/usr/local/Cellar/php55/5.5.12/include/php/Zend/zend_hash.h:311:2: note: expanded from macro 'ZEND_HANDLE_NUMERIC_EX'
        register const char *tmp = key;                                                                                 \
        ^
/usr/local/Cellar/php55/5.5.12/include/php/Zend/zend_hash.h:360:2: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
        ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_del(ht, idx));
        ^
/usr/local/Cellar/php55/5.5.12/include/php/Zend/zend_hash.h:348:2: note: expanded from macro 'ZEND_HANDLE_NUMERIC'
        ZEND_HANDLE_NUMERIC_EX(key, length, idx, return func);                                  \
        ^
/usr/local/Cellar/php55/5.5.12/include/php/Zend/zend_hash.h:311:2: note: expanded from macro 'ZEND_HANDLE_NUMERIC_EX'
        register const char *tmp = key;                                                                                 \
        ^
/usr/local/Cellar/php55/5.5.12/include/php/Zend/zend_hash.h:367:2: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
        ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_find(ht, idx, pData));
        ^
/usr/local/Cellar/php55/5.5.12/include/php/Zend/zend_hash.h:348:2: note: expanded from macro 'ZEND_HANDLE_NUMERIC'
        ZEND_HANDLE_NUMERIC_EX(key, length, idx, return func);                                  \
        ^
/usr/local/Cellar/php55/5.5.12/include/php/Zend/zend_hash.h:311:2: note: expanded from macro 'ZEND_HANDLE_NUMERIC_EX'
        register const char *tmp = key;                                                                                 \
        ^
/usr/local/Cellar/php55/5.5.12/include/php/Zend/zend_hash.h:374:2: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
        ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_exists(ht, idx));
        ^
/usr/local/Cellar/php55/5.5.12/include/php/Zend/zend_hash.h:348:2: note: expanded from macro 'ZEND_HANDLE_NUMERIC'
        ZEND_HANDLE_NUMERIC_EX(key, length, idx, return func);                                  \
        ^
/usr/local/Cellar/php55/5.5.12/include/php/Zend/zend_hash.h:311:2: note: expanded from macro 'ZEND_HANDLE_NUMERIC_EX'
        register const char *tmp = key;                                                                                 \
        ^
/usr/local/Cellar/php55/5.5.12/include/php/Zend/zend_hash.h:380:2: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
        ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_update_current_key_ex(ht, HASH_KEY_IS_LONG, NULL, 0, idx, mode, pos));
        ^
/usr/local/Cellar/php55/5.5.12/include/php/Zend/zend_hash.h:348:2: note: expanded from macro 'ZEND_HANDLE_NUMERIC'
        ZEND_HANDLE_NUMERIC_EX(key, length, idx, return func);                                  \
        ^
/usr/local/Cellar/php55/5.5.12/include/php/Zend/zend_hash.h:311:2: note: expanded from macro 'ZEND_HANDLE_NUMERIC_EX'
        register const char *tmp = key;                                                                                 \
        ^
In file included from /Users/mif08/builds/php-mustache/php_mustache.cpp:2:
In file included from ./php_mustache.hpp:5:
In file included from ./php_mustache.h:24:
In file included from /usr/local/Cellar/php55/5.5.12/include/php/main/php.h:34:
In file included from /usr/local/Cellar/php55/5.5.12/include/php/Zend/zend.h:840:
/usr/local/Cellar/php55/5.5.12/include/php/Zend/zend_operators.h:307:2: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
        register const unsigned char *e;
        ^~~~~~~~~
In file included from /Users/mif08/builds/php-mustache/php_mustache.cpp:2:
In file included from ./php_mustache.hpp:12:
In file included from /Users/mif08/builds/php-mustache/mustache/src/mustache.hpp:16:
/Users/mif08/builds/php-mustache/mustache/src/compiler.hpp:319:15: warning: assigning field to itself [-Wself-assign-field]
    this->pos = pos;
              ^
In file included from /Users/mif08/builds/php-mustache/php_mustache.cpp:2:
In file included from ./php_mustache.hpp:12:
In file included from /Users/mif08/builds/php-mustache/mustache/src/mustache.hpp:17:
/Users/mif08/builds/php-mustache/mustache/src/data.hpp:16:10: fatal error: 'unordered_map' file not found
#include <unordered_map>
         ^
8 warnings and 1 error generated.
make: *** [php_mustache.lo] Error 1

Segmentation fault when $data contains objects

When a $data array that you pass to render() contains object, then PHP will segfault.

PS. object supports magic __toString().

propose solution:

  • try to cast object to string (?)
  • throw MustacheException when you can't cast to string.

pecl install error

Hi,

I can not install mustache extension on MacOs - php7.3.2. When I try to install mustache with pecl install mustache command I get
the error below. I saw that there is no version 0.8.0 on pecl website.
So I tried pecl mustache-0.8.1 and it says that latest version is 0.8.0.
I tried clear-cache, upgrade but nothing changed.

pecl install mustache

Could not download from "https://pecl.php.net/get/mustache-0.8.0.tgz",
cannot download "pecl/mustache" (File
https://pecl.php.net:443/get/mustache-0.8.0.tgz not valid (received:
HTTP/1.0 404 Not Found

pecl install mustache-0.8.1

Failed to download pecl/mustache, version "0.8.1", latest release is
version 0.8.0, stability "stable", use
"channel://pecl.php.net/mustache-0.8.0" to install
install failed

crash when HTML is inside tags

Received this from a user by email:

I've been testing the php mustache extension and just encountered a situation where when the extension crashes due to html between the { brackets by mistake, a huge .core dump was saved in the folder every time.

And in a follow up:

The error was simple - I was replacing str_replace code that used single {}'s for templates and left a piece of old code uncommented so mustache got html inside double {{'s since the inner {} already got replaced where the template had {{{ }}}. But I was a bit concerned because with 500mb .core dumps it would be easy to kill the server space quickly if something like this happened. Basically html inside {{ }} caused the failure.

Strange error "free(): invalid pointer"

Trying to build this extension for RHEL-7

Using default compiler (gcc 4.8) works for PHP 5.6 to 7.1

But with PHP 7.2 (build with gcc 6.2) this doesn't work

/opt/remi/php72/root/usr/include/php/Zend/zend_operators.h: In function 'void fast_long_increment_function(zval*)':
/opt/remi/php72/root/usr/include/php/Zend/zend_operators.h:446:68: error: '__builtin_saddl_overflow' was not declared in this scope
  if (UNEXPECTED(__builtin_saddl_overflow(Z_LVAL_P(op1), 1, &lresult))) {

So switch to gcc 6.2... (which also need pr #34) and the strange error appears (all PHP versions)

========DIFF========
001+ *** Error in `/opt/remi/php71/root/usr/bin/php': free(): invalid pointer: 0x000055b65f1cd788 ***
001- __FILE__\s*\!\=\s*__LINE__
002+ ======= Backtrace: =========
003+ /lib64/libc.so.6(+0x7c503)[0x7ff9ac865503]
004+ /lib64/libmustache.so.4(_ZN8mustache4DataD1Ev+0x60)[0x7ff9aafdaaf0]
005+ /lib64/libmustache.so.4(_ZN8mustache4DataD1Ev+0x189)[0x7ff9aafdac19]
006+ /builddir/build/BUILD/php71-php-pecl-mustache-0.7.4~RC1/NTS/modules/mustache.so(zim_Mustache_render+0x3c1)[0x7ff9ab1f6f91]
007+ /opt/remi/php71/root/usr/bin/php(+0x344194)[0x55b65ea0f194]
008+ /opt/remi/php71/root/usr/bin/php(execute_ex+0x2b)[0x55b65e9b5e7b]
009+ /opt/remi/php71/root/usr/bin/php(zend_execute+0x188)[0x55b65ea115f8]
010+ /opt/remi/php71/root/usr/bin/php(zend_execute_scripts+0xd3)[0x55b65e96c183]
011+ /opt/remi/php71/root/usr/bin/php(php_execute_script+0x2d0)[0x55b65e908050]
012+ /opt/remi/php71/root/usr/bin/php(+0x34885c)[0x55b65ea1385c]
013+ /opt/remi/php71/root/usr/bin/php(+0xcdcba)[0x55b65e798cba]
014+ /lib64/libc.so.6(__libc_start_main+0xf5)[0x7ff9ac80ab35]
015+ /opt/remi/php71/root/usr/bin/php(+0xcddd6)[0x55b65e798dd6]

/me going crazy....

Question: Is it possible to extract or access comment data?

Hi John,

I'm digging into the code and am currently working on a BFF system and picked Mustache as the templating engine.

That said, I'd like to describe in some way associated assets to a template partial. Imagine a Mustache template with a "front matter". Think like we can do with Markdown document where what's on top until a line with ---.

I have 3 choices in front of me:

  1. Have a file on filesystem just beside the mustache template
  2. Have a "front matter" in the same file, import in PHP Mustache object only what's after the first line with ---
  3. Use Mustache comments.

Looking at coments related tests in libmustache and mustache-spec, I see tests where you deal with getting content OUTSIDE the comments.

Is there a way to get what's inside too?

Maybe I'm stretching too much of what Mustache can do and I should just implement a "front matter".

$string = 'File contents AFTER first line with three dashes';
$tpl = new Mustache($string);

(Pretty much like you're doing with tests/*.phpt, while thinking about it)

Thank you for your advice.

Can't store MustacheTemplate in APC

When you try to store MustacheTemplate in APC, you will get en error: "MustacheTemplate was not initialized properly"

I think it's because you try to get you class from PHP process store.

php_obj_MustacheTemplate * payload = 
            (php_obj_MustacheTemplate *) zend_object_store_get_object(_this_zval TSRMLS_CC);

Scenario:

  • save MustacheTemplate in APC for request handled by apache worker 1
  • get another request, handled by apache worker 2, get MustacheTempalte from APC - error because the object itself is saved in different PHP process :(

Is there any way to cache compiled templates?

Memory Leak with PHP-CLI

Hi,

I was using this library (0.9.0) with swoole extension (it's a php cli deamon standalone web server). if I use $mustache->render($text,$array) method, memory always increases and server goes down after a day.

I can not see RAM usage with php's memory_get_* commands but when I look at php processes with linux top command, php memory usage always increases.

P.S. = If I use {{{Non_encoded_variables}}} in the text, RAM increasing slowly (avg. server goes down for 24 hours later) but when I use {{HTML_ENCODED_VARIABLES}} in the text, RAM is increasing so fast and a few hours later server goes down and php process uses %100 of memory.

PHP Version : 7.3.7

Allow ArrayAccess for partials

It would be tremendously useful to be able to use an ArrayAccess for partials - this would make it possible to pass an array-esque partial loader for this argument instead:

class PartialLoader implements ArrayAccess
{
    public $array = [];

    public function offsetExists ( $offset )
    {
        return isset($this->array[$offset]);
    }

    public function offsetGet ( $offset )
    {
        return $this->array[$offset];
    }

    public function offsetSet ( $offset , $value )
    {
        $this->array[$offset] = $value;
    }

    public function offsetUnset ( $offset )
    {
        unset($this->array[$offset]);
    }
}
$partials = new PartialLoader();
echo $mustache->render($tmpl, $data, $partials);

Unfortunately, the above gives the following error:

Warning: Mustache::render() expects parameter 3 to be array, object given

Segfault on Fedora 28

Build + test suite is OK on fedora <= 27 and RHEL, but on most recent Fedora 28:

TEST 12/190 [tests/MustacheCode__toReadableString.phpt]
========DIFF========
001+ Termsig=6
001- string(287) "Symbol 000 @ 012
002- Symbol 001 @ 022
003- S012:      0x02 FUNCTION 0
004- F015: 000: 0x11 DLOOKUPSYM 1
005- F018: 001: 0x18 DPRINTE
006- F019: 002: 0x10 DPOP
007- F020: 003: 0x08 RETURN
008- N021:      0x00
009- S022:      0x03 STRING 1
010- C025: 000: 0x74 t
011- C026: 001: 0x65 e
012- C027: 002: 0x73 s
013- C028: 003: 0x74 t
014- N029:      0x00
015- "
========DONE========

I will try to investigate this issue, probably related to some new security enforcement build options

PHP7: php-mustache do not pass "make test" (segfaults)

I'm trying to compile php-mustache using PHP 7.0 and can't manage to make make test pass without causing segfaults.

Example test run:

macbre@dev-php7:~/php7/modules/php-mustache$ php -n -dextension=/home/macbre/php7/modules/php-mustache/modules/mustache.so tests/MustacheData____construct.phpt
--TEST--
MustacheData::__construct() member function
--SKIPIF--
--FILE--
string(12) "MustacheData"
--EXPECT--
string(12) "MustacheData"Segmentation fault (core dumped)

Backtrace from gdb:

Core was generated by `php -n -dextension=/home/macbre/php7/modules/php-mustache/modules/mustache.so t'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007fabb31ded57 in mustache::Data::~Data() () from /usr/lib/x86_64-linux-gnu/libmustache.so.4
(gdb) bt
#0  0x00007fabb31ded57 in mustache::Data::~Data() () from /usr/lib/x86_64-linux-gnu/libmustache.so.4
#1  0x00007fabb33fe52a in MustacheData_obj_free (object=0x7fabb3a552d8) at /home/macbre/php7/modules/php-mustache/mustache_data.cpp:68
#2  0x0000000000753371 in zend_objects_store_del ()
#3  0x000000000072c9b5 in zend_hash_reverse_apply ()
#4  0x000000000070c70d in shutdown_destructors ()
#5  0x000000000071b404 in zend_call_destructors ()
#6  0x00000000006be425 in php_request_shutdown ()
#7  0x00000000007a0be2 in ?? ()
#8  0x00000000004712a0 in main ()

I assume that php-mustache is ready to be used in PHP7.

What's licence for code

I would like package this extension as deb but I need put into description by which licence this code is covered.

Cheers.
eloy

Error when building

When trying to build this package on CentOS 6, I received the following error message:

/repos/php-mustache/mustache_data.cpp: In function ‘void mustache_data_from_zval(mustache::Data*, zval*)’:
/repos/php-mustache/mustache_data.cpp:581: error: call of overloaded ‘to_string(long int&)’ is ambiguous

I ended up type casting the offending item as shown in the diff below.

diff --git a/mustache_data.cpp b/mustache_data.cpp
index f9c09d1..4df6a02 100644
--- a/mustache_data.cpp
+++ b/mustache_data.cpp
@@ -572,7 +572,7 @@ void mustache_data_from_zval(mustache::Data * node, zval * current TSRMLS_DC)
           break;
       case IS_LONG:
           node->type = mustache::Data::TypeString;
-          node->val = new std::string(std::to_string(Z_LVAL_P(current)));
+          node->val = new std::string(std::to_string((long long)Z_LVAL_P(current)));
           break;
 #if PHP_MAJOR_VERSION < 7
       case IS_BOOL:

The make test passed

PHP 7.4 support

For now, build fails

/dev/shm/BUILD/php74-php-pecl-mustache-0.8.1/NTS/mustache_data.cpp:177:25: error: 'ZEND_ACC_SHADOW' was not declared in this scope

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.