php7.3.3 Segmentation fault
Closed this issue · 14 comments
<?php
$tpl = new Blitz('');
$tpl->setGlobal([]);
echo $tpl->parse();
Segmentation fault
Segmentation fault in parse method after setGlobal with an empty array.
Confirm
7.0 works
7.1 works
7.2 works
7.3 Segmentation fault
7.3.?
fisher:blitz fisher$ php -v
PHP 7.3.7 (cli) (built: Jul 6 2019 02:48:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.7, Copyright (c) 1998-2018 Zend Technologies
fisher:blitz fisher$ cat global.php
<?php
$tpl = new Blitz('');
$tpl->setGlobal([]);
echo $tpl->parse();
echo "OK\n";
fisher:blitz fisher$ php -v
PHP 7.3.7 (cli) (built: Jul 6 2019 02:48:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.7, Copyright (c) 1998-2018 Zend Technologies
fisher:blitz fisher$ php global.php
OK
Hello, Alexey
cat global.php
#!/usr/bin/php
<?php
$tpl = new Blitz('');
$tpl->setGlobal([]);
echo $tpl->parse();
echo "OK\n";
php -v
PHP 7.3.10-1+020191008.45+debian91.gbp365209 (cli) (built: Oct 8 2019 05:48:14) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.10, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.10-1+020191008.45+debian91.gbp365209, Copyright (c) 1999-2018, by Zend Technologies
./global.php
Segmentation fault
Segmentation fault is only on empty array in setGlobal
I think I know where we have the problem but I can't reproduce yet, even with exactly same php-7.3.10.
Can you verify that you have 0.10.4 php7 branch blitz build?
Alexey, just
git clone https://github.com/alexeyrybak/blitz -b php7
Latest?
you need to verify what you execute, clone will obvously give you latest version
php -i and find something like this:
Blitz support => enabled
Version => 0.10.4
#php -i
Configuration
blitz
Blitz support => enabled
Version => 0.10.4
yep. confirm - reproduced
where problem?
We have suspected changes to the count() function related to the Countable Interface.
Но это не точно :-)
will update shortly
fast fix:
fisher:blitz fisher$ git diff blitz.c
diff --git a/blitz.c b/blitz.c
index 5158f14..e38c111 100644
--- a/blitz.c
+++ b/blitz.c
@@ -17,7 +17,7 @@
*/
#define BLITZ_DEBUG 0
-#define BLITZ_VERSION_STRING "0.10.4"
+#define BLITZ_VERSION_STRING "0.10.5"
#ifndef PHP_WIN32
#include <sys/mman.h>
@@ -5310,6 +5310,10 @@ static PHP_FUNCTION(blitz_set_global)
}
input_ht = HASH_OF(input_arr);
+ if (0 == zend_hash_num_elements(input_ht)) {
+ return;
+ }
+
zend_hash_internal_pointer_reset(tpl->hash_globals);
zend_hash_internal_pointer_reset(input_ht);
@@ -5998,7 +6002,7 @@ PHP_MINFO_FUNCTION(blitz) /* {{{ */
{
php_info_print_table_start();
php_info_print_table_row(2, "Blitz support", "enabled");
- php_info_print_table_row(2, "Version", BLITZ_VERSION_STRING);
+ php_info_print_table_row(2, "Blitz version", BLITZ_VERSION_STRING);
php_info_print_table_end();
Worked fine, tnx!
fixed in repo (0.10.5)
@demushkin, please check it out & close.
ok. it works