« first day (1746 days earlier)      last day (3196 days later) » 

4:00 PM
this will returns array
(
[0] => Status=0
[1] => JOB_ins37_14380743615938
[2] => ins37_14380743615939
[3] => ins37_14380743615940
)
 
@Prakash Ok, well then you're most of the way there.
 
But I am expecting
Array();
sorry wait
Associative array
 
@Prakash That you'll have to make yourself from the result explode() gives you.
 
[Status] => 0
[job] => JOB_ins37_14380743615938
[key1] => ins37_14380743615939
[key2] => ins37_14380743615940
@Trowski How to do like this
Please explain with example
Here [Status] => 0,
[job] => JOB_ins37_14380743615938
must be only one but [key1] => ins37_14380743615939
[key2] => ins37_14380743615940
key1, key2...may be one or more
@Trowski can you understand my problem or I can explain it little bit more
 
4:25 PM
// is not shouldn't be valid as a URI path string, correct? Specifically, should I collapse them or error?
 
I need to check in the first of all of my pages for a cookie, if exist, then user is logged, else he is not logged, so should I write taht if-else in the first of all of my pages ?
there is not a better approach ?
 
@DanLugg I would say error
@Sajad Use PHP sessions... authoring a cookie on the client is trivial to do.
 
@Orangepill I use of session, bud i have a checkbox named 'remember me'.
I want to know how always should I check cookie in the all of pages ?
 
cookie is an authentication method
just like username+password is, or openID is
 
4:43 PM
@tereško my question is: I need to check in the all of pages for cookie! how I do that ?
 
@ircmaxell btw re: stackoverflow.com/a/12202218/2224584 -- did you ever get any traction on these patches?
 
should I write if-else in the first of all pages ?
 
@ScottArciszewski too many test fails
 
@ircmaxell Want your opinion on something: How do you feel about variadic functions in an API for passing arguments to a callback that is invoked at a later time?
Example: timer(float $interval, callable $callback, array $args) vs timer(float $interval, callable $callback, ...$args)
 
no opinion
well, not quite. Depends on how it's normally called (static args or dynamic args)
if dynamic, I prefer the first. If static I prefer the second
 
4:47 PM
@DanLugg Yes, it's not valid: tools.ietf.org/html/rfc3986#section-3.3 // is for protocol relative URIs.
 
@ircmaxell This is a function user would be calling in their code.
 
again
if you normally write timer(100, $cb, 1, 2, 3) then great. If you commonly write $args = comuteArgs(); timer(100, $cb, $args), then that
 
timer(100, bind($cb, 1, 2, 3))
 
@Orangepill why it is trivial ? when I login in the stackoverflow, For next time I don't need to login again. because it creates a cookie in my laptop. right ?
 
@ircmaxell Ok, now I see your point. The array would have to be manually created by the user, so the variadic makes more sense.
 
4:52 PM
@NikiC or that
 
@NikiC I'm not sure if that's better than timer(100, $cb, [1, 2, 3])
It is reusable though, that I like.
 
@Trowski I think it is. There is no reason why this should be supported in every API accepting a callback.
 
@sajad Because it's possible to send cookies from the client without ever authenticating into your site, you need a server side session to be able to authenticate the request
 
Even if you don't have an explicit bind function you can always easily replicate it with a closure
 
@NikiC Well if my function was timer($interval, callable $cb, ...$args), you could call it with timer(100, bind($cb, 1, 2, 3)).
 
4:56 PM
@ircmaxell if i use sha256 and salt in environment variable or use sha256 and different salt for every password and all salts are stored in same database, which is more safer? although i use BCrypt
 
@Orangepill ah I see, then I need just Check the session ! alright. thanks
 
@Trowski I think for timer in particular doing the ...$args is okay
As it's essentially a periodic call_user_func ^^
 
@NikiC It's a pain to support in 5.5, but that will go away soon enough anyway.
 
@NeelIon a salt is not a salt if it's shared. By the very definition of a salt it must be unique per hash.
 
@NeelIon The salt is part of the output of bcrypt and can be stored in the database. The salt should be different every time a hash is created.
 
5:04 PM
@ircmaxell shh, he's a real programmer, unlike you.
also, on an unrelated note: Xcom is evil
 
@Trowski so why we need salt if we store salt in database? what if someone hack database and get all salts? We hash passwords to prevent hackers from getting passwords in plain text, if they hack database right?
 
@NeelIon Knowing the salt doesn't reduce the amount of time it would take to find the password from the hash.
 
@ircmaxell any examples of performance impact of Optimizer?
 
dude, I just wrote it like 10 minutes ago
also, it only executes the optimizations on a CFG, it doesn't actually generate optimized PHP code
 
5:15 PM
just curious...
 
now, off to work on the next package
php-compiler
 
@neelion unique salts thwart rainbow tables... if forces the attacker to brute force each password individually
 
Morning fine people of room eleven
 
morning
 
@Orangepill o/
 
5:19 PM
What about the other, non-fine people who form the majority population? What about me????
 
@PeeHaa morning
 
@PeeHaa Morning o/
 
@NeelIon @Trowski \o
Oh wait @DaveRandom is also here :(
<3
 
I'm omnipresent
And omnipotent
No, sorry, I got that wrong
Impotent, that's what the doctor said
I knew it was something like that. They sound more or less the same so I assume they mean more or less the same thing.
 
That how I always translate stuff I don't fully understand. What could possibly go wrong?
 
5:31 PM
I wish this could be reopened just from comical value.
 
5:46 PM
not sure about nw, when is it @DaveRandom ?
 
@NikiC considered using a private field rather than $self in scalar_objects? wouldn't php complain about methods not being compatible to implemented interfaces/abstract methods?
like:
interface A{ function substr($from,$len); }
class MyStr implements A{ function substr($self, $from, $len){} }
 
@RonaldUlyssesSwanson How is that related?
 
like i have an interface Map with the method getKeys() with no params, if i implement it, i will have to write getKeys($self), correct? which makes it incompatible to the interface
 
Yes
There's no point implementing an interface
It won't satisfy an instanceof or typehint anyway
 
5:55 PM
I may be doing something terribly stupid for the sake of a "helpful" API.
I've made a reusable builder, that dumps the built object via a terminating method, and resets it's own state.
It feels so good and bad at the same time.
Opinions, criticism, and tomatoes welcome.
 
don't like that @DanLugg :P
not sure why you need this, either?
 
Alternatively, I could make the builder immutably fluent, and have it clone itself (following the quasi-defacto with* convention) in the builder methods.
 
If I fork a package and want to submit it to packagist, how do I update 'authors' section? Should I simply add my name in addition to the original authors?
 
function withBar($bar)
{
    $copy = clone $this;
    $copy->bar = $bar;
    return $copy;
}
 
but why? a builder should be mutable
 
6:02 PM
I need it because I'm trying to distill down the creation process of a rich object model I've built.
And question to question: why shouldn't a builder be immutable?
Achieves the same effect, and in this case would cure the seemingly hackish finally-reset.
 
@Moon Yeah that is what I would do. If you also at least changed some stuff :P
 
@DanLugg why the built instance gets returned by a setter method?
 
@RonaldUlyssesSwanson Well, that was a concern I had about a muddy API. I could have getThing(), but in the context of this domain the qux property is sort of terminating when set; it's semantically the last thing needed to be set in a given Thing
 
public function withQux($qux){
$this->qux = $qux;
}

public function build(){
return new Thing($this->foo, $this->bar, $this->qux);
}
 
It just seemed superfluous to this case... would it be too confusing without it?
 
6:08 PM
yes, because i have to know that withQux must be called last
 
@RonaldUlyssesSwanson But is that really no different than build?
What about ->build($qux) ?
 
@PeeHaa Thank you!
 
@DanLugg it's different because build() shouldn't clear the builder's state
@DanLugg i guess that would be less confusing
 
@RonaldUlyssesSwanson Okay, but reusability then comes down to state reset, or immutable cloning
Arguably, one could keep new-ing builders, but that seems further superfluous.
[(new Builder)->..., (new Builder)->...]
The main issue here being, that I'm dealing with creating collections of things; not just one.
If it were just one, I wouldn't care about the builder state afterward.
 
@DanLugg example?
 
6:16 PM
Well, as exampled:
return [
    $builder->...
    $builder->...
    $builder->...
];
 
hm i think i got the problem, let me think
@DanLugg
$defaultBuilder = new SomeBuilder();
$defaultBuilder->setA(1);
$defaultBuilder->setB(2);
$defaultBuilder->setC(3);
return [
    $defaultBuilder->clone()->setB(22)->build()
    $defaultBuilder->build()
    $defaultBuilder->clone()->setA(11)->setC(33)->build()
];
forgot the ,
i would use something like that, probably
 
yes, you really do have a problem
I get a feeling that your "builder" is larger than the instance which it creates
 
@tereško i don't think @DanLugg is doing all that for something very small
 
@RonaldUlyssesSwanson you haven't met very many programmes , have you
 
6:30 PM
 
lol
old but gold
 
true that.
Should I use fully namespaced class names in docblocks or do docblock parsers take current namespace into account?
 
@Orangepill they can understand aliases, yes (at least so do phpstorm and apigen, not sure about phpdocumentor and other stuff)
 
@tereško I wish it were.
 
then there might be a deeper problem :)
 
6:36 PM
^^
The issue is that the "builder" is like a facade. It contains factories/parsers that take the scalar (or simpler) arguments passed to the builder methods, and create the complex rich tree of objects that the built object itself is composed of.
So $builder->withFoo('abc')->withBar('def')->withQux('ghi') is doing much more than just setting those "properties" on the built object.
@tereško ^
 
some actual code @DanLugg ? now i'm being curious about it
 
In progress and missing bits. I'll gist it at some point.
 
@DanLugg how is the builder returning what it's building?
 
a/w DanLugg not sure what actual oop experts would think of that but builder is not more than just a factory method split into several methods. it doesn't have to validate or perform anything. it should just collect data that would later be passed to the actual factory method (that means that a builder should have as dependency a factory)
so new ThingBuilder(new SomeThingFactory()) or $builder->build(new SomeThingFactory)
 
@Orangepill The terminating method passes the builder state off to the parsers/factories and returns the result.
 
6:49 PM
@tereško makes sense? ^
 
@DanLugg so there would be a ->getBuiltThing() at the end of the call chain?
 
@RonaldUlyssesSwanson My case is the former; $builder = new Builder(new Factory, new Parser, ...);
 
@Orangepill yes
 
@Orangepill Well, I've kinda gone with an implicit terminator, but I could switch it up to getBuiltThing()
$o = $b->withA()->withB()->withC(); // withC is the implicit terminator/returner
 
@DanLugg That makes sense. What's the use case?
 
6:53 PM
i would use with*() methods only for immutable stuff, for a builder set*() fits better
 
@RonaldUlyssesSwanson no it doesn't make sense, but @DanLugg told enough for me to understand, that it would require me to actually know the project for any of it to make sense
 
@tereško why is that wrong, then?
 
@RonaldUlyssesSwanson in time you will realize that treating every case like wizard form ivory tower dispatching justice is a very naive approach
4
@RonaldUlyssesSwanson I am saying that I have no idea whether it is wrong
 
yes looking at the code would help understanding
 
@tereško that … from you … gives me … hope
because in the past you sure sounded like one of those wizards
progress!
 
6:57 PM
@Gordon you might be in dire need of visiting this page
 
@tereško I dont go to reddit. I value my sanity.
 
I can link you to phpclasses or sitepoint then
 
@Orangepill Cleaner API than:
$p1 = FooParser();
$f1 = FooFactory($p1);
$f2 = BarFactory(some, other, params);
// ...
$object = $f1->create($f2->create(['f', 'o', 'o']), $f3->parse('bar', $p4), ...);
 
@DanLugg are there all kinds of values, or are dealing with a list of know configurations?
 
@tereško I was asked to write articles for SitePoint, but I actually am unaware of any reputation they may have.
Is that something I'd want to do, or should I stay away?
 
7:02 PM
@Trowski the site itself is ok .. forum is a different beast
 
@tereško This is something deferred to library consumers/extensions, so it's mostly unknown.
 
@DanLugg new Parser probably shouldn't be used inside the builder, what does it do?
 
@tereško Ok, never visited the forum.
 
@tereško Hence, "facade" :-P
 
It seemed like a good site with quality information otherwise.
 
7:03 PM
@RonaldUlyssesSwanson The parser isn't used inside the builder. The parser is used inside the factory. The factory is used inside the builder.
 
@DanLugg well .. shit, because isolating presets would give a nice way to simplify
 
@DanLugg Definitely cleaner ...
 
@tereško Yea, un?-fortunately the presets are just null
 
@DanLugg oh ok, that's fine :P
 
And in the case of null cases (or missing) the resulting object graph uses NullObjects and other insanity strategies to preserve polymorphism without conditions.
 
7:05 PM
@Orangepill "cleaner" isn't always the same as "easier to understand 3 months later"
 
I'll just keep running with what I've got going, hopefully won't have to throw it at the wall.
 
@teresko I know that from experience but I think that is not the case here
 
Immutable fluent builder so the original reference remains state-empty. Arguably, if one did want defaults, they could just $b = $b->withFoo('foo'), and use the modified instance.
Hopefully the cloning won't murder perf, but I'll burn that bridge when I get to it.
 
@tereško BUILD A BIGGER BRIDGE!
 
7:09 PM
basically, yes
 
;-)
I can see it now; hardware perf requirements to run a PHP application.
3.2GHz required (4.5GHz recommended)
 
That'd rule out most of India then
 
Unless you mean all of India as a distributed engine.
 
and GTX 660ti or newer
 
Exclusively for CUDA
 
7:12 PM
.. or you could do that
 
lol, I thought that's what you meant :-P
 
that reminds me: @ircmaxell, have you tried running php site on GPU? (because you actually might be one person in this chatroom who has)
 
I wonder what the impact on the outsourcing industry would be if stack overflow blocked all ip's originating in India.
 
devastating
 
@Orangepill The impact would be proxies flourishing.
 
7:15 PM
@DanLugg you need access to superuser.com to learn how to use a proxy
3
 
@DanLugg Who would know how to set up the proxy if they couldn't get to any of the StackExchange sites
 
in HTML / CSS / WebDesign, 2 mins ago, by rlemon
> If electricity always follows the path of least resistance, why doesn't lightning only strike in France?
 

Ba-dum tss

1 min ago, 1 minute total – 5 messages, 3 users, 2 stars

Bookmarked just now by Dan Lugg

 
@PeeHaa ahah
 
in HTML / CSS / WebDesign, 54 secs ago, by rlemon
> If light travels faster than sound, then why can I hear my girlfriend bitching at me before I see what I've done wrong
 
QUICK! PUT ME OUT!
THE PAIN! OHH THE AGONY OF IT ALL!
 
Oh wait, no he isn't. He's casting a shadow.
 
lol
 
GET READY, @RLEMON IS ABOUT TO DROP THE BASS SHADOW.
 
7:21 PM
in HTML / CSS / WebDesign, 7 mins ago, by rlemon
> My girlfriend says she needs time and distance. Is she calculating velocity?
 
@rlemon Where are you getting those from?
 
/r/shittyaskscience
best sub on reddit
 
> How come people never use Morning Wood for cabinets, floors, etc, when it is so abundant?
 
> If Jesus died for our sins, who died for our cos and tans?
that one always gets me
 
7:27 PM
Maybe Noah, after he finished building the arc :-P
 
@tereško no. The thought has crossed my mind, but GPUs are excellent at high-parallel tasks where every thread does the same operation on different data. PHP doesn't fit that model
 
hmm ... you have a point there
 
Of course you thought about it... :P
The term mad scientist comes to mind with some of the stuff you do :D
 
@PeeHaa and you're just mad.
 
7:40 PM
So true
 
7:55 PM
Hi guys, need help with Drupal, any one here with expertise?
 
class Wizard
{
    private $state;
    public function __construct($state) { $this->state = $state; }
    public function step1()
    {
        return new class($this->state)
        {
            private $state;
            public function __construct($state) { $this->state = $state; }
            public function step2()
            {
                return new class($this->state)
                {
                    private $state
                    public function __construct($state) { $this->state = $state; }
I may have just discovered a horrible pattern.
Although, with traits, I could see this being used to make a context-aware fluent interface for things like query builders.
 
@DanLugg The name "Wizard" seems very accurate...
 
> Although, with traits, I could see this being used to make a context-aware fluent interface for things like query builders.
 
PBA could != should :-P
 
8:11 PM
Today on campus I heard a guy telling a girl about some JavaScript program he was looking at that was just so terrible and she was laughing a lot. And then she asked, "So I learned a bit of JavaScript and have heard quite a few people say bad things about it; why is that?"
It was cute.
I hope they become a couple.
JavaScript will be their bond.
 
^^ Wedding plans already
 
@ScottArciszewski Yeah, we should totes check for stuff like that!
 
8:27 PM
@SammyK I'd like to layout some sort of plan and recommendations for when and what type of exceptions to throw from internal functions. Have you looked at this at all?
 
@DaveRandom Booked a hotel. gardenshotelmanchester.com. £164 for two nights. Still expensive but location is okay... I think. Close to venue and having my own room is nice.
 
@Trowski apart from the 'lack of randomness' one currently being discussed - what ones were you thinking of?
 
@Danack, you coming to NW?
 
@Fabor Need to acquire a job to have the funds to pay for it.
 
@Danack I'd like to address Anatol's concerns here: news.php.net/php.internals/87310 so that the random functions can throw exceptions.
 
8:31 PM
@Danack Or submit a paper -_-
 
Who'd be stupid enough to want to speak at a conference ?
 
@Danack Slowly raises hand
 
He's poking fun as @Danack just spoke at a conference the other week. His first :P
 
Ah, cool :-)
 
What conference?
 
PHP_FUNCTION(foo) {
    long v1;
    ZEND_PARSE_PARAMETERS_START(1, 1)
        Z_PARAM_LONG(v1)
    ZEND_PARSE_PARAMETERS_END();
    zend_string* v2;
    zend_string* v3;
l1:
    v2 = zend_string_init(" .:,;!/>)|&IH%*#", 16, 0);
    if (v1 < 0 || v1 >= Z_STRLEN_P(v2)) {
        v3 = ZSTR_EMPTY_ALLOC();
    } else {
        v3 = zend_string_init(Z_STRVAL_P(v2) + v1, 1, 0);
    }
    PHPWRITE(Z_STRVAL_P(v3), Z_STRLEN_P(v3));
}
^^ does that look right?
function foo(int $offset) {
  $b = " .:,;!/>)|&IH%*#";
  echo $b[$offset];
}
 
@ircmaxell It looks like C99 :P
 
yes, that was intentional
 

King of PHP

Oct 29 '14 at 0:35, 2 minutes total – 2 messages, 2 users, 2 stars

Bookmarked Oct 29 '14 at 7:46 by easwee

2
 
@ircmaxell ZSTR_LEN(v2) instead of Z_STRLEN_P(v2)
Same with val
@ircmaxell And before using zend_string_init it could check whether CG(one_char_string) has it
 
8:46 PM
you mean before using ZSTR_EMPTY_ALLOC()?
 
@ircmaxell Before creating the single-character string
It depends on opcache (why?!?)
 
huh?
where does it depend on opcache?
 
@ircmaxell I mean CG(one_char_string)
Which is really not something that should depend on opcache...
 
where am I using CG(one_char_string)?
 
@ircmaxell You aren't. You should be using it ^^
 
8:48 PM
I'm using CG(empty_string)
Ohhhhh
I got ya
 
:D
 
PHP_FUNCTION(foo) {
	long v1;
	ZEND_PARSE_PARAMETERS_START(1, 1)
		Z_PARAM_LONG(v1)
	ZEND_PARSE_PARAMETERS_END();
	zend_string* v2;
	zend_string* v3;
l1:
	v2 = zend_string_init(" .:,;!/>)|&IH%*#", 16, 0);
	if (v1 < 0 || v1 >= ZSTR_LEN(v2)) {
		v3 = ZSTR_EMPTY_ALLOC();
	} else if (CG(one_char_string)[ZSTR_VAL(v2)[v1]]) {
		v3 = CG(one_char_string)[ZSTR_VAL(v2)[v1]];
	} else {
		v3 = zend_string_init(ZSTR_VAL(v2) + v1, 1, 0);
	}
	PHPWRITE(ZSTR_VAL(v3), ZSTR_LEN(v3));
}
there you go
 
yay
now only the notice is missing :)
and maybe an UNEXPECTED annotation
and a zend_string_release (or two)
And of course it would be better if a constant string that is not used as a zend_string would be kept as a string constant. Or at least allocated only once in RINIT
 
everything there is easy except for zend_string_release
 
sounds like you're going to have some fun :)
 
9:26 PM
array(2) {
  ["php_compiled_136336783.h"]=>
  string(772) "#ifndef PHP_COMPILED_136336783_H

#define PHP_COMPILED_136336783_H 1
#define PHP_COMPILED_136336783_VERSION "1.0"
#define PHP_COMPILED_136336783_EXTNAME "compiled_136336783"

#include <stdint.h>

#ifdef ZTS
#include "TSRM.h"
#endif

ZEND_BEGIN_MODULE_GLOBALS(compiled_136336783)
    zend_string* string_constants[1];
ZEND_END_MODULE_GLOBALS(compiled_136336783)

#ifdef ZTS
#define COMPILED_136336783_G(v) TSRM(compiled_136336783_globals_id, zend_compiled_136336783_globals *, v)
@NikiC ^^
still missing a notice, and a zend_string_release
 
What are you working on? Recki?
 
@ircmaxell Missing a cast to unsigned char
Otherwise you might end up indexing negatively
 
PHP_FUNCTION(foo) {
	long v1;
	ZEND_PARSE_PARAMETERS_START(1, 1)
		Z_PARAM_LONG(v1)
	ZEND_PARSE_PARAMETERS_END();
	zend_string* v2;
	zend_string* v3;
l1:
	v2 = COMPILED_1147104661_G(string_constants)[0];
	if (v1 < 0 || v1 >= ZSTR_LEN(v2)) {
		v3 = ZSTR_EMPTY_ALLOC();
	} else if (CG(one_char_string)[(unsigned char) ZSTR_VAL(v2)[v1]]) {
		v3 = CG(one_char_string)[(unsigned char) ZSTR_VAL(v2)[v1]];
	} else {
		v3 = zend_string_init(ZSTR_VAL(v2) + v1, 1, 0);
	}
	PHPWRITE(ZSTR_VAL(v3), ZSTR_LEN(v3));
fixed
@bwoebi nah, a new project. I was going to revive recki for this, but realized that the IR I was using was way too primitive for what I'd need here. So I'm just starting over (not bad for an hour's work)
 
9:54 PM
Can someone explain a practical use of oop PHP in a real life system?
 
@Matthcw No, because the question is horrible. What are you actually trying to accomplish?
 
I want to make a simple social network
But don't think that oop would play a big part ini t
in it
And if it did, it would be only very simple
 
PHP_FUNCTION(foo) {
	long v1;
	ZEND_PARSE_PARAMETERS_START(1, 1)
		Z_PARAM_LONG(v1)
	ZEND_PARSE_PARAMETERS_END();
	zend_string* v2;
	zend_bool free_v2 = 0;
	zend_string* v3;
	zend_bool free_v3 = 0;
	long v4;
	zend_string* v5;
	zend_bool free_v5 = 0;
l1:
	v2 = COMPILED_841338424_G(string_constants)[0];
	if (v1 < 0 || v1 >= ZSTR_LEN(v2)) {
		v3 = ZSTR_EMPTY_ALLOC();
	} else if (CG(one_char_string)[(unsigned char) ZSTR_VAL(v2)[v1]]) {
		v3 = CG(one_char_string)[(unsigned char) ZSTR_VAL(v2)[v1]];
	} else {
 
Like getting instances of classes and changing the variable name
 
^^ should fix the free issue. Though isn't pretty /cc @NikiC
 
9:56 PM
@Matthcw There's nothing simple about social networking. OOP is one way to deal with complexity.
 
@ircmaxell That's too many frees
last three are too much
 
Charles, I'll be back but with a social network and I will tell you some stuff later.
Good bye for now.
 
@NikiC except they are dead code, so I really don't care
 
@NikiC they're after a RETURN_STR(), so ignored.
 
@bwoebi oops, right
 
10:01 PM
I don't like how I do it, but whatever
I also generate a SHIT load of temp variables
but I figure GCC can handle that
function foo(int $offset) {
	$a = 1;
	for ($i = 0; $i < $offset; $i++) {
		$a += $offset;
	}
	return $a;
}
PHP_FUNCTION(foo) {
	long v1;
	ZEND_PARSE_PARAMETERS_START(1, 1)
		Z_PARAM_LONG(v1)
	ZEND_PARSE_PARAMETERS_END();
	long v2;
	long v3;
	long v4;
	long v5;
	zend_bool v6;
	long v7;
	long v8;
	long v9;
	long v10;
l1:
	v2 = 1;
	v3 = v2;
	v4 = 0;
	v5 = v4;
l2:
	v6 = v5 < v1;
	if (v6) {
l3:
		v7 = v3 + v1;
		v8 = v7;
		v3 = v8;
l4:
		v9 = v5 + 1;
		v10 = v9;
		v5 = v10;
		goto l2;
	} else {
l5:
		RETURN_LONG(v3);
	}

}
 
as long as you don't compile that with -O0 ^^
 
even then, the register allocator should optimize them away
 
not with -O0, AFAIK.
 
if you do long a, b; a = 1; b = a; c = a; return c; you should only use 2 registers
because b and c have different and mutually exclusive runtimes
though the assignment still happens
 
ah, yeah.
But I guess it always reads back from stack.
 
10:24 PM
github.com/ircmaxell/php-compiler/blob/master/demo.php <-- there you go @JoeWatkins @NikiC @bwoebi
 
anyone on Magento?
 
and €300 gone
I hate paying bills
 
what for?
 
water, electricity, net, phone ... the usual shit
 
$dayjob might evaporate this weekend, still no information from management but rumors are a-swirlin'
 
10:30 PM
Magento for Fashion
Open Source/CE

Wondering, which one best for Fashion website.
I dont know, is fashion a enterprise stuff or opensource.
hmm.. good.. thats what you need to live.
 
I need to find clients
I have no idea how to do so
 
@ircmaxell It's a bit hacked together… but yeah… for just two hours it's actually looking nice… good job :-)
 
"bit"?
 
somewhere, i read. may a US guy pays $1000/month for his car.. i dont know.
 
@ircmaxell okay, sorry for underexaggerating^^ … but it's not that bad.
 
10:32 PM
i think read it on Stackexchange sites.
 
bills suck, but the security of knowing you can pay them is pretty cool
 
@ScottArciszewski I'd like to be that wealthy that I don't need to care about money [not in a sense that I buy each day a new yacht… but to not have to care about things like bills or taxes.]
[yeah, I dream…]
 
ah dream.. good.
:)
 
my process lately has been "think of ways to create more value for more people, hope someone with $ notices" because that's the best option I got
 
really, I wish to not have to care about such secular affairs…
 
10:36 PM
Any one magento?
 
I'd like just being able to contribute in my way … and in exchange I wouldn't have to worry about secular affairs… I'm not extravagant… just a normal middle class life without having to worry about money…
 
@bwoebi how do I deref a hash table?
 
@ircmaxell you want to access a member of the hashtable?
 
sorry, free
 
zend_hash_destroy()?
 
10:43 PM
no, refcount
 
manually.
if (!--GC_REFCOUNT(hashtable)) { zend_hash_destroy(hashtable); }
 
really? there's no zend_hashtable_release function?
 
nope
 
the gap between this and this are growing again :/
 
@ircmaxell that's usually indirectly handled via zval_ptr_dtor().
 
10:45 PM
k
 
and you rarely need direct refcounting on a hashtable.
 
thanks
 
@LeviMorrison Lol, the second one has -1 downvotes.
 
Yeah, I think that was probably just some guy who didn't like that I advertised it here or something.
 
yay, wiki is down
 
10:48 PM
:/
@ircmaxell It's common, sadly.
 
Hm, nope, it's just the first answer not showing the - in front of the downvotes.
 
PHP_FUNCTION(getAtOffset) {
	HashTable* v1;
	zend_bool free_v1 = 0;
	long v2;
	ZEND_PARSE_PARAMETERS_START(2, 2)
		Z_PARAM_ARRAY_HT(v1)
		Z_PARAM_LONG(v2)
	ZEND_PARSE_PARAMETERS_END();
	zval v3;
l1:
	if (!zend_hash_index_exists(v1, v2)) {
		ZVAL_NULL(&v3);
		zend_error(E_NOTICE, "Uninitialized offset: %pd", v2);
	} else {
		ZVAL_INDIRECT(&v3, zend_hash_index_find(v1, v2));
	}
	RETURN_ZVAL(&v3, 1, 0);

}
function getAtOffset(array $array, int $offset) {
	return $array[$offset];
}
@bwoebi ^^ seem sane?
 
INDIRECT is engine-internal type
I'm surprised your code works at all
 
it likely doesn't
haven't run it yet
 
@ircmaxell what Nikita said… and you can also just do one call to zend_hash_index_find() and check the resulting pointer against NULL.
 
10:53 PM
instead it should be ZVAL_COPY(return_value, zend_hash_index_find) (or the same with a temporary
 
	zval *v3 = zend_hash_index_find(v1, v2);
        zval v4;
l1:
	if (v3 == NULL) {
		v3 = &v4;
		ZVAL_NULL(&v3);
		zend_error(E_NOTICE, "Uninitialized offset: %pd", v2);
	}
	RETURN_ZVAL(v3, 1, 0);
@ircmaxell like that
(and the ZVAL_NULL has an & too much in my code)
 

« first day (1746 days earlier)      last day (3196 days later) »