Cakephp 3.1 have issues with PHP7.2 - cakephp-3.0

I have develop my web application by using cakephp 3.1. My service provider has update the php version to 7.2. Now my application is not work well, as it was working with PHP5.6, Its showing different warnings with debug=true; and the big problem is its not showing line which have some problem, if some is there. Here is warning message.
Warning: count() [function.count]: Parameter must be an array or an object that implements Countable in D:\xampp7\htdocs\bighris\vendor\cakephp\cakephp\src\Database\QueryCompiler.php on line 115
In case some errors are there its not showing it, in the following way, there I can't find the line number and the file which have the problem.
https://www.screencast.com/t/qIQB1YIW
Please help me to solve the issue, Thanks

As per the Cakephp github issues:
PHP 7.2 has changed count's behavior
that's why you are getting errors.
PHP 7.2 has changed count's behavior causing problems with QueryCompiler
You can follow the below link or change your PHP version to 7.1 or less to resolve this issue.
Stop warnings when using count in QueryCompiler in PHP 7.2

it looks like you are passing some wrong data to count function, guess you are passing some query directly to count. Or something like that.
If you may show the code of the controller you are facing issue it may be a great help.

there is solution for you....
2020-09-30 06:22:30 Warning: Warning (2): count() [function.count]: Parameter must be an array or an object that implements Countable in [D:\xampp\htdocs\gym_master\vendor\cakephp\cakephp\src\Database\QueryCompiler.php, line 126]
please check your php version...

Related

Django: module 'django_mysql.models' has no attribute 'JSONField'?

I'm running Django 4.0. I've got a models with fields declared like this:
industries = models.JSONField()
On MakeMigration, Django is throwing the error:
module 'django_mysql.models' has no attribute 'JSONField'
There are at least 3 previous SO posts on this. They advise using Django's models.JSONField(), which I am doing.
I'm using:
Django 4.0
Python 3.9.13
django-mysql 4.7.0
Why am I getting this error message?
Update
Possibly relevant somehow: the error is being thrown in an old migration file from 2019.
Thanks to Willem Van Onsem for the answer. He pointed out that I must still be referencing django_mysql.models.JSONField somehow. Sure enough, I had old migration files that were doing that. (And here's the SO thread about how to fix that.)
#Willem, if you'd like to post your comment in the form of an answer here, I will mark it as the accepted answer.

go1.16 sigs.k8s.io/json sf.IsExported undefined error

When I build the Go project I get the following error
# sigs.k8s.io/json/internal/golang/encoding/json
../pkg/mod/sigs.k8s.io/json#v0.0.0-20211020170558-c049b76a60c6/internal/golang/encoding/json/encode.go:1249:12: sf.IsExported undefined (type reflect.StructField has no field or method IsExported)
../pkg/mod/sigs.k8s.io/json#v0.0.0-20211020170558-c049b76a60c6/internal/golang/encoding/json/encode.go:1255:18: sf.IsExported undefined (type reflect.StructField has no field or method IsExported)
I know this is a version problem, and it can be solved by upgrading the version to 1.17, but because the company's environment is 1.16, it cannot be upgraded because of this project
How can I modify it, if I lower the lower version, which version should I lower to?
I really appreciate any help with this.
Looks like this error could be coming from kubebuilder (or a tool derived from it such as operator-sdk). Then you should use the correct version of the given tool. E.g.,
kubebuilder - have a list mapping go versions to kubebuilder versions https://book.kubebuilder.io/quick-start.html#prerequisites
operator-sdk - don't have a list, but you can find it by going through the documentation for each version, e.g., the first I found that has a version lower than 1.17 is https://v1-16-x.sdk.operatorframework.io/docs/installation/#prerequisites-1

parse4cn1 has some issue when working with Node JS and parse-server open source

The parse4cn1 library works well with parse.com but it has some issues when working with Node 4.3.2 and parse-server open source. For example, when calling the ParseUser.signup() function, the "Invalid key name" exception is always happened. I tried to debug and figure out that the ParseCommand object should add the ParseConstants.CONTENT_TYPE_JSON to its header in order to make it can work. I don't why because it still works without doing this with parse.com.
Another issue is the ParseQuery.find() is always failed when using the ParseQuery.whereContainedIn(). The server exception is "ParseException [code=102, msg=Improper encode of parameter, cause=null]". I guess this issue probably regarding the parameter has the json format in this case as well but I don't know to to resolve it. Any advice is appreciate. Sidiabale, do you have any advice? Thanks!
These problems are solved in version 3.0 of parse4cn1. Apparently, Parse Server is stricter with the need to specify the content-type header so code that previously worked with Parse.com does not work with Parse Server. I've addressed these issues in the aforementioned release. Try again with version 3.0 and let me know if you encounter any issues.

jvm argument with "&" fails

I am using a tc-server and I need to set different URLs based on environment. We have this practice of setting it as a jvm argument and using it in the application. When i try the property like below in setenv.sh, the server does not even come up. Below is the jvm arg that I am setting and the error. I hate to split the args just because its not working. Any idea what i need to do make it work as single arg with escaping characters are any?
It works fine if i don't have "&" in the value.
jvm.opts.28=-Dservice.rest.base.url=http://stg.sample.com?key=sample&value=sample
Could not load Logmanager
"com.springsource.tcserver.serviceability.logging.TcServerLogManager"
java.lang.ClassNotFoundException:
com.springsource.tcserver.serviceability.logging.TcServerLogManager
TC server version : 7.0.42.A.RELEASE
JDK: java 7
Have you tried putting single quotes around the URL?
jvm.opts.28=-Dservice.rest.base.url='http://stg.sample.com?key=sample&value=sample'
Looks like it works when you do that.
Can you briefly describe your environment in clear(Ex:what server, what version jdk)?
For the time being, this can shed some light on the real issue.
https://netbeans.org/bugzilla/show_bug.cgi?id=106300

Strange errors when linking to libmariadb

I'm currently develop an Objective-C library that links to the MariaDB C connector. I believe there is a problem with the library, though.
Every time I execute my code I get very strange errors on the console. The -(id)init method of my library calls mysql_init(NULL) to initialise the library but as soon as I return from -(id)init I get the following errors in the console:
Object 0x10643df70 of class XXX autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
Thing is, there is no multithreaded code being executed and if I run the same - (id)init without the call to mysql_init(NULL) the errors disappear. I believe the libmariadb library is causing these errors to appear. I don't get why though.
Do I need to build it with any special command line switches? Am I calling the right methods? I obviously used the MySQL online documentation as a guide.
Make sure you add this anytime you have a new thread:
#autoreleasepool {
//enter code here
}
Have you tried latest revision from launchpad?
Also try to build libmariadb with -DUNDEF_THREADS_HACK and
CMAKE_USE_PTHREADS:BOOL=OFF)
I was busy with other stuff for a while. I've since updated MariaDB to the latest version and, as far as I can tell, it works fine.