Comments (16)
Ok, thought I'd let you know I've seen the report, will have a look in the next few days.
from pthreads.
I am still looking at this, we have a couple of bugs that are related to the same things and I'm trying to find a common solution ...
from pthreads.
Thank you good luck :)
from pthreads.
Well I've cleaned right up and the bug is still there ... I'll keep looking ...
It's not really of the highest priority, on account of notices shouldn't be getting displayed in production ... I know it shouldn't be there, but it's not a show stopping thing ...
from pthreads.
Also the same problem with static private property.
from pthreads.
Ok, thanks for the heads up ...
I have some more new ideas, I'll keep looking ...
from pthreads.
Shouldn't you define it first before trying to access it?
from pthreads.
Why?
from pthreads.
@shoghicp, it's not that simple, see the var is actually defined, but it is unset. if you run the same code outside of pthreads or change the access modifier you will see it generate no error ... I have not got to the bottom of this yet .... I hadn't forgotten, how could I ... thorn in my side ....
from pthreads.
Just to keep you all updated, I come back to this every time I have the time and energy to get involved in those parts of pthreads where I think the bug originates ... needless to say I haven't yet found the solution :(
The official workaround for now is just to declare members as public and everything will work as expected, which is crappy I know, I do hope to find out what's doing it, it's got to be something relatively simple that I am overlooking ...
from pthreads.
If you ensure the child class calls the parents method it doesn't output the Notice. PHP docs state that child classes overriding parent definitions of a method won't subsequently call the method; the extended class has to.
"Note: Parent constructors are not called implicitly if the child class defines a constructor. In order to run a parent constructor, a call to parent::__construct() within the child constructor is required. If the child does not define a constructor then it may be inherited from the parent class just like a normal class method (if it was not declared as private)."
and
"When an extending class overrides the parents definition of a method, PHP will not call the parent's method. It's up to the extended class on whether or not the parent's method is called. This also applies to Constructors and Destructors, Overloading, and Magic method definitions."
So:
<?php
class parentClass {
private $var;
public function __construct() {
echo $this->var;
}
}
class childClass extends parentClass {
public function __construct(){
parent::__construct();
}
}
class clientThread extends Thread {
public function run() {
$objChild = new childClass();
}
}
$objClientThread = new clientThread();
$objClientThread->start();
?>
Works.
from pthreads.
Run it outside of pthreads ...
<?php
class parentClass {
private $var;
public function __construct() {
echo $this->var;
}
}
class childClass extends parentClass {
}
$class = new childClass();
from pthreads.
I would expect PHP to output an error here, mainly because $var is private and implicitly called through the parent construct by invoking the child - but I see where your coming from because the child class doesn't explicitly try to invoke the var. This is brainstaking.
In either test case changing the var scope to protected doesn't generate the notice.
Could it be a PHP bug?
edit: Though I am tired so if I sound a** backwards there is a good chance I am.
from pthreads.
It feels internal to pthreads ... A side effect of the voodoo being conducted here ... I'll get it eventually most likely ... With public modifier no notice from original example either ... I've spent many hours on it ... Lastly grrrrr
from pthreads.
Well at least there is some talk and work-around-ish chatter here. There are PHP bugs going back years that haven't been fixed so as long as its not completely breaking faces I wouldn't be to worried about :D
from pthreads.
I have included a test for this one based on the original broken example ... pretty glad to say goodbye to it :)
from pthreads.
Related Issues (20)
- Volatile isn't thread safe HOT 7
- Halting development of pthreads for 7.4 HOT 1
- Lost resource.
- Pool Completed Threaded Tasks Count Progress.
- Can not enable extension pthreads on PHP 7.2.15 Windows 10 Enterprise (x64) HOT 3
- sudo pecl install pthreads /usr/local/bin/pecl: 28: exec: /usr/local/bin/php: not found
- PHPIZE? HOT 1
- How to get unique php-extension instance for each php thread? HOT 6
- PHP 7.1.23 compile failed HOT 3
- Migrating to Pararell and Differences between these two extensions. HOT 1
- zend_mm_heap corrupted without sockets
- php-zts with pthreads not allocating tasks to free workers HOT 3
- Serialization of 'Closure' is not allowed in Worker HOT 5
- PHP7.4 HOT 2
- [BUG] PHP7.2 broken after this commit HOT 6
- Cannot install via pecl HOT 2
- Memory "leak" when passing large payload tasks to pool HOT 2
- windos load pthread.dll failed HOT 1
- Make not working HOT 1
- memory leak when pthreads in pthreads HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pthreads.