Giter Site home page Giter Site logo

dreamsxin / cphalcon7 Goto Github PK

View Code? Open in Web Editor NEW
248.0 23.0 66.0 59.51 MB

Dao7 - Web framework for PHP,QQ群 316911641 & 515414530

Home Page: https://dreamsxin.github.io/phalcon7-docs/

JavaScript 0.01% C 72.96% PHP 26.06% Shell 0.04% Python 0.01% C++ 0.14% Makefile 0.01% Yacc 0.29% CSS 0.01% HTML 0.07% Volt 0.01% M4 0.40% Twig 0.01%
linux c php php71 web-framework events cache orm lmdb leveldb

cphalcon7's Introduction

Phalcon7(Dao7) Framework

Phalcon7 is a web framework implemented as a C extension offering high performance and lower resource consumption.

Help: https://github.com/dreamsxin/cphalcon7/wiki

Phalcon7 是什么?

Phalcon7 是继承自 Phalcon 1.3.x,开源、全功能栈、使用 C 编写、针对 PHP 7 优化的高性能框架。 开发者不需要学习和使用 C 语言的功能, 因为所有的功能都以 PHP 类的方式暴露出来,可以直接使用。 Phalcon7 源自 Phalcon 所以具备了 Phalcon 所有与生俱来的特性,是松耦合的,可以根据项目的需要任意使用其他对象。

Phalcon7 不只是为了卓越的性能, 我们的目标是让它更加健壮,拥有更加丰富的功能以及更加简单易于使用!

Phalcon7 版权申明

Phalcon7 作为 Phalcon 1.3 系列的继承者,所以版权理所当然的属于 Phalcon 官方团队所有。

Get Started

Phalcon7 is written in C with platform independence in mind. As a result, Phalcon7 is available on GNU/Linux, and Mac OS X. You can build it from sources.

Linux/Unix/Mac

On a Unix-based platform you can easily compile and install the extension from sources.

Requirements

Prerequisite packages are:

  • PHP 7.0.x development resources
  • GCC compiler (Linux/Solaris) or Xcode (Mac)

Ubuntu:

# if enable qrcode
sudo apt-get install libqrencode-dev libzbar-dev libmagickwand-dev libmagickcore-dev libpng12-dev
sudo ln -s /usr/include/ImageMagick-6/ /usr/include/ImageMagick

sudo add-apt-repository ppa:ondrej/php
sudo apt-get install php7.1-dev libpcre3-dev gcc make

# or compilation
----------------
cd php-src
 ./buildconf --force
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-fpm-user=www-data --with-fpm-group=www-data --with-pdo-pgsql --with-pdo-mysql --with-pdo-sqlite  --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --enable-zip --without-pear --with-gettext --disable-fileinfo --enable-maintainer-zts --enable-phpdbg-debug --enable-debug
make -j4
sudo make install

# class Phalcon\Async : --enable-sysvsem --enable-pcntl

Mac OS:

brew install pkg-config
brew install imagemagick
ln -s /usr/local/Cellar/imagemagick/6.9.7-0/include/ImageMagick-6/ /usr/local/Cellar/imagemagick/6.9.7-0/include/ImageMagick

brew install php70

Compilation

Follow these instructions to generate a binary extension for your platform:

git clone git://github.com/dreamsxin/cphalcon7.git
cd cphalcon7/ext
phpize

./configure

# or custom php path
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config

# or debug
./configure CFLAGS="-g3 -O0 -std=gnu90 -Wall -Werror -Wno-error=uninitialized"

make -j4
sudo make install

Other options:

./configure --enable-chart=yes --enable-qrcode=no --enable-process=yes \
--enable-intrusive=yes --enable-cache-yac=yes \
--enable-storage-btree=yes --enable-storage-wiredtiger=yes \
--enable-storage-bloomfilter=yes --enable-storage-datrie=yes \
--enable-storage-lmdb=yes --enable-storage-libmdbx=yes \
--enable-storage-leveldb=yes --enable-websocket=yes \
--enable-server=yes --enable-python=yes
make -j4
sudo make install

Add the extension to your php.ini:

extension=phalcon.so

Test:

php --ri phalcon7

cd cphalcon7
composer install
vendor/bin/phpunit unit-tests

Finally, restart the webserver.

Current Build Status

Phalcon7 Framework is built under the Travis CI service. Every commit pushed to this repository will queue a build into the continuous integration service and will run all PHPUnit tests to ensure that everything is going well and the project is stable. The current build status is:

Build Status

External Links

License

Phalcon7 is open source software licensed under the New BSD License. See the docs/LICENSE.txt file for more information.

Phalcon7 is the successor to the Phalcon 1.3 series, so the copyright belongs to the Phalcon team.

cphalcon7's People

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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cphalcon7's Issues

D神,请帮忙在框架中支持MySQL的ForceIndex的强制索引语句

由于mysql自身的查询优化器特别弱,稍微复杂一点儿它就认不出来。
所以,forceindex之类的强制索引,在mysql中非常常用。
请抽时间帮忙在phalcon中支持一下此功能
1、find
2、findFirst
3、PHQL
4、Phalcon\Mvc\Model\Query\Builder

多谢啊

Model中的find()和findFirst()返回的结果集不支持自定义属性问题

D神,关于

Model::find
Model::findFirst
添加一个额外属性,添加不上

而getPaginate分页可以添加上额外的属性。

例如:
第一种方法不可以

`
$model = new Detail;
$details = $model->find();

foreach($details as $k=>$detail){

$detail->notExistProperty = 190091; //在保留原有所有属性的基础上,新增加一个额外属性

}

var_dump($details); // notExistProperty 不存在了。

`

第二种方法也不可以

`

$model = new Detail;
$details = $model->find();

foreach($details as $k=>$detail){

$details[$k]->notExistProperty = 190091; //在保留原有所有属性的基础上,新增加一个额外属性

}

var_dump($details); // notExistProperty 不存在了。

`

请帮忙解决一下。

undefined symbol: phalcon_Phalcon_Mvc_Model_MetaData_Mongo_init

你好,编译安装phalcon顺利成功了,但是启动php-fpm时就报错了

[root@localhost ext]# /usr/local/php7/sbin/php-fpm 
/usr/local/php7/sbin/php-fpm: symbol lookup error: /usr/local/php7/lib/php/extensions/no-debug-non-zts-20160303/phalcon.so: undefined symbol: phalcon_Phalcon_Mvc_Model_MetaData_Mongo_init

mac环境make报错

macos: 10.15.7
php: 7.4.12
执行make -j4报如下错误

/Users/pygroos/Downloads/cphalcon7-kernel/ext/kernel/require.c:119:50: error: too many arguments to function call, expected 4,
have 5
(zend_function*)op_array, 0, op_array->scope, object ? Z_OBJ_P(object) : NULL);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/php/7.4.12/include/php/Zend/zend_execute.h:219:1: note: 'zend_vm_stack_push_call_frame' declared here
static zend_always_inline zend_execute_data *zend_vm_stack_push_call_frame(uint32_t call_info, zend_function *func, uint32...
^
1 warning and 1 error generated.
make: *** [kernel/require.lo] Error 1
make: *** Waiting for unfinished jobs....
1 warning generated.
In file included from /Users/pygroos/Downloads/cphalcon7-kernel/ext/phalcon.c:41:
In file included from ./phalcon.h:386:
./arr.h:59:3: error: unknown type name 'ulong'
ulong num_alias;
^
./arr.h:60:3: error: unknown type name 'ulong'
ulong num_selector;
^
/Users/pygroos/Downloads/cphalcon7-kernel/ext/phalcon.c:155:28: warning: incompatible pointer types assigning to
'zend_object_write_property_t' (aka 'struct _zval_struct ()(struct _zval_struct *, struct _zval_struct *, struct
_zval_struct *, void **)') from 'void (zval *, zval *, zval *, void **)' (aka 'void (struct _zval_struct *, struct
_zval_struct *, struct _zval_struct *, void **)') [-Wincompatible-pointer-types]
handlers->write_property = phalcon_aop_write_property;
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings and 2 errors generated.
1 warning generated.
make: *** [phalcon.lo] Error 1

centos make的时候报错

/root/cphalcon7/ext/storage/libmdbx.h:25:18: fatal error: mdbx.h: No such file or directory
#include "mdbx.h"
我换了两台机器都是这样

undefined symbol: zend_string_release_ex

PHP Warning: PHP Startup: Unable to load dynamic library 'phalcon.so' (tried: /usr/lib64/php/modules/phalcon.so (/usr/lib64/php/modules/phalcon.so: undefined symbol: zend_string_release_ex), /usr/lib64/php/modules/phalcon.so.so (/usr/lib64/php/modules/phalcon.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

php版本是
PHP 7.2.34 (cli) (built: Oct 1 2020 13:37:37) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

macos编译安装报错

phpize,./configure的时候都没有问题。
make的时候报错:
ld: 9 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [phalcon.la] Error 1
怎么都解决不了。
系统版本 macOS Mojave 10.14
xCode版本:10.1

图像处理类的问题

PHP_METHOD(Phalcon_Image_Adapter_Imagick, line){方法中的
if (Z_TYPE(image) == IS_RESOURCE) { 此处判断是否有问题?Z_TYPE得到的值为7,常量类型,IS_RESOURCE是8,调试图片就一个正常路径的png图片

在循环中,数据库切片、表切片工作错误

表结构

CREATE TABLE IF NOT EXISTS detail_0 (
	id int(11) unsigned NOT NULL AUTO_INCREMENT,
	uid bigint(20) unsigned NOT NULL DEFAULT '0',
	name varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
	PRIMARY KEY (id),
	KEY uid (uid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
use \Phalcon\DI\FactoryDefault;
use \Phalcon\Logger;
use \Phalcon\Events\Manager as EventsManager;
use \Phalcon\Logger\Adapter\File as FileLogger;
use \Phalcon\Db\Adapter\Pdo\Mysql as Connection;
use \Phalcon\Mvc\Model as MvcModel;

define('IS_DEBUG', false);

class Detail extends MvcModel{
    public $id;
    public $uid;
    public $name;

	public function initialize()
	{
		$this->useDynamicUpdate(true);

		self::setup(array(
			'notNullValidations' => true,
			'virtualForeignKeys' => false,
			'strict' => true, //写库操作成功与否严格按照实际操作的条数,如果为0条就是false
			// 'astCache' => false,
		));

		$this->hashTbl(0);
		$this->setConnectionService('db0');
	}

	public function hashTbl($uid, $factor=3)
	{
		$this->setSource('detail_'.($uid%$factor));
	}

	public function hashConnection($uid, $factor=2)
	{
		$this->setConnectionService('db'.($uid%$factor));
	}

	public function append($uid, $params = array())
	{
		$this->hashTbl($uid, 3);
		//$this->hashConnection($uid, 2);
		self::save($params, ['id', 'uid', 'name']);
	
		return $this->id;
	}

}

$di = new FactoryDefault();

// database service start
$dbSettings = [
	"db0" => ['host' => '127.0.0.1', 'port' => 3306, 'username' => 'root', 'password' => 'devel.yangx', 'dbname' => 'tdb0', 'options' => [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8mb4'", PDO::ATTR_CASE => PDO::CASE_NATURAL]], 
	"db1" => ['host' => '127.0.0.1', 'port' => 3306, 'username' => 'root', 'password' => 'devel.yangx', 'dbname' => 'tdb1', 'options' => [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8mb4'", PDO::ATTR_CASE => PDO::CASE_NATURAL]]
];

foreach($dbSettings as $serviceName=>$dbSetting){
	$di->set($serviceName, function () use ($dbSetting) {
		$dbAdapterClass = '\Phalcon\Db\Adapter\Pdo\Mysql';
		$connection = new $dbAdapterClass($dbSetting);
		if (IS_DEBUG)
		{
			$eventsManager = new EventsManager();
			
			// Listen all the database events
			$eventsManager->attach('db', function ($event, $connection) {
				// var_dump($event->getType());
				if ($event->getType()=='beforeQuery'||$event->getType()=='beforeExecute')
				{
					echo "\n".date("r").$connection->getSQLStatement()."\n";
				}
			});
			
			$connection->setEventsManager($eventsManager);
		}
		
		return $connection;
	}, TRUE);
}
// database service end
// test database
$results = array(
	array('uid' => 77, 'name' => '我是第1条数据'),
	array('uid' => 78, 'name' => '我是第2条数据'),
	array('uid' => 79, 'name' => '我是第3条数据'),
	array('uid' => 80, 'name' => '我是第4条数据'),
	array('uid' => 81, 'name' => '我是第5条数据'),
	array('uid' => 82, 'name' => '我是第6条数据'),
);


foreach($results as $result)
{
	$mDetail = new Detail;
	$id = $mDetail->append($result['uid'], $result);
	var_dump($id);
}

Phalcon\Aop::addAround does not work with traits

<?php
// manual.php
use Phalcon\Aop;
use Phalcon\Aop\Joinpoint;

trait TestTrait {
    public function run() {
        echo 'test', PHP_EOL;
    }
}

class TestClass {
    use TestTrait;
}

$interceptor = new Aop();
$interceptor->addAround(
    'TestTrait::run()',
    function (JoinPoint $jp) {
        echo 'before', PHP_EOL;
        $jp->process();
        echo 'after', PHP_EOL;
    }
);

$test = new TestClass();
$test->run();
$ php -d phalcon.aop.enable_aop=1 -d extension=ext/modules/phalcon.so manual.php

Expected output:

before
test
after

Actual output:

test
$ php -v
PHP 7.4.0 (cli) (built: Nov 28 2019 20:49:56) ( ZTS DEBUG )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.0, Copyright (c), by Zend Technologies

Git commit: 2870b6d

不是有个YAF模块起到类似的作用嘛?

phalcon 最初也是完全C写的,后面发现兼容性不容易才改成一个中间语言zephir解释,而且Phalcon也支持PHP7了。有个YAF模块作用类似吧?要效率高不如直接生成C代码模块更好。比如C HTML Template Library 之类的。

phalcon7图像处理相关bug

cphalcon7/ext/image/adapter/imagick.c
类中_watermark方法有bug
phalcon_get_intval(opacity) < 100调整透明度,调用的evaluateImage方法,此方法的透明度并不是1以下,为2是50%,所以永远调不了透明度
还有line方法调用无效。

phalcon与cphalcon7的关系

之前我一直用的phalcon 2.9 现在也用到了3.1 请问cphalcon7与 原本的phalcon 3.1之间的关系是什么样的 代码貌似是比较兼容的

Segmentation fault on Phalcon\Aop\Joinpoint::addAfterReturning

<?php
// manual.php

use Phalcon\Aop;
use Phalcon\Aop\Joinpoint;

function doStuffException() {
    echo __FUNCTION__;
    throw new Exception('Exception doStuffException');
}


$interceptor = new Aop();
$interceptor->addAfterReturning('doStuff*()', function () {
    echo '[after]', PHP_EOL;
});

try {
    doStuffException();
} catch (Exception $e) {
    echo '[caught]', PHP_EOL;
}
$ php -d phalcon.aop.enable_aop=1 -d extension=ext/modules/phalcon.so manual.php
php: /home/klay/src/php/source/7.4.0/ext/pcre/php_pcre.c:931: php_pcre_create_match_data: Assertion `NULL != re' failed
0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
1  0x00007ffff4cc4535 in __GI_abort () at abort.c:79
2  0x00007ffff4cc440f in __assert_fail_base (fmt=0x7ffff4e26ee0 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55555602caa4 "NULL != re", file=0x55555602c368 "/home/klay/src/php/source/7.4.0/ext/pcre/php_pcre.c", line=931, function=<optimized out>) at assert.c:92
3  0x00007ffff4cd2102 in __GI___assert_fail (assertion=0x55555602caa4 "NULL != re", file=0x55555602c368 "/home/klay/src/php/source/7.4.0/ext/pcre/php_pcre.c", line=931, function=0x55555602d1d0 <__PRETTY_FUNCTION__.21423> "php_pcre_create_match_data") at assert.c:101
4  0x000055555584d6c4 in php_pcre_create_match_data (capture_count=0, re=0x0) at /home/klay/src/php/source/7.4.0/ext/pcre/php_pcre.c:931
5  0x00007ffff1cacf48 in pointcut_match_zend_function (pc=0x7ffff3e6f3c0, ex=0x7ffff3e140f0) at /home/klay/work/cphalcon7/ext/aop.c:288
6  0x00007ffff1cad128 in calculate_function_pointcuts (ex=0x7ffff3e140f0) at /home/klay/work/cphalcon7/ext/aop.c:343
7  0x00007ffff1cada54 in get_cache_func (ex=0x7ffff3e140f0) at /home/klay/work/cphalcon7/ext/aop.c:523
8  0x00007ffff1cae9d9 in func_pointcut_and_execute (ex=0x7ffff3e140f0) at /home/klay/work/cphalcon7/ext/aop.c:805
9  0x00007ffff1caef7c in phalcon_aop_execute_ex (ex=0x7ffff3e140f0) at /home/klay/work/cphalcon7/ext/aop.c:900
10 0x00007ffff1cbbc76 in async_execute_ex (exec=0x7ffff3e140f0) at /home/klay/work/cphalcon7/ext/async/core.c:51
11 0x0000555555df8c29 in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at /home/klay/src/php/source/7.4.0/Zend/zend_vm_execute.h:1601
12 0x0000555555e5cd49 in execute_ex (ex=0x7ffff3e14020) at /home/klay/src/php/source/7.4.0/Zend/zend_vm_execute.h:53571
13 0x00007ffff1caef43 in phalcon_aop_execute_ex (ex=0x7ffff3e14020) at /home/klay/work/cphalcon7/ext/aop.c:896
14 0x00007ffff1cbbaca in execute_root (exec=0x7ffff3e14020) at /home/klay/work/cphalcon7/ext/async/core.c:30
15 0x00007ffff1cbbc61 in async_execute_ex (exec=0x7ffff3e14020) at /home/klay/work/cphalcon7/ext/async/core.c:49
16 0x0000555555e60e92 in zend_execute (op_array=0x7ffff3e86400, return_value=0x0) at /home/klay/src/php/source/7.4.0/Zend/zend_vm_execute.h:57651
17 0x0000555555d82ad2 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/klay/src/php/source/7.4.0/Zend/zend.c:1663
18 0x0000555555ccf528 in php_execute_script (primary_file=0x7fffffffd920) at /home/klay/src/php/source/7.4.0/main/main.c:2619
19 0x0000555555e6396c in do_cli (argc=6, argv=0x555556baad40) at /home/klay/src/php/source/7.4.0/sapi/cli/php_cli.c:961
20 0x0000555555e64a6f in main (argc=6, argv=0x555556baad40) at /home/klay/src/php/source/7.4.0/sapi/cli/php_cli.c:1352
$ php -v
PHP 7.4.0 (cli) (built: Nov 28 2019 20:49:56) ( ZTS DEBUG )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.0, Copyright (c), by Zend Technologies

Git commit: 40c0c21

从model::findFirst取出数据toArray后通过redis->hMSet存储导致php崩溃

环境: CentOS7.6x64 + PHP7.3.27 + Redis5.3.3

通过 Model的findFirst取出的数据,用 toArray转化为数组,然后向redis内通过hMSet方法存储hash结构,结果导致PHP崩溃。

通过gdb调试发现报错内容如下:

`

(gdb) bt
#0 0x00007ffff4a48387 in raise () from /usr/lib64/libc.so.6
#1 0x00007ffff4a49a78 in abort () from /usr/lib64/libc.so.6
#2 0x00007ffff4a411a6 in __assert_fail_base () from /usr/lib64/libc.so.6
#3 0x00007ffff4a41252 in __assert_fail () from /usr/lib64/libc.so.6
#4 0x0000000000aca9bd in zval_get_string_func (op=0x7ffff0791600)
at /opt/distfiles/php/php-7.3.27/Zend/zend_operators.c:898
#5 0x00007fffe6df3c38 in zval_get_string (op=0x7ffff0791600)
at /opt/php7/include/php/Zend/zend_operators.h:272
#6 0x00007fffe6dfb7f6 in redis_serialize (redis_sock=0x7ffff067a380, z=0x7ffff0791600,
val=0x7fffffff8bf0, val_len=0x7fffffff8be8)
at /opt/distfiles/php/redis-5.3.3/library.c:2971
#7 0x00007fffe6dfb63e in redis_pack (redis_sock=0x7ffff067a380, z=0x7ffff0791600,
val=0x7fffffff8c78, val_len=0x7fffffff8c70)
at /opt/distfiles/php/redis-5.3.3/library.c:2726
#8 0x00007fffe6dec524 in redis_hmset_cmd (execute_data=0x7ffff06223c0,
return_value=0x7ffff06223b0, redis_sock=0x7ffff067a380, cmd=0x7fffffff8d50,
cmd_len=0x7fffffff8d4c, slot=0x0, ctx=0x7fffffff8d40)
at /opt/distfiles/php/redis-5.3.3/redis_commands.c:1719
#9 0x00007fffe6dd738d in zim_Redis_hMset (execute_data=0x7ffff06223c0,
return_value=0x7ffff06223b0) at /opt/distfiles/php/redis-5.3.3/redis.c:2431
#10 0x0000000000b3d923 in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER ()
at /opt/distfiles/php/php-7.3.27/Zend/zend_vm_execute.h:1106
#11 0x0000000000ba4b4b in execute_ex (ex=0x7ffff06221a0)
at /opt/distfiles/php/php-7.3.27/Zend/zend_vm_execute.h:55527
#12 0x0000000000ac1671 in zend_call_function (fci=0x7fffffff9120, fci_cache=0x7fffffff8fd0)
at /opt/distfiles/php/php-7.3.27/Zend/zend_execute_API.c:756
#13 0x0000000000ac0ce1 in _call_user_function_ex (object=0x0,
function_name=0x7fffffff9480, retval_ptr=0x7fffffff9470, param_count=2,
---Type to continue, or q to quit---
params=0x7ffff0700440, no_separation=1)
at /opt/distfiles/php/php-7.3.27/Zend/zend_execute_API.c:598
#14 0x00007fffe63d745e in phalcon_call_user_func_array (retval=0x7fffffff9470,
handler=0x7fffffff9480, params=0x7fffffff94d0)
at /opt/distfiles/php/cphalcon7/ext/kernel/fcall.c:363
#15 0x00007fffe66032ad in phalcon_call_user_func_array_noex (retval=0x7fffffff9470,
handler=0x7fffffff9480, params=0x7fffffff94d0)
at /opt/distfiles/php/cphalcon7/ext/kernel/fcall.h:74
#16 0x00007fffe6608ceb in zim_Phalcon_Dispatcher_dispatch (execute_data=0x7ffff0622150,
return_value=0x7fffffffa010) at /opt/distfiles/php/cphalcon7/ext/dispatcher.c:1225
#17 0x0000000000ac1743 in zend_call_function (fci=0x7fffffff9bf0, fci_cache=0x7fffffff9bd0)
at /opt/distfiles/php/php-7.3.27/Zend/zend_execute_API.c:770
#18 0x00007fffe63d760d in phalcon_call_user_function (fn=0x1b0e110,
called_scope=0x1b0a3e0, object=0x7fffffffa020, function_name=0x7fffffff9cc0,
retval_ptr=0x7fffffffa010, param_count=0, params=0x0)
at /opt/distfiles/php/cphalcon7/ext/kernel/fcall.c:432
#19 0x00007fffe63d7d7a in phalcon_call_method_with_params (retval=0x7fffffffa010,
object=0x7fffffffa020, ce=0x1b0a3e0, type=phalcon_fcall_method,
method_name=0x7fffe673a2a0 "dispatch", method_len=8, param_count=0,
params=0x7fffffff9e90) at /opt/distfiles/php/cphalcon7/ext/kernel/fcall.c:531
#20 0x00007fffe6558e72 in zim_Phalcon_Mvc_Application_handle (execute_data=0x7ffff0622100,
return_value=0x7ffff06220d0) at /opt/distfiles/php/cphalcon7/ext/mvc/application.c:448
#21 0x0000000000b3d923 in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER ()
at /opt/distfiles/php/php-7.3.27/Zend/zend_vm_execute.h:1106
#22 0x0000000000ba4b4b in execute_ex (ex=0x7ffff0622030)
at /opt/distfiles/php/php-7.3.27/Zend/zend_vm_execute.h:55527
#23 0x0000000000baa149 in zend_execute (op_array=0x7ffff0605100, return_value=0x0)
at /opt/distfiles/php/php-7.3.27/Zend/zend_vm_execute.h:60935
---Type to continue, or q to quit---
#24 0x0000000000ad88ba in zend_execute_scripts (type=8, retval=0x0, file_count=3)
at /opt/distfiles/php/php-7.3.27/Zend/zend.c:1568
#25 0x0000000000a477e5 in php_execute_script (primary_file=0x7fffffffcb60)
at /opt/distfiles/php/php-7.3.27/main/main.c:2637
#26 0x0000000000bb5abb in php_cli_server_dispatch_script (server=0x15b8180 ,
client=0x1bebe70) at /opt/distfiles/php/php-7.3.27/sapi/cli/php_cli_server.c:1997
#27 0x0000000000bb6284 in php_cli_server_dispatch (server=0x15b8180 ,
client=0x1bebe70) at /opt/distfiles/php/php-7.3.27/sapi/cli/php_cli_server.c:2175
#28 0x0000000000bb6aff in php_cli_server_recv_event_read_request (
server=0x15b8180 , client=0x1bebe70)
at /opt/distfiles/php/php-7.3.27/sapi/cli/php_cli_server.c:2391
#29 0x0000000000bb6e2b in php_cli_server_do_event_for_each_fd_callback (
_params=0x7fffffffcdd0, fd=8, event=1)
at /opt/distfiles/php/php-7.3.27/sapi/cli/php_cli_server.c:2469
#30 0x0000000000bb2f12 in php_cli_server_poller_iter_on_active (
poller=0x15b8188 <server+8>, opaque=0x7fffffffcdd0,
callback=0xbb6c57 <php_cli_server_do_event_for_each_fd_callback>)
at /opt/distfiles/php/php-7.3.27/sapi/cli/php_cli_server.c:853
#31 0x0000000000bb6ee8 in php_cli_server_do_event_for_each_fd (server=0x15b8180 ,
rhandler=0xbb69c0 <php_cli_server_recv_event_read_request>,
whandler=0xbb6b26 <php_cli_server_send_event>)
at /opt/distfiles/php/php-7.3.27/sapi/cli/php_cli_server.c:2492
#32 0x0000000000bb6f4d in php_cli_server_do_event_loop (server=0x15b8180 )
at /opt/distfiles/php/php-7.3.27/sapi/cli/php_cli_server.c:2502
#33 0x0000000000bb7290 in do_cli_server (argc=5, argv=0x15c4100)
at /opt/distfiles/php/php-7.3.27/sapi/cli/php_cli_server.c:2624
#34 0x0000000000badc72 in main (argc=5, argv=0x15c4100)
at /opt/distfiles/php/php-7.3.27/sapi/cli/php_cli.c:1399

`

model中float类型保存不了

类似
class User extends \Phalcon\Mvc\Model
{

public $id;
/**
 * @Column(type="string", length=11, nullable=false)
 */
public $money1;

}
如果是
$user = new User();
$user->money1 = 1231.12
$user->save();
数据是正常的

但是 如果是从数据库中取出对像再设置 money1 浮点型就会变成整型
也就是说model中的数据insert 是可以的。。但 update有问题

我大概看了下
print_r($connection->getSqlBindTypes());
insert money1的限制类型 是 2 update就变成了1.。

我目前使用的办法是
$user = User::getByUserId(123);
$user->money1 = 1231.12
$user->money1 += "";//相当于全部转换成字符串去保存
$user->save();
这样是可以的。

如果可以麻烦修复下吧。

Phalcon\Aop::addAfterReturning does not work with interfaces

<?php
// manual.php
use Phalcon\Aop;
use Phalcon\Aop\Joinpoint;

interface FluentInterface {}

class FluentDemo implements FluentInterface {
    public function setFoo() {}
    public function setBar() {}
    public function setBaz() {}
}

$interceptor = new Aop();
$interceptor->addAfterReturning(
    'FluentInterface->set*()',
    function (JoinPoint $jp) {
        if (null === $jp->getReturnedValue()) {
            $jp->setReturnedValue($jp->getObject());
        }
    }
);

$test = new FluentDemo();
$test->setFoo()->setBar()->setBaz();
$ php -d phalcon.aop.enable_aop=1 -d extension=ext/modules/phalcon.so manual.php
PHP Fatal error:  Uncaught Error: Call to a member function setBar() on null in /mnt/work/cphalcon7/manual.php:24
Stack trace:
#0 {main}
  thrown in /mnt/work/cphalcon7/manual.php on line 24

Fatal error: Uncaught Error: Call to a member function setBar() on null in /mnt/work/cphalcon7/manual.php:24
Stack trace:
#0 {main}
  thrown in /mnt/work/cphalcon7/manual.php on line 24
$ php -v
PHP 7.4.0 (cli) (built: Nov 28 2019 20:49:56) ( ZTS DEBUG )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.0, Copyright (c), by Zend Technologies

Git commit: f52a402

master版本安装失败

错误信息:
In file included from ./forms/elementinterface.h:23:
./php_phalcon.h:25:10: fatal error: 'config.h' file not found

phalcon会话的问题。

为什么在DI中注册session以后,比如:
$di->set('session',function(){
$session=new Phalcon\Session\Adapter\Files();
$session->start();
return $session;
});
在控制器中:
public function index()
{
$this->session->set('demo','set a variable!!');
这一句话提示Files这个类没有start的方法存在。
}
一直找不到问题的所在!!help me!!!

请问在windows下怎么编译

我将ext直接放在php-src下的ext文件夹里改名为phalcon无法编译通过,显示cl.exe 0x02;但是我自己写的php拓展和php.exe都可以正常编译。

我的环境如下:
windows10 x64
vs2017
php-7.3.2-src
php-sdk-2.1.10

Segmentation fault on addAround

<?php
// Test
use Phalcon\Aop\Joinpoint;
use Phalcon\Aop;

class AspektTest {
    public function foo() {
        return 'intest';
    }
}

$interceptor = new Aop();
$interceptor->addAround(
    'AspektTest::foo()',
    function (JoinPoint $jp) {
        return 'nocall';
    }
);

$test = new AspektTest();
echo $test->foo();
$ php -d phalcon.aop.enable_aop=1 -d extension=ext/modules/phalcon.so manual.php
Segmentation fault (core dumped)
0  0x0000555555d7cf07 in zend_gc_delref (p=0x74726f7070757320) at /home/klay/src/php/source/7.4.0/Zend/zend_types.h:1033
1  0x0000555555d7d1ce in i_zval_ptr_dtor (zval_ptr=0x7ffff3e14120) at /home/klay/src/php/source/7.4.0/Zend/zend_variables.h:43
2  0x0000555555d7d3f0 in zval_ptr_dtor (zval_ptr=0x7ffff3e14120) at /home/klay/src/php/source/7.4.0/Zend/zend_variables.c:84
3  0x00007ffff1cae3e9 in phalcon_aop_do_func_execute (pos=1, pointcut_table=0x7ffff3e58c60, ex=0x7ffff3e14130, aop_object=0x7fffffff9d50) at /home/klay/work/cphalcon7/ext/aop.c:732
4  0x00007ffff1caeb7f in func_pointcut_and_execute (ex=0x7ffff3e14130) at /home/klay/work/cphalcon7/ext/aop.c:834
5  0x00007ffff1caef4a in phalcon_aop_execute_ex (ex=0x7ffff3e14130) at /home/klay/work/cphalcon7/ext/aop.c:897
6  0x00007ffff1cbbc44 in async_execute_ex (exec=0x7ffff3e14130) at /home/klay/work/cphalcon7/ext/async/core.c:51
7  0x0000555555df9166 in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at /home/klay/src/php/source/7.4.0/Zend/zend_vm_execute.h:1713
8  0x0000555555e5cd59 in execute_ex (ex=0x7ffff3e14020) at /home/klay/src/php/source/7.4.0/Zend/zend_vm_execute.h:53575
9  0x00007ffff1caef11 in phalcon_aop_execute_ex (ex=0x7ffff3e14020) at /home/klay/work/cphalcon7/ext/aop.c:893
10 0x00007ffff1cbba98 in execute_root (exec=0x7ffff3e14020) at /home/klay/work/cphalcon7/ext/async/core.c:30
11 0x00007ffff1cbbc2f in async_execute_ex (exec=0x7ffff3e14020) at /home/klay/work/cphalcon7/ext/async/core.c:49
12 0x0000555555e60e92 in zend_execute (op_array=0x7ffff3e8a400, return_value=0x0) at /home/klay/src/php/source/7.4.0/Zend/zend_vm_execute.h:57651
13 0x0000555555d82ad2 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/klay/src/php/source/7.4.0/Zend/zend.c:1663
14 0x0000555555ccf528 in php_execute_script (primary_file=0x7fffffffd710) at /home/klay/src/php/source/7.4.0/main/main.c:2619
15 0x0000555555e6396c in do_cli (argc=6, argv=0x555556bab060) at /home/klay/src/php/source/7.4.0/sapi/cli/php_cli.c:961
16 0x0000555555e64a6f in main (argc=6, argv=0x555556bab060) at /home/klay/src/php/source/7.4.0/sapi/cli/php_cli.c:1352
$ php -v
PHP 7.4.0 (cli) (built: Nov 28 2019 20:49:56) ( ZTS DEBUG )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.0, Copyright (c), by Zend Technologies
$ php -d extension=ext/modules/phalcon.so -r 'echo Phalcon\Version::get();'
1.3.3

Take a look at this code:

cphalcon7/ext/aop.c

Lines 731 to 733 in d8c91fd

if (ex->return_value != NULL) {
zval_ptr_dtor(ex->return_value);
ZVAL_COPY_VALUE(ex->return_value, &pointcut_ret);

i got an error when i make

php -v
PHP 7.1.4 (cli) (built: Apr 14 2017 18:15:34) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies

./configure --prefix=/usr/local/php7 --with-php-config=/usr/local/php7/bin/php-config --enable-storage-btree=yes
..............
.............
..............
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
config.status: config.h is unchanged

make -j4
....
....
....
Downloads/php-extension/cphalcon7/ext/storage/btree/utils.c:29:10: error: expected ')'
uint64_t htonll(uint64_t value)
......
.....
....
Downloads/php-extension/cphalcon7/ext/storage/btree/utils.c:29:10: error: conflicting types for '__builtin_constant_p'
uint64_t htonll(uint64_t value)
....
....
....
Downloads/php-extension/cphalcon7/ext/storage/btree/utils.c:29:10: error: definition of builtin function '__builtin_constant_p'
uint64_t htonll(uint64_t value)
^
....
....
....
Downloads/php-extension/cphalcon7/ext/storage/btree/utils.c:41:10: error: expected ')'
uint64_t ntohll(uint64_t value)
.....
....
....
Downloads/php-extension/cphalcon7/ext/storage/btree/utils.c:41:10: error: conflicting types for '__builtin_constant_p'
uint64_t ntohll(uint64_t value)
....
...
..
Downloads/php-extension/cphalcon7/ext/storage/btree/utils.c:41:10: error: definition of builtin function '__builtin_constant_p'
uint64_t ntohll(uint64_t value)
.....
....
....
6 errors generated.
make: *** [storage/btree/utils.lo] Error 1

what can i do to fix these errors?

作者你的文档网站访问不了

不知道是不是你的域名被墙了,还是你用的DNS被墙了,你的网站已经无法访问了。
命令行里Ping 你网站的域名 发现会直接显示到dreamsxin.github.io这个域名,如果你是使用github的DNS服务,那么有可能是因为最近github部分域名也被墙的原因。
建议作者把文档直接放github上,或者改一下DNS服务商。

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.