krakjoe / pthreads-autoloading-composer

An example of how to use composers autoloader in conjunction with Pools
29 stars 4 forks source link

Fatal error when following instructions: php auto.php #1

Open jdchmiel opened 8 years ago

jdchmiel commented 8 years ago

I have been banging my head against the wall trying to get composer autoloading working in a Magento project. I was excited to find this example / tutorial to build from. After trying to copy the logic to my code with no success - I get seg faults as soon as I change: /* override default inheritance behaviour for the new threaded context */ public function start(int $options = NULL) { return parent::start(PTHREADS_INHERIT_ALL ); } to /* override default inheritance behaviour for the new threaded context */ public function start(int $options = NULL) { return parent::start(PTHREADS_INHERIT_NONE ); } I decided to try this example verbatim. I get an error as follows:

root@254e6ba419d7:/opt/threading# php auto.php

Warning: Declaration of Auto\Autoloader::start() should be compatible with Thread::start(int $options = >NULL) in /opt/threading/src/Auto/Autoloader.php on line 17

Fatal error: Class Auto\Task cannot extend from interface Collectable in >/opt/threading/src/Auto/Task.php on line 22 root@254e6ba419d7:/opt/threading#

Obviously the warning I had already come across and fixed above by adding the type hints, but I did not even bother looking any farther into the Fatal as I have veered way too far off task now.

jdchmiel commented 8 years ago

php -v PHP 7.0.2 (cli) (built: Jan 12 2016 15:00:50) ( ZTS ) Copyright (c) 1997-2015 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

root@254e6ba419d7:/opt/threading# php -i "phpinfor();" | grep -C3 pthreads /usr/local/etc/php/conf.d/docker-php-ext-mongodb.ini, /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini, /usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini, /usr/local/etc/php/conf.d/docker-php-ext-pthreads.ini, /usr/local/etc/php/conf.d/upload-size.ini

PHP API => 20151012

Revision => $Id: 547e93e58ead98dbbb1d44dbaf86513eb08ace3f $

pthreads

Version => 3.1.5

jdchmiel commented 8 years ago

changing line 22 to: class Task extends \Threaded { seems to fix it. Found that by the tip where https://github.com/krakjoe/pthreads/issues/548 says the docs are out of date.