StoutLogic / acf-builder

An Advanced Custom Field Configuration Builder
GNU General Public License v2.0
790 stars 61 forks source link

WP-CLI Error : Segmentation fault #179

Open grzesiek1owline opened 10 months ago

grzesiek1owline commented 10 months ago

I find some problem with specific ACF Fields structure. I use ACF Flex Builder and when i created structure like this:

<?php

namespace App\Fields;

use App\Fields\Partials\PageBuilder;
use Log1x\AcfComposer\Field;
use StoutLogic\AcfBuilder\FieldsBuilder;

class CarrersPage extends Field
{
    /**
     * The field group.
     *
     * @return array
     */
    public function fields()
    {
        $carrerspage = new FieldsBuilder('carrerspage', ['title' => 'Oferty pracy']);

        $carrerspage
            ->setLocation('page_template', '==', 'template-carrer.blade.php')
            ->setGroupConfig('hide_on_screen', [ 'the_content', 'block_editor' ]);

        $carrerspage
            ->addTab('content', ['label' => 'Zawartość strony'])
            ->addTab('builder-tab', ['label' => 'Struktura strony'])
                ->addFields($this->get(PageBuilder::class))
        ;

        return $carrerspage->build();
    }
}
<?php

namespace App\Fields\Partials;

use Log1x\AcfComposer\Partial;
use StoutLogic\AcfBuilder\FieldsBuilder;

class PageBuilder extends Partial {
  /**
   * The partial field group.
   *
   * @return \StoutLogic\AcfBuilder\FieldsBuilder
   */
  public function fields() {
    $pageBuilder = new FieldsBuilder( 'page_builder' );

    $pageBuilder
      ->addFlexibleContent( 'builder', [ 'label' => 'Sekcje strony', 'button_label' => 'Dodaj sekcje' ] )
      ->addLayout( $this->get( IconList::class ) )
      ->endFlexibleContent();

    return $pageBuilder;
  }
}
<?php

namespace App\Fields\Partials;

use Log1x\AcfComposer\Partial;
use StoutLogic\AcfBuilder\FieldsBuilder;

class IconList extends Partial {
  /**
   * The partial field group.
   *
   * @return \StoutLogic\AcfBuilder\FieldsBuilder
   */
  public function fields() {
    $iconList = new FieldsBuilder( 'icon_list', [ 'label' => 'Lista ikon' ] );

    $iconList
      ->addGroup( 'icon_list', [ 'label' => 'Lista ikon' ] )
          ->addSelect( 'bg-color', [ 'label'         => 'Kolor tła',
                                     'choices'       => [ 'bg-white' => 'Biały', 'bg-light-300' => 'Szary' ],
                                     'default_value' => 'white'
          ] )
          ->addWysiwyg( 'title', [ 'label'        => 'Tytuł',
                                   'required'     => 1,
                                   'media_upload' => 0,
                                   'delay'        => 1,
                                   'tabs'         => 'all',
                                   'wrapper'      => [ 'width' => '50' ]
          ] )
          ->addRepeater( 'list', [ 'label' => 'Lista ikon', 'button_label' => 'Dodaj ikonę', 'layout' => 'row' ] )
              ->addImage( 'icon', [ 'label'         => 'Ikona',
                                    'return_format' => 'id',
                                    'preview_size'  => 'thumbnail',
                                    'library'       => 'all',
                                    'mime_types'    => 'svg'
              ] )
              ->addText( 'text', [ 'label' => 'Tekst' ] )
          ->endRepeater()
      ->endGroup();

    return $iconList;
  }
}

I cant use wp-cli, because i have segmentation error or blank response. If i remove SELECT FIELD from GROUP in Icon List - wp-cli works fine.

Often i have this problem when i have Select Field in Group.

I have the same problem when i have php error, like no ';' on end of file.

OS: MacOs Catalina Ubuntu 21

PHP 8.0 8.1

stevep commented 10 months ago

I'm not sure I can help much, but does appending --debug to the wp cli call help provide any useful error messages?