cphalcon: Segfault with empty conditions. bind and limit

Core was generated by `php-fpm: pool www                                                            '.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000564627917849 in _zend_hash_str_update ()
(gdb) bt
#0  0x0000564627917849 in _zend_hash_str_update ()
#1  0x00007f1e0a87a14e in zephir_update_property_array () from /usr/lib/php/20151012/phalcon.so
#2  0x00007f1e0a6c969c in zim_Phalcon_Mvc_Model_Query_Builder_getPhql () from /usr/lib/php/20151012/phalcon.so
#3  0x00005646278f9f7a in dtrace_execute_internal ()
#4  0x00007f1e0a87584b in zephir_call_user_function () from /usr/lib/php/20151012/phalcon.so
#5  0x00007f1e0a86e0cf in zephir_call_class_method_aparams () from /usr/lib/php/20151012/phalcon.so
#6  0x00007f1e0a6c0b27 in zim_Phalcon_Mvc_Model_Query_Builder_getQuery () from /usr/lib/php/20151012/phalcon.so
#7  0x00005646278f9f7a in dtrace_execute_internal ()
#8  0x00007f1e0a87584b in zephir_call_user_function () from /usr/lib/php/20151012/phalcon.so
#9  0x00007f1e0a86e0cf in zephir_call_class_method_aparams () from /usr/lib/php/20151012/phalcon.so
#10 0x00007f1e0a6b308f in zim_Phalcon_Mvc_Model_find () from /usr/lib/php/20151012/phalcon.so
#11 0x00005646278f9f7a in dtrace_execute_internal ()
#12 0x000056462798d9f0 in ?? ()
#13 0x000056462794983b in execute_ex ()
#14 0x00005646278f9e11 in dtrace_execute_ex ()
#15 0x000056462799c6a7 in zend_execute ()
#16 0x000056462790a063 in zend_execute_scripts ()
#17 0x00005646278aabb0 in php_execute_script ()
#18 0x00005646277922f6 in main ()

Script to reproduce:

<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);

$di = new Phalcon\DI\FactoryDefault();

$di->setShared('db', function () {
    $connection = new Phalcon\Db\Adapter\Pdo\Mysql([
        'adapter'  => 'Mysql',
        'host'     => 'localhost',
        'port'     => 3306,
        'dbname'   => 'test',
        'username' => 'root'
    ]);

    return $connection;
});

class Robots extends Phalcon\Mvc\Model
{
    public $id;

    public function getSource()
    {
        return 'robots';
    }
}
// segfault after second request
Robots::find([
    'conditions' => '', // required
    'bind'       => [], // required
    'limit'      => 10 // required
]);
  • PHP 7.0.4-7ubuntu2.1 (cli) ( NTS )
  • phalcon origin/2.1.x de97d580
  • Powered by Zephir Version 0.9.3a-dev-5c0fb106a6

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 29 (22 by maintainers)

Commits related to this issue

Most upvoted comments

Added a possible fix for this in https://github.com/phalcon/cphalcon/commit/d6855cc7d44071764d72f552c9cc77f16ae42d71, can you please try again using latest 2.1.x?

@tembem for me yes, also it was added to tests and opcache enabled in travis and all passing.