« first day (1857 days earlier)      last day (3095 days later) » 

12:00 AM
well, use is basically half the point of ::class ;-D
 
Abe
it won't be bad for now having that... i hate hardcoded methods [$foo, 'method']
@Andrea planning working on new rfc's? :P
 
@Abe nah not really
 
@Andrea As bob pointed out it doesn't work quite right.
 
though I do want to solve function referencing somehow someday
@LeviMorrison also as Nikita pointed out, yeah
 
Yeah.
 
12:09 AM
hmm, ::method would be something we could have
 
Abe
merge the symbols tables!
 
Foo::bar::method -> [Foo::class, 'bar']
 
@Abe I think this would be good in the long run but I suspect it would be too large a break.
 
Abe
@LeviMorrison are you sure? because when you mentioned it the first time, i checked my code and just on one occasion i was using the same name for a method and for a field, at the same time
 
it's also messy (static property syntax, ugh)
@Abe doesn't mean others don't do that constantly
 
Abe
12:11 AM
yeah but i'm a great example of poorly written code :P
it wouldn't be too bad for a major release, imo
still struggling with the parser thingy. i have no idea what i'm doing. it's the fourth time i rewrite it and every time it looks worse
now i'm trying with some regexps, kindly provided by @bwoebi :P
 
yeah, you might have to adapt it a bit, it's not perfect yet, but nearly ;-)
 
Can someone with pthreads knowledge look into this q - stackoverflow.com/questions/33717494/… (question is not mine, i'm just interested because I'm php-amqp contributor)
 
Abe
@bwoebi i think i have the <> parsing part done kinda right without regexps. i'm using regexps for validating class final interface abstract extends etc which strangely i found harder to parse
 
well, the regex at least is nice to validate… and match the appropriate groups (full, extends, implements)
 
Abe, you may want to try to use [] for generics.
I'm not fully sure of why, but Scala and Python do this.
 
Abe
12:26 AM
why?
 
Again, no idea. But it may be easier for parsing or something.
 
Abe
it's the same, no?
 
Well, not exactly.
< is an operator
> is an operator
 
wouldn't conflict in lexer with T_SR etc.
 
But individually [ is not, nor is ].
But if there are other reasons I don't know of them.
 
12:27 AM
and yeah, will not conflict with operators in code…
 
It's just an idea you should evaluate if you are serious about this generics idea.
 
@zaq178miami have you tried running it through strace to see if there is even an attempt to open the connection?
 
@kelunik don't know, but seems related to the issue you reported on github… I can't reproduce any issue here. Are your workers constantly crashing or what?
 
star wars 7 will be a great sequel to star wars 5
 
Abe
well in my userland thingy both would be fine; if you guys want to have generics in php, well that's up to you. i believe both characters would have problems if implemented in php
and not in the class declaration but elsewhere. i mentioned the other day $foo instanceof Baz<Foo>
i believe < would cause problems there, but exactly like Baz[Foo] which is Constant[Constant]
 
12:32 AM
@Abe I think the latter is probably a bit easier to deal with though.
You can issue a polymorphic VM op for it.
 
Abe
other future cases would be:
public Foo<Baz> $baz;
Foo<Baz> $baz = new Foo<Baz>();
 
@Andrea I had read 7 and 5 and was surprised to see "star wars" and not "PHP"…
 
Abe
lol
what about {} ?
Foo{Baz} $baz = new Foo{Baz}();
 
that's remembering me certain horrible things in parser…
 
Abe
12:51 AM
@bwoebi imagine when you will see the horrible things in my parser... xD
 
ehm.
 
Hello everyone. I'm trying to build a chat for my website (member can chat with member). And i heard that best way to do this is with websocket and nodejs. So i'm wondering if i can integrate nodejs and websocket with my current website which is written in php
 
Abe
i'm trying to keep it easy to read and to maintain, so it's probably the opposite of what it should be
you can do that with php as well @DatTran, using xhr or websockets, if you prefer
 
Abe
\o
 
1:20 AM
@bwoebi it's a bad PHP joke
 
1:35 AM
bah, subtle execution order differences in different drivers … testing… works fine… upload to travis… failed test… :x
 
1:59 AM
> I find the following use of __set and __get useful:
Well… that's odd. When I deleted the note I selected the "useless" option.
I deleted or edited about 20 notes on PHP: Overloading.
I hope I don't see this on the top 20 pages of notes anytime soon.
I actually found one or two good notes with a negative vote score, so I removed their downvotes. But mostly I just wanted the experience to be over with. Ugh, the ideas people have for using __get, __set() and __call
 
posted on November 16, 2015 by bwoebi

amphp/amp v1.0.6

 
Abe
2:22 AM
@bwoebi what's bad of regexps is that they don't tell you why the pattern is not matching :B but i stopped caring now, i just want to finish this so that i can write tests easier
 
hey guys.
Anyone has experience with using php on linux with dblib to access an MSSQL server? I'm getting a lot of seg faults and some null errors fetching data. The same code on windows with SQLDRV driver works fine.
 
Abe
2:38 AM
the best comment is:
php_is_painful at world dot real 8 years ago
This is a misuse of the term overloading. This article should call this technique "interpreter hooks".
just because of the email address :P
 
2:50 AM
I agree that it is a misuse of the term overloading.
 
Abe
yeah
i wish we could tune the backtrace of exceptions in userland
$e = new Exception;
$trace = $e->getTrace();
// ...
$e->setTrace($trace);
throw $e;
 
3:34 AM
What does zval_ptr_dtor() do?
If I comment out this one (github.com/php/php-src/compare/…) then my patch will segfault instead of free'ing something that wasn't assigned, or complaining about a corrupt linked list
 
Abe
3:52 AM
@bwoebi wouldn't be better if [1] was set to null, rather than empty string here 3v4l.org/ufmr7 -__-
 
4:09 AM
good morning
 
I know I have a lot of RFCs that need finishing, but I have been thinking about other things lately.
Notably what features a proper module system for PHP might have.
Many of the benefits that other languages' module systems have are irrelevant to PHP.
 
.top-header{

   background-image:url("Institute.jpg");
   background-position: center top;
   background-size: 100% auto;
   background-repeat: no-repeat;
   height:100%;
}
guys i set height : 100%
and now there is a free space after the top image. The image actual height is 252px. It's nicely reduce the file size
 
Abe
@LeviMorrison for instance?
 
Vast reduction in compile times (C++), a simple way to load multiple code 'units' (we have autoloading and phar)
 
moin
 
Abe
4:13 AM
morning
 
But there are a few that may still be worthwhile.
Notably the ability to have control over what is exported outside of the module.
 
@DaveyShafik decrement refcount and free if appropriate
you probably want to use the proper API for setting arguments
 
@JoeWatkins hrm.
@JoeWatkins there's… an API? :)
@JoeWatkins this is the problem with learning from the same place I'm implementing, it's not been touched in a while I guess
 
and pzval = mpzval; Z_ADDREF_P(pzval); is not always valid anymore, you want the pointer to zval to actually be a zval on stack, and ZVAL_COPY to it, or you want to use the args api directly in the loop and then break out
 
I… have no idea what you just said :D
 
Abe
4:19 AM
^ that, but in response to Levi :D
 
It may be beneficial to force modules to have declarations only (only constants, classes, interfaces, traits, functions).
This has a few nice properties that would come with it.
 
that
might not work the way you expect it too, so drop the habbit of pzval = mpzval; Z_ADDREF(pzval);, use ZVAL_COPY
use the zend_fcall_info_arg* API's to set the arguments and if zend_call_function == SUCCESS you can use lxr.php.net/xref/PHP_MASTER/Zend/zend_API.c#3413 to free up whatever was allocated
is the bug easy to reproduce @DaveyShafik ?
 
@JoeWatkins I'm pretty sure it's coincidental and something to do with libcurl/libnghttp2 and what I'm doing with it
 
stab in the dark, I haven't compiled the code ... if I were writing that function, it would look like this
static int _php_server_push_callback(CURL *parent_ch, CURL *easy, size_t num_headers, struct curl_pushheaders *headers, void *userp) /* {{{ */
{
	php_curl *ch;
	php_curlm *mh = (php_curlm *)userp;
	size_t rval = CURL_PUSH_DENY;
	zval	*pz_parent_ch;
	php_curlm_server_push *t = mh->handlers->server_push;
	zval header_count;
	zval retval;
	int  error;
	zend_fcall_info fci = empty_fcall_info;

	ZVAL_LONG(&header_count, num_headers);

	/* find the original easy curl handle */
	{
		php_curl *tmp_ch;
		zend_llist_position pos;
zend_fcall_info_args_clear(&fci, 1); is in the wrong place ...
@DaveyShafik when did you last pull from php-src ?
 
4:46 AM
@JoeWatkins any reason not to use lxr.php.net/xref/PHP_MASTER/Zend/zend_API.c#3393 ?
@JoeWatkins few days, it was breaking on me yesterday or the day before so I rolled back a few commits
 
use api if you can, for sure ...
 
OK, now to figure out what the heck I'm supposed to pass into it ;)
 
there are no failed tests here ... did you do tests yet ?
well, if you already checked that the thing is callable, you might not want to do that again ...
one of them will show you how to use it ...
 
@JoeWatkins yeah, I'm getting there, using it successfully, trying to debug a segfault in var_dump()'ing the args I'm creating
the second curl handle (easy) is blowing up :)
 
zend_register_resource(ch, le_curl) ?
if you're passing it to a macro, it's probably because it's being executed multiple times when the macro is expanded - don't pass function results as macro args ...
 
4:58 AM
I'm not passing it to a macro, I have it exactly as you had it
 
maybe try a sequence point
ch = alloc_curl_handle();
ch->cp = easy;
pzh = zend_register_resource(...);
zend_fcall_info_argn(...);
just to eliminate that ...
 
that's exactly what I was going to try, so… that makes me happy, even if it doesn't work
 
it probably won't work, but now you have a name for the zval* to the curl handle ... which you could watch *
 
the issue is that it's passing a zend_resource in, rather than a zval
 
5:06 AM
I'm pretty sure
 
yeah, that'll do it ...
register the resource and ZVAL_RES it into a zval on the stack
 
yeah, that's what I'm trying to do…
 
(it will have refcount==1, which is correct, no need to addref I don't think ...)
 
zval *pz_ch = NULL;
ZVAL_RES(pz_ch, zend_register_resource(ch, le_curl));
== segfault
 
yeah
zval ch;
zend_resource *res = zend_register_resource(...);
ZVAL_RES(&ch, res);
...
zval * = heap
zval = stack
 
5:09 AM
well THAT'S almost working
I wish segfaults were more… useful
 
the good news is the original curl handle is executing correctly; the bad news is the pushed one isn't, AND libcurl segfaults
 
Are you able to run with valgrind?
 
yeah
 
No errors when running in valgrind?
 
5:11 AM
I have no idea about libcurl
sending num_headers as two args is suspicious ...
assume num_headers, and headers are supposed to be the args ...
 
@JoeWatkins ah, that's just placeholder
because I haven't yet figured out how to handle headers :)
I need to create a new kind of resource >:(
(for passing into two new functions, curl_pushheader_bynum() and curl_pushheader_byname()
 
yeah was just reading it
or loop through the headers and pass an array as header arg
assuming the programmer cannot change the headers, right ?
I'd use an array ...
 
they cannot… I could definitely do an assoc array
it'd have to be a multidimensional array, ick
["header_name" => [int => "value", …], …]
 
might be better than yet-another-resource
 
I don't disagree there at all :)
though it does mean we're not following the curl API anymore
 
5:19 AM
we don't have too ...
the cURL API makes sense low down, C/C++, but for us, not so much ...
 
in that case, why haven't we written a curli ;)
seems a redesign of curl is long overdue. Maybe that's my next task :P
 
:)
gotta shower and walk dogs ... back in a while ... good luck :)
 
5:34 AM
crap, curl doesn't expose the headers in a way that lets me create an array :(
has to be a resource
 
5:47 AM
no one else awake to walk dogs yet ...
what do the curl api functions return ?
you get passed a size and the headers struct, why not for (i=0; i<size; i++) h = curl_pushheader_bynum(i);
@DaveyShafik?
 
because the headers struct isn't what you think it should be ;)
oh.
nevermind :P
 
the api function returns char*
 
too early ;)
 
oh hrm… if it just returns char, I assume it just returns the value, and not the header name, but I'll look more
 
5:50 AM
yeah not sure about that one ...
 
maybe it returns the header name for using with curl_pushheader_byname() ¯\_(ツ)_/¯
 
hopefully returns whole thing ...
ah maybe
I think it must flatten headers
because they both return char*
 
well, the curl_pushheader_byname() makes sense to just return char*
 
so no room for duplicate headers, so maybe no need for multi-dimensional array
 
oh wait
not if there's more than one of that header. o.O
 
5:52 AM
yeah, it doesn't really ...
yeah it must flatten them I guess
 
but that's wrong
I'll poke Daniel about that
 
indeed
see what bynum returns
maybe you can keep calling byname
(and it'll just return next one)
 
not from looking at the source of byname
 
link
 
it looks for the first one with that name and returns it AFAICt
 
5:53 AM
oh dear
 
yeah that doesn't look right
makes it easy for you though :)
 
6:40 AM
hi all
I am planning to start a project for our company which will be used internally for sales, employees and some other stuff
I dont want to use any CRM or CMS, i want to use a framework to develop it according to our needs and integrate it to our other systems
What do you all think which framework should i use? Zend 2, Yii or Laravel ?
Thanks
 
Abe
just plain php
 
chat.stackoverflow.com/… you should check out our archives on the topic.
 
Thanks. @Abe , cant use plain PHP, as i will be dealing with too much things. Frameworks will provide me security, ORMs, Cache, Forms and more other features
 
morning
 
6:57 AM
@Abe having put more thought again about templating, I think there's a fundamental discrepency in the way we view templates
 
Abe
like?
 
(more like, in the different ways of seeing templating around here)
in one case, the template *engine* actually renders templates with different values or objects
vs
the template object renders *itself* in a template
took me some time, but the $view = new template() example I kept seeing was bugging me
 
Abe
7:10 AM
not understanding you @FélixGagnon-Grenier :P
though, it's not that there is a rule. everyone does what they prefer
 
Abe
no, the former is better
 
Morning'
 
Abe
the view should contain entry points to your read model, like

class HomeView implements View{
function getLastNews();
function getLastComments();
function getLastActiveUsers();
function getWelcomeMessage();
}

then

$phpt = new PHPTemplate("/home.php"); // PHPTemplate implements ResponseBody
$phpt->setThis($homeViewInstance);
$httpResponse->setBody($phpt);

and then in the front controller or where you prefer
$httpResponse->send();
this is what i do
 
7:27 AM
@LeviMorrison easier configuration. exposing configuration parameters and such
 
Abe
@FélixGagnon-Grenier pastebin.com/5XqGJ3Pc
i've used $this because i prefer using that in the template, but you can use any variable name you want
 
0
Q: How to check characters alternatively and replace it with Y if it is X?

ShafizadehI have a string, something like this: $str ="it is a test string."; // for more clarification i t i s a t e s t s t r i n g . 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Now I need to check all characters that are multiples of 4 (plus first character). like these:...

 
thx for the example @Abe.
 
Abe
class FileResponseBody implements ResponseBody would have been a better name, was writing something else and then i changed my mind, but forgot to rename the class :B
 
8:22 AM
 
Abe
\o
i should have read this earlier en.wikipedia.org/wiki/Recursive_descent_parser
 
8:35 AM
Hakuna matata :)
 
8:47 AM
morning!
 
I blame you, Room 11
 
Abe
imagine if it appeared first :D
 
It does if I'm looking for "php7"
:P
 
Abe
lol
 
gosh .. now I know that FF is a recursive acronym "Fuc*ing Firefox"
4
 
Abe
9:20 AM
true
 
MOrning
 
Abe
moRNING
 
If a question has +60 viewed at less than 2 hours, also it has earned 3 upvote, this means that question is a great question?
 
Abe
9:37 AM
nope, it's a Sajad-question :P
@Shafizadeh > combining characters is complicated a bit. (It needs to some waste processing)
 
Abe
what do you mean with this?
if you mean unicode combining codepoints, it would make the question interesting
but the answer you accepted would be wrong
 
@Abe BTW, how you know my name is Sajad?
@Abe yes it is wrong, but his owner promised he will edit it.
 
Abe
... do you realize we can see your avatar? and that is the one we know :P
 
9:44 AM
God I hate that repwhoring guy
 
Who is "that repwhoring guy"?
 
Bloody Sajads, coming over here, taking our PHP questions
 
The person who answered your question without reading/testing using the FGITW principle
 
Abe
i think i'm going to use goto for the parser
 
@Abe Probably most sane
 
9:47 AM
@PeeHaa ah, he is not a bad person. he is just hasty a bit.
 
Abe
@PeeHaa wrote that expecting loads of insults :P
 
Yes it's called repwhoring
 
@Jimbo I don't know what should I say. just I can say 'sorry' for giving you this horrible feeling
 
FGITW?
 
@Shafizadeh Mate, I was joking, don't at all take offence to anything I say :) (sorry if I made you worried)
 
9:48 AM
:-)
 
1022
Q: Fastest Gun in the West Problem

Omer van KloetenI feel like there's a problem with Stack Overflow, as the number of people prowling it increases. Each question's answers are sorted by descending score and then by descending time of posting. This means that if a person sits down and answers a question in a long, thorough way, going through eve...

 
Ah!
I was like.. google fat guy in the woods, what?
 
lol
 
Abe
@Sean opens photoshop
 
@Jimbo no that is my fault, I don't know English very well and sometimes I am misunderstood ... ;-)
 
Abe
9:51 AM
@PeeHaa the problem is who accepts the answer faster than light, not who answers fast
 
I think what I ended up doing was writing a fast answer, then editing my post to add more detail.
 
@Abe FGITW mostly happens by putting up a crap / incorrect answer first
So yeah it's the answerer too
 
Abe
@PeeHaa ever wrote a parser?
 
Only crappy ones
 
\o
 
10:00 AM
@Fabor o/
 
10:10 AM
Is it worth contacting a mod to move a question to another SE site, or should I just close the question and paste it myself?
0
Q: Can Ant run an apply task fully even if it fails?

SeanI have a target set up in ant which runs a PHP lint check on all modified files since the last check. <target name="lint" unless="lint.done"> <apply executable="php" taskname="lint" failonerror="true"> <arg value="-l"> <fileset dir="..."> <include name="**...

I think a better fitted site would probably be super user
 
@PeeHaa Please keep your opinion about people in your mind and don't publish it in here ...
 
hi need a help in wordpress i am new
any body help me please
 
@ZohaibAkhtar Whats up?
 
thank you i create a new page thor.
through wp-admin
i want to change this page html but i cannot find in theme where i can change this page html?
@CiaranSynnott i want to change this page html but i cannot find in theme where i can change this page html?
 
What page?
 
10:19 AM
If it's a normal page, it should just be through the page area in wp-admin
 
@CiaranSynnott new page make through pages in wp-admin
 
@CiaranSynnott thanks i studies this
@Sean yes buts its not normal page i want to make its own html
 
@Shafizadeh Please SU
 
I think the number one greatest resource for me was WP's template hierarchy. There's an interactive one If you wanna learn more about templating.
 
10:22 AM
@Sean thats awesome - never seen that before
 
@Sean thanks
 
@Sean As long as there are no answers yet you can delete it yourself
 
@PeeHaa well SU is stand for?
 
@PeeHaa Cheers
 
10:35 AM
@Shafizadeh stumbleupon.com :P
 
@salathe tnx
 
P.S. good moaning, roomies
 
Mornin'!
If Room 11 lived in a flat share, what do you think it would actually be like?
Maybe like, a corridor full of dorm rooms
 
Welp. I'm in.
 
10:43 AM
Tracy Island
 
Anyone migrated from CodeIgniter to another MVC Framework before? Symphony/Laveral ?
 
user image
2
@CiaranSynnott Unlikely for the members of this room. Try a Symfony or Laravel room.
 
@Fabor There all php frameworks
 
Yes, but not a lot of people here use frameworks.
 
ThW
Good Morning
 
10:47 AM
Morning @ThW
 
Hello, can anyone please take a look my INSERT INTO statment, in php pastebin.com/R00CFAxS i am trying to insert data to database, but it says there is syntax error in SQL statement, i have tripple checked with tutorials, seems fine to me...
 
Your table is called 15.11.15 ?!
 
lovely name for a monday morning! xD
 
yes
by date
is this the problem ?
 
rename db and try again ;)
 
10:51 AM
yep, if you want to use that table name then you'll have to quote it in the queries (using backtick) like `15.11.15`
 
Ok i will try, thank you, never tought that it could be problem.
 
@salathe I wouldn't advise doing that tough :P
 
@Naruto right, better to use a table name that doesn't need quoting
@user2033139 see dev.mysql.com/doc/refman/5.7/en/identifiers.html for how tables can be named
@user2033139 for example 15_11_15 doesn't need to be quoted
(aside: it seems an odd choice to name a table after the date anyway)
 
ok i can work around it, thank you for enlighting me about this :)
 
11:03 AM
@Onedev.Link pretty awesome :P to bad I don't have a drone to try it out :P
 
Abe
@PeeHaa start over again, i'm going to use this style this time gist.github.com/WesNetmo/3b2975a68759f261f294 does it look ok to you? also cc @bwoebi if you are around
*starting
 
11:18 AM
morning
 
Abe
morning
 
@salathe Morning sir
@Abe Those elses don't do much
 
Abe
how so :P
 
if($this->parser->is(T_ABSTRACT)){
    $this->AST->isAbstract = true;
    $this->parser->moveNext();
    goto TRY_CLASS;
}

goto TRY_FINAL;
Is exactly the same
 
@CiaranSynnott I have migrated from CI to vanilla PHP
 
Abe
11:23 AM
i suppose because it's easier to read @PeeHaa :P
 
@CiaranSynnott pretty much include the bootstrap from github.com/PatrickLouys/no-framework-tutorial at the beginning of the CI index file and only return output if a route matches. Then another important piece is a simple service locator class that allows us to use the new services, entities etc in the old CI code
 
@Patrick WHAT.
> a simple service locator class
Go to the Javascript room you dirty heathen.
 
Haha
 
@Fabor lol
That's more like it
 
11:46 AM
The actual value used will be the first number in the set of prime numbers { 223, 463, 983, 1979, 3907, 7963, 16229, 32531, 65407, 130987 } that is bigger than the configured value.
Has to be my favourite configuration option errata :P
 
/me pokes head in
 
Hmm, scripts are actually cheap on memory usage when compiled into opcache
~2000 scripts in the OPCache, and they're consuming under 100MB
 
@JoeWatkins ohai o/
 
2 hours ago, by PeeHaa
@Shafizadeh Please SU
I got the mean of "SU" now, it is "Shut Up". So, please be polite ...! (also I got it that you are female now)
 
Abe
hahahhaha
 
11:59 AM
> I have a class, called Core() That pretty much runs the management of my website. It handles the routing, the header, body, footer etc and all files/database/authentication (login/logout) access.

So far it works great. Pretty much All I have to do in my index.php is the following:

$core = new Core();
$core->render();
And the correct page will be rendered.

My problem is when it comes to databases. I currently have my PDO database classes used by Core() as a trait, loaded from a separate file
Defak
 

« first day (1857 days earlier)      last day (3095 days later) »