K
K
koninka2017-10-07 10:52:51
symfony
koninka, 2017-10-07 10:52:51

Trouble running a symfony project on OSx?

Hello!
I'm new to OSx and having problems with php 7.1 and SPL interfaces (I think with them). Every 2 or 3 requests to the symphony project (I use Apache) there are errors described below.
Error when spl_autoloader tries to load ParameterBag class:

Warning: class_implements(): Class /\.[^.]+\.twig$/ does not exist and could not be loaded

Stack trace:
1 in DebugClassLoader.php line 243
    2 at ErrorHandler->handleError('2', 'class_implements(): Class /\.[^.]+\.twig$/ does not exist and could not be loaded', '/Users/mtertishniy/sites/dvsota/vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php', '243', array('class' => 'Symfony\Component\HttpFoundation\ParameterBag', 'file' => '/Users/mtertishniy/sites/dvsota/vendor/composer/../symfony/symfony/src/Symfony/Component/HttpFoundation/ParameterBag.php', 'exists' => true, 'refl' => object(ReflectionClass), 'name' => 'Symfony\Component\HttpFoundation\ParameterBag', 'notice' => array(), 'len' => '8', 'ns' => 'Symfony\', 'parent' => false, 'parentInterfaces' => array('/\.[^.]+\.twig$/' => '1'), 'deprecatedInterfaces' => array(), 'interface' => '/\.[^.]+\.twig$/'))
    3 at class_implements('/\.[^.]+\.twig$/') in DebugClassLoader.php line 243
    4 at DebugClassLoader->loadClass('Symfony\Component\HttpFoundation\ParameterBag')
    5 at spl_autoload_call('Symfony\Component\HttpFoundation\ParameterBag') in Request.php line 247

Another weird error:
OutOfMemoryException in DebugClassLoader.php line 243:
Error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 140495632205216 bytes)

I tried to debug this error with var_dump variables that DebugClassLoader tries to load and crashes, and found that sometimes an invalid interface string is passed as an argument to the load method.
MhvAq.jpg
Tried to decode krakozyabary and got Countable.
Apache (httpd) and PHP 7.1 installed via brew.
PHP modules:
$ php -m
    [PHP Modules]
    bcmath
    bz2
    calendar
    Core
    ctype
    curl
    date
    dba
    dom
    exif
    fileinfo
    filter
    ftp
    gd
    gettext
    hash
    iconv
    imagick
    intl
    json
    ldap
    libxml
    mbstring
    mcrypt
    mysqli
    mysqlnd
    odbc
    openssl
    pcntl
    pcre
    PDO
    pdo_mysql
    PDO_ODBC
    pdo_sqlite
    Phar
    posix
    readline
    Reflection
    session
    shmop
    SimpleXML
    soap
    sockets
    SPL
    sqlite3
    standard
    sysvmsg
    sysvsem
    sysvshm
    tokenizer
    wddx
    xdebug
    xml
    xmldiff
    xmlreader
    xmlrpc
    xmlwriter
    xsl
    yaml
    zip
    zlib
    
    [Zend Modules]
    Xdebug

How to solve this problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
koninka, 2017-10-21
@koninka

Finally I figured it out! The problem is in php itself. Here is a bug from the official php bug tracker https://bugs.php.net/bug.php?id=74015
In short, this behavior is present in all php versions older than 7.1 (inclusive) and will be fixed only in version 7.2
P.S. Many thanks to everyone who said that the problem is in memory_limit, I could not have done it without you

S
Stanislav, 2017-10-10
@stascer

Php ran out of memory. Need to expand memory_limit.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question