CLI can't create new block, I get ArgumentCountError: DateTime::__construct() expects at most 2 arguments, 4 given in file /Users/thibault/websites/landor-brandcenter-crest/packages/block_developer/src/BlockDeveloper/FieldType/FieldTypeList.php on line 66

Permalink Browser Info Environment
I have used your product in the past, but it's the first time on C5 v9. I'm just trying to start my project and create a new block.

zsh> php -v
PHP 8.0.13 (cli) (built: Nov 19 2021 21:19:43) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.13, Copyright (c) Zend Technologies

zsh> concrete/bin/concrete5 c5:block-developer -b xxx_navigation_panel -p xxx_package -s install

This fails with error message :

Enter your desired Block Name [XXX Navigation Panel]:
> Navigation Panel
Writing files to new Block Type directory...done.
Setting correct namespace for the Block Type controller.php file...done.
Setting name for the Block Type...done.
ArgumentCountError: DateTime::__construct() expects at most 2 arguments, 4 given in file /Users/thibault/websites/concrete5/packages/block_developer/src/BlockDeveloper/FieldType/FieldTypeList.php on line 66
Stack trace:
1. ArgumentCountError->() /Users/thibault/websites/concrete5/packages/block_developer/src/BlockDeveloper/FieldType/FieldTypeList.php:66
| array(1) {
| [0]=>
| string(60) "DateTime::__construct() expects at most 2 arguments, 4 given"
| }

2. DateTime->__construct() /Users/thibault/websites/concrete5/packages/block_developer/src/BlockDeveloper/FieldType/FieldTypeList.php:66
| array(4) {
| [0]=>
| string(63) "packages/block_developer/src/BlockDeveloper/FieldType/DateTime/"
| [1]=>
| string(15) "block_developer"
| [2]=>
| string(25) "packages/block_developer/"
| [3]=>
| string(8) "DateTime"
| }

3. Devoda\BlockDeveloper\BlockDeveloper\FieldType\FieldTypeList->getFieldTypes() /Users/thibault/websites/concrete5/packages/block_developer/src/BlockDeveloper/Block/BlockController.php:279
| array(0) {
| }

4. Devoda\BlockDeveloper\BlockDeveloper\Block\BlockController->processBlockDeveloperFields() /Users/thibault/websites/concrete5/packages/block_developer/src/BlockDeveloper/Block/BlockController.php:131
| array(1) {
| [0]=>
| string(8) "Array(1)"
| }

5. Devoda\BlockDeveloper\BlockDeveloper\Block\BlockController->__construct() /Users/thibault/websites/concrete5/packages/brandcenter_crest/blocks/brand_crest_navigation_panel/controller.php:13
| array(2) {
| [0]=>
| NULL
| [1]=>
| string(112) "/Users/thibault/websites/concrete5/packages/brandcenter_crest/blocks/brand_crest_navigation_panel"
| }

6. Concrete\Package\BrandcenterCrest\Block\BrandCrestNavigationPanel\Controller->__construct() [internal]:0
| array(1) {
| [0]=>
| NULL
| }

7. ReflectionClass->newInstanceArgs() /Users/thibault/websites/concrete5/concrete/vendor/illuminate/container/Container.php:921
| array(1) {
| [0]=>
| string(8) "Array(1)"
| }

8. Illuminate\Container\Container->build() /Users/thibault/websites/concrete5/concrete/src/Application/Application.php:445
| array(1) {
| [0]=>
| string(77) "\Concrete\Package\BrandcenterCrest\Block\BrandCrestNavigationPanel\Controller"
| }

9. Concrete\Core\Application\Application->build() /Users/thibault/websites/concrete5/packages/block_developer/src/BlockDeveloper.php:66
| array(1) {
| [0]=>
| string(77) "\Concrete\Package\BrandcenterCrest\Block\BrandCrestNavigationPanel\Controller"
| }

10. Devoda\BlockDeveloper\BlockDeveloper->getBlockTypeController() /Users/thibault/websites/concrete5/packages/block_developer/src_mv/8.2/Console/Command/BlockDeveloperCommand.php:128
| array(2) {
| [0]=>
| string(28) "brand_crest_navigation_panel"
| [1]=>
| string(17) "brandcenter_crest"
| }

11. Devoda\BlockDeveloper\Console\Command\BlockDeveloperCommand->handle() /Users/thibault/websites/concrete5/packages/block_developer/src_mv/8.2/Console/Command.php:35
| array(0) {
| }

12. Devoda\BlockDeveloper\Console\Command->execute() /Users/thibault/websites/concrete5/concrete/vendor/symfony/console/Command/Command.php:298
| array(2) {
| [0]=>
| string(41) "Symfony\Component\Console\Input\ArgvInput"
| [1]=>
| string(33) "Concrete\Core\Console\OutputStyle"
| }

13. Symfony\Component\Console\Command\Command->run() /Users/thibault/websites/concrete5/concrete/src/Console/Command.php:150
| array(2) {
| [0]=>
| string(41) "Symfony\Component\Console\Input\ArgvInput"
| [1]=>
| string(33) "Concrete\Core\Console\OutputStyle"
| }

14. Concrete\Core\Console\Command->run() /Users/thibault/websites/concrete5/concrete/vendor/symfony/console/Application.php:1005
| array(2) {
| [0]=>
| string(41) "Symfony\Component\Console\Input\ArgvInput"
| [1]=>
| string(46) "Symfony\Component\Console\Output\ConsoleOutput"
| }

15. Symfony\Component\Console\Application->doRunCommand() /Users/thibault/websites/concrete5/concrete/vendor/symfony/console/Application.php:299
| array(3) {
| [0]=>
| string(59) "Devoda\BlockDeveloper\Console\Command\BlockDeveloperCommand"
| [1]=>
| string(41) "Symfony\Component\Console\Input\ArgvInput"
| [2]=>
| string(46) "Symfony\Component\Console\Output\ConsoleOutput"
| }

16. Symfony\Component\Console\Application->doRun() /Users/thibault/websites/concrete5/concrete/vendor/symfony/console/Application.php:171
| array(2) {
| [0]=>
| string(41) "Symfony\Component\Console\Input\ArgvInput"
| [1]=>
| string(46) "Symfony\Component\Console\Output\ConsoleOutput"
| }

17. Symfony\Component\Console\Application->run() /Users/thibault/websites/concrete5/concrete/src/Foundation/Runtime/Run/CLIRunner.php:72
| array(1) {
| [0]=>
| string(41) "Symfony\Component\Console\Input\ArgvInput"
| }

18. Concrete\Core\Foundation\Runtime\Run\CLIRunner->run() /Users/thibault/websites/concrete5/concrete/src/Foundation/Runtime/DefaultRuntime.php:102
| array(0) {
| }

19. Concrete\Core\Foundation\Runtime\DefaultRuntime->run() /Users/thibault/websites/concrete5/concrete/dispatcher.php:45
| array(0) {
| }

20. require() /Users/thibault/websites/concrete5/concrete/bin/concrete5:85
| array(1) {
| [0]=>
| string(73) "/Users/thibault/websites/concrete5/concrete/dispatcher.php"
| }

Type: Ticket
Status: Resolved
dangrth
View Replies:
ramonleenders replied on at Permalink Reply
ramonleenders
Hi there,

Did you try this with PHP 7.x as well? I see you are using PHP 8 here and that introduced a few bugs here and there, not just for Add-Ons in general.

Kind regards
Ramon
dangrth replied on at Permalink Reply
dangrth
Yes, that was the problem, I downgraded PHP to 7.4.26 and it works. I'm on Concrete5 9 and since it supports officially PHP 8.0 I was using it. Does your addon support PHP 8.0 outside of the CLI ? Do you intend to support it ?
ramonleenders replied on at Permalink Reply
ramonleenders
Since this error is occuring, the Add-On does not currently support version 8 of PHP. I will be updating it. It will just be a matter of time. Also had to change quite a lot for Block Designer, which I released last week. If all these changes keep working as expected, I will port these over to Block Developer. There are some big changes in page selectors/file selectors, which got broken in the "Repeatable" field type. So if you're using the "Repeatable" field type with either the "Link" or "Image" or "File" field types within this repeatable, they may not work as expected.

It's on the TODO list, so stay tuned. Only have a given amount of time a day unfortunately haha.

Kind regards
Ramon
dangrth replied on at Permalink Reply
dangrth
Thanks. Do you have a rough ETA for a PHP 8 compatible version ? As long as I'm in development, I can juggle between versions, but I will have to freeze a PHP version when I go to production.
ramonleenders replied on at Permalink Reply
ramonleenders
Could be a month or two. Version 9 of ConcreteCMS still doesn't work 100% on PHP8 yet from last testings. So it's not a priority 1 for me as I want a fully tested, fully functional CMS. It's just too early stages for me right now. Therefore my own projects/clients are getting at the front of my TODO list.

Hope that makes sense. Also hope PHP8 will be 100% compatible any time soon, since PHP7 will be supported for (just) 9 more months.

Kind regards
Ramon
dangrth replied on at Permalink Reply
dangrth
Thanks. Yes, the "long term" support for PHP 7 was my main concern, that and increased performances, hence trying to use PHP 8. I noticed some rough edges with Concrete5 9 too, but the 9.0.2 release has correct quite a number of bugs.
Anyway, thanks for the information, I will monitor your releases.
ramonleenders replied on at Permalink Reply
ramonleenders
I did some additional fixes for Page/Link/Image field types in a Repeatable field type. In case you were using this, updating to 1.3.0 will fix these issues. Have yet to do the PHP8 update, but it's another step for version 9 of ConcreteCMS!

Kind regards
Ramon
ramonleenders replied on at Permalink Reply
ramonleenders
Also made a new release (1.3.1), which should be perfectly fine for PHP8. In case you get any more issues in PHP8, create a new support ticket so we can tackle individual bits and pieces.

Hope that gets you going again!

Kind regards
Ramon
dangrth replied on at Permalink Reply
dangrth
Thank you. I will do the update. However I have planned the move to PHP 8 in a few months, too many rough edges right now. So Concrete5 9 but PHP 7.4 until this feels stable enough.
ramonleenders replied on at Permalink Reply
ramonleenders
Makes perfect sense, exactly my thoughts. Since I imagine there may be others trying out PHP8 too, I fixed it so at least it works. Hope nothing else ain't broken, but anything can be fixed.

Happy developing :)

Kind regards
Ramon

concrete5 Environment Information

# Concrete Version
Core Version - 9.0.2
Version Installed - 9.0.2
Database Version - 20220114215506

# Database Information
Version: 5.7.34
SQL Mode: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

# Concrete Packages
Block Developer (1.2.4), Crest Brand 2022 (1.0.4), Debug Kit (0.9.5), Migration Tool (9.0.0)

# Concrete Overrides
None

# Concrete Cache Settings
Block Cache - Off
Overrides Cache - Off
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
Apache/2.4.46 (Unix) OpenSSL/1.0.2u mod_fastcgi/mod_fastcgi-SNAP-0910052141 mod_wsgi/3.5 Python/2.7.13 mod_perl/2.0.11 Perl/v5.30.1

# Server API
cgi-fcgi

# PHP Version
8.0.13

# PHP Extensions
bcmath, bz2, calendar, cgi-fcgi, Core, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, igbinary, imagick, imap, intl, json, ldap, libxml, mbstring, memcached, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, readline, Reflection, session, SimpleXML, soap, sockets, sodium, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, xsl, zip, zlib

# PHP Settings
max_execution_time - 30
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
memory_limit - 128M
post_max_size - 8M
upload_max_filesize - 32M
zend.exception_string_param_max_len - 15
ldap.max_links - Unlimited
mbstring.regex_retry_limit - 1000000
mbstring.regex_stack_limit - 100000
memcached.sess_lock_max_wait - not set
memcached.sess_lock_wait_max - 150
memcached.sess_server_failure_limit - 0
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
pgsql.max_links - Unlimited
pgsql.max_persistent - Unlimited
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5
unserialize_max_depth - 4096

Browser User-Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.