dreamsxin / cphalcon7 Goto Github PK
View Code? Open in Web Editor NEWDao7 - Web framework for PHP,QQ群 316911641 & 515414530
Home Page: https://dreamsxin.github.io/phalcon7-docs/
Dao7 - Web framework for PHP,QQ群 316911641 & 515414530
Home Page: https://dreamsxin.github.io/phalcon7-docs/
Uncaught Error: Class 'Phalcon\Mvc\View\Engine\Volt' not found
<?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:
Lines 731 to 733 in d8c91fd
你好,编译安装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
/root/cphalcon7/ext/storage/libmdbx.h:25:18: fatal error: mdbx.h: No such file or directory
#include "mdbx.h"
我换了两台机器都是这样
之前我一直用的phalcon 2.9 现在也用到了3.1 请问cphalcon7与 原本的phalcon 3.1之间的关系是什么样的 代码貌似是比较兼容的
phalcon 最初也是完全C写的,后面发现兼容性不容易才改成一个中间语言zephir解释,而且Phalcon也支持PHP7了。有个YAF模块作用类似吧?要效率高不如直接生成C代码模块更好。比如C HTML Template Library 之类的。
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
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 不存在了。
`
请帮忙解决一下。
不知道是不是你的域名被墙了,还是你用的DNS被墙了,你的网站已经无法访问了。
命令行里Ping 你网站的域名 发现会直接显示到dreamsxin.github.io这个域名,如果你是使用github的DNS服务,那么有可能是因为最近github部分域名也被墙的原因。
建议作者把文档直接放github上,或者改一下DNS服务商。
<?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
为什么在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!!!
PHP_METHOD(Phalcon_Image_Adapter_Imagick, line){方法中的
if (Z_TYPE(image) == IS_RESOURCE) { 此处判断是否有问题?Z_TYPE得到的值为7,常量类型,IS_RESOURCE是8,调试图片就一个正常路径的png图片
我将ext直接放在php-src下的ext文件夹里改名为phalcon无法编译通过,显示cl.exe 0x02;但是我自己写的php拓展和php.exe都可以正常编译。
我的环境如下:
windows10 x64
vs2017
php-7.3.2-src
php-sdk-2.1.10
环境: 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
`
错误信息:
In file included from ./forms/elementinterface.h:23:
./php_phalcon.h:25:10: fatal error: 'config.h' file not found
<?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
phalcon都更新到5.0了. 为什么不往官方库提交而是重造没有用的轮子?
<?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
cphalcon7/ext/image/adapter/imagick.c
类中_watermark方法有bug
phalcon_get_intval(opacity) < 100调整透明度,调用的evaluateImage方法,此方法的透明度并不是1以下,为2是50%,所以永远调不了透明度
还有line方法调用无效。
ld: 1813 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
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
I encountered a problem
in install cphalcon7 appear ‘make: warning: Clock skew detected. Your build may be incomplete.‘
env.config
php7.2.2
centos7.0
gcc4.8.5
表结构
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);
}
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
Phalcon\ContinueException在控制器的initialize方法中调用后,没有设置 dispatcher->getLastHandler()
dispatcher->getLastHandler() 为空,个人猜想可能是没有设置 controller导致的。
请帮忙排查一下这个原因。
朋友,你一个人维护这个,倒不如写个基于phalcon的PHP框架EasyPhalcon框架好些。 用户只需要在框架里添加controller和model,这样推广起来会相当的容易。
由于mysql自身的查询优化器特别弱,稍微复杂一点儿它就认不出来。
所以,forceindex之类的强制索引,在mysql中非常常用。
请抽时间帮忙在phalcon中支持一下此功能
1、find
2、findFirst
3、PHQL
4、Phalcon\Mvc\Model\Query\Builder
多谢啊
类似
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();
这样是可以的。
如果可以麻烦修复下吧。
请问cphalcon7和原phalcon兼容性相差大吗?
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?
能不能增加个windows的
@sjinks Can you help see this proplem?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.