« first day (691 days earlier)      last day (4273 days later) » 

LOLOLOL
 
4:15 PM
posted on September 06, 2012 by Andi on Web & IT

In 2005 we announced the Zend Framework project. A great framework was the missing link in moving PHP from departmental to strategic Enterprise adoption. We had already delivered on the other necessary Enterprise requirements incl. broad database support, strong OO, XML and Web Services in PHP 5 and standard tooling via the Eclipse eco-system. By delivering best-in-class best practices th

 
0
Q: Output garbled after second load of script

ChrisOn a server running FreeBSD 8.3-RELEASE-p3, Apache 2.2.22 from ports, PHP version 5.4.6 from ports, output is being garbled on the second load of a script. The problematic behavior was only detected today, but we suspect it began with a recent ports update. Here is an example script: <?php ...

 
@Chris The fact that you're getting a portion of the headers in the output is slightly strange
Are you able to reproduce a segfault on the command line?
 
@Chris BOM issues? just a very blind guess
 
@edorian Shouldn't cause a segfault :p
 
Maybe I am wrong, but dismissing the idea of one dominant framework for a language is being small-minded at best, ignorant at worse
 
4:25 PM
@ircmaxell Worked for ruby
 
@ircmaxell Ignorance is bliss, dismiss away :D
 
@edorian for various definitions of worked
 
@ircmaxell They only have one web framework and it worked out very very well for them. Now everyone that needs something that is any good gets to build it from scratch cough
 
Well, they had one framework
 
@edorian Is that the framework that's insecure by default and they refuse to fix?
 
4:27 PM
that is now quickly falling from favor
 
@Chris you don't happen to have some sort of caching proxy in front do you?
@Leigh No what you are thinking of is every php framework ever
 
@edorian No, I'm thinking of rails
 
ba dum tsch
Yeah yeah the github issue, i know :) (and the 100 before that)
 
Also, read his question, segfaults and function <null character> do not exist, it's not a proxy
best bet is to do a debug build and run through gdb on the command line, if he can reproduce the error that way, will land you exactly where the error is and then you can get a bug report out.
anyway, home time, ciao
 
@edorian No cache proxy, nope.
 
4:30 PM
@Chris I assume you also turned off APC?
and just to clarify. Thats mod_php and not php-fpm?
 
@ircmaxell actually they had more than one framework. but the others either never made it to relevance or were merged into RoR (was it merb?)
 
@edorian Yes mod_php, APC is on
 
and others sprang up. Sinatra, etc
@Chris disable APC and you should be fine
APC is not stable with 5.4 yet
 
However, we have a secondary server with the same setup and it is working
Trying APC...
 
4:37 PM
Resolved it
 
> php carshed OR return PHP Fatal error
 
PHP 5.4.6 APC causes failures, vs. PHP 5.4.5 with APC on and no problems
 
"php car shed". It's a website for sharing parking spaces
 
The 5.4.6 install was giving the scrambled output I mention in the question
Sometimes bits of the headers, white screens, segfaults, etc
 
Which is quite annoying since 5.4.6 is the only 5.4 version I'd consider running tbh
 
4:38 PM
Very sporadic, hard to consistently reproduce the same failure, but always a failure on the second or subsequent load of a page using the minimum example
 
I wonder why I didn't run into an issue like that. Might be because of php-fpm.. but still strange
 
I was getting segfaults when the script did nothing more exotic than print
iiiinteresting
 
@edorian Why 5.4.6?
 
The server admin moved APC extension inclusion in PHP.ini from the last one to be the first one, and it cleared
Now the script loads without the scrambling
I'm going to have him move it back down and see if it reappears
 
if so, file a bug...
APC is a beast...
 
4:47 PM
@PeeHaa Everything <= 5.4.1 doesn't work properly with a couple of autoloaders and is not working, .2 and .3 where security fixes that might not apply but .4 and .6 both fixed a LOT of segfaults that I ran into
 
Frustrating. I had him move it to the bottom and restart.... aaaand it still works fine
I am usually skeptical when I hear this kind of thing
But seriously.... this is weird as shit
 
@PeeHaa So for the code I'm currently running every else breaks ;) Also maybe it's just me getting in the mindset that every ".6" release can be used. Well 5.2.7 and 5.3.6 ;)
 
It started again
 
@edorian :D
 
4:49 PM
Repeated refreshes.... he's moving it back to the top, we'll retry. If so, I'll file the bug :)
Thanks for the lead, guys!
 
I had so much trouble with people running that god aweful deb 5.3.3 or ubuntu 5.3.4+whatever
 
Just for the record, "too localized" does not mean the same thing as "general reference" or "duplicate of some other question but I'm lazy to find the duplicate". — BoltClock 47 mins ago
Now get off my lawn! :)
 
:)
 
For reference, current php.ini - pastebin.com/kBg8uXfV
I'm doing my due diligence before filing a bug report, thanks again for suggesting APC
 
have you tried turning it off and on again?
 
5:01 PM
yeah or kicking / hitting it
 
I checked the hard drive fluid levels, everything seems to be in order
 
Yes -- turning APC off caused the problem to stop. Changing the extension load order so APC loads first also caused the problems to stop. Move it to the bottom, restart, refresh several times, and it comes back. I can reproduce it.
 
why don't you try different APC setting?
 
@Chris submit a bug report...
 
5:07 PM
I will check out the settings before I submit a bug report, for the time being.... I was trying to do something when I ran in to this, so back at it :p
@grmpyprogrammer @rdohms WHAT? He's delusional for wanting natural competition between frameworks, instead of... someone playing kingmaker?
 
APC is the weak part of PHP 5.4 ^^
 
@PeeHaa what awful answers
 
@Lusitanian If only it was an answer
@Lusitanian Damn now it is converted to a comment :|
Now way to delete it now.
 
@PeeHaa that's unfortunate. can't even downvote it.
 
@Lusitanian I've flagged it for being plain wrong. Lets see what comes out of it
:P
Or plain stupid don't know what I typed :)
 
@NikiC Thats why APC needs to go into core
 
5:29 PM
@PeeHaa haha
@NikiC @edorian PHP 6.0 should certainly include an opcode cache
 
@edorian s/APC/the opcode caching part of APC
 
@edorian Nah, that's why APC needs to be split in two. It's trying to do too much right now
 
but not apc
@NikiC exactly
 
@ircmaxell That too ofc
@ircmaxell I do SO not care about anything besides the opcode cache
 
amazon's unveiling the kindle fire 2 today it looks like
 
5:30 PM
@NikiC Yeah.. I always forget the other stuff :)
 
Hello everyone :)
 
Why is there a Phalcon PHP room
 
@Lusitanian Because it is super fast
 
@PeeHaa but is it web scale
 
5:34 PM
HAHAHAHAHAHAHAHAHAHA
 
@ircmaxell ?
 
@Lusitanian It's an outreach room.
I'm not even kidding.
It's a moderator initiated chatroom.
 
Wha?
 
What does that mean
 
5:35 PM
@ircmaxell re-watching that now
i like the ruby and node ones best
 
in Phalcon PHP, 24 hours ago, by Tim Post
Moderator Note This chat room was created as a result of a moderator initiated, and sanctioned outreach to an open source community. This notice will vanish in a week, please refrain from trolling while these folks get used to their new digs.
 
@LeviMorrison sigh
 
> please refrain from trolling while these folks get used to their new digs
so we have permission and sanction to troll once they get used to the new digs?
 
guess so
 
Notifications for edits are awesome
 
node.js pfffft, phalconphp pfffft
 
phalcon? Ugh. Not a fan of the name.
 
it's pointless anyway
 
@LeviMorrison To be honest It's nice of the SO people to do stuff like that
It's not his fault the project is completely pointless waste of time
 
Agreed.
 
5:42 PM
Completely pointless waste of time is too light on it ;)
 
@Lusitanian I'm usually trying to be nice :)
 
understandable
 
@ircmaxell seen that
it's depressing
 
@ircmaxell How do you come across stuff like that?
 
5:47 PM
I pulled up node.js vs php on youtube
 
I'm not against pointless rants against technology that has a limited number of use cases but If you can't make me laugh while ranting I don't want to listen
Time to post a link to nodephp.org there
 
either make me laugh, or make a compelling argument. Otherwise, gtfo
 
combine the two and get a free cookie
 
@edorian
 
Hm?
 
5:52 PM
nodephp
 
Yeah but what part
 
the whole concept
 
The PoC it's self, the pointlessness of the whole thing or the amount of hate the troll attempt got?
 
the pointlessness.
 
Ah I see. I think it's a nice idea to do stuff like that to php just to see where it breaks and how far one can go
 
5:54 PM
The event loops are useless. It doesn't work for anything except for socket i/o.
Oh, I agree with that. But they are touting it like it's worth using in production
 
@ircmaxell They're touting node.js like it is worth using in production, and people do, so why not?
 
node.js is quite a bit more mature than nodephp
 
RoR is still running with it obvious joke
 
The bar for evaluating what is and is not a production-worthy framework is looking more like a flooring tile when you consider the number of Drupal sites in existence. Node.PHP, you say? Hell, why not Node.VB?
 
don't talk to me about Drupal
 
5:56 PM
Node.DOSBatch
 
@Chris are you able to get a command line reproduce script and a gdb trace to the crash?, would really help the bug report
oh wait, apc, no command line, crap
does APC work with the builtin webserver?
 
yes
Easiest way to help would be to run with USE_ZEND_ALLOC=0 valgrind php.
 
Noted, will do so
I am planning on staying at the office a little late tomorrow night, I probably won't be able to assemble all the info till then. I am behind on the project I was supposed to be working on when I ran in to the trouble, so gotta push forward on that. It relies on the box where we had the troubles, so I can't mess with it ATM
I am still farting around with ODBC over a network share, possibly the slowest thing ever, since dialup AOL
 
@Chris ODBC :(
 
@NikiC I wanted to ask anyways: What does USE_ZEND_ALLOC=0 do?
use malloc instead?
 
6:05 PM
@edorian disables zend memory manager
(so yea, use malloc)
 
@edorian The Zend MM allocates a memory pool and also automatically frees memory. So it's not particularly useful for valgrind. USE_ZEND_ALLOC=0 disables it.
 
hrm, that's interesting. I have come up with a new password hashing algorithm that, if my calculations are correct, should be stronger than scrypt...
$dk = pbkdf2('sha512', $password, $salt, 1, $size);
return pbkdf2('sha512', $password, $dk, $iterations, 64);
 
@Chris Sometimes I think you are being too nice to people not reading the faq and the How to ask page :)
 
Summer of Love
:p
 
I can't wait for Fall of Hate
5
 
I am usually a troll online. I try to make a concerted to be the opposite of a troll in places where I use my real name; it does not come naturally to me
 
6:31 PM
@MikeB :)
 
hrm, that doesn't work though...
 
lol
@ircmaxell But it is super secure right ;)
 
it'll work, but it's not as secure as it can be
hrm, I can't use PBKDF2 for the basis of the second round function....
 
Crowd-sourcing at its finest — Mike B 2 mins ago
nice
 
6:38 PM
Can you kindly write up the entire code so that I can test if it works? — Gary Woods 15 mins ago
teh codez, give to me!
 
> Can somebody go through this piece of code with example of values these variables are holding?
0
Q: I just want to understand arrays

user1568049I would appreciate if somebody could break this down into something more understandable: var stepsWidth = 0; var widths = new Array(); $('#steps .step').each(function(i){ widths[i] = stepsWidth; stepsWidth = stepsWidth + $(this).width(); //3000 }); first o...

 
I wants it, all the things!
 
@edorian - Hi! While writing up a tag wiki for [phpt] I noticed that the example in my answer to your question no longer works. I can use PHPUnit to run the .phpt directly but not using the test case extension. I submitted a bug on github but was hoping I am just doing something stupid. Any ideas?
 
Ahh, one simple tweak to pbkdf2 makes all the difference in the world
 
@MikeB It has to be a smoother progression than that! We aren't that bipolar. At minimum, we'd be looking at the Fall of Indifference, followed by the Winter of Resentment. Only then could the Spring of Hate be possible, capped off by the much-anticipated Summer of Open Murder in 2013. We must take a moderate approach to retain any credibility.
2
 
6:41 PM
You're absolutely right - smooth transitions are vital
 
Can't wait till the summer of 2013
 
@PeeHaa Google summer of code project lined up? ;)
 
Something like that ;)
 
what's her name?
 
A modified AK47 that supports jQuery
 
6:44 PM
lol
 
Hrm, actually... This change would make it more resistant to GPU and ASIC based attacks... Perhaps this is something to consider
New game: #RFCWOD. Pick 4 numbers at random. Stick them in this url: http: // www.ietf.org/rfc/rfc{here}.txt Read resulting RFC. Repeat...
 
Yay I got a party pack:
> The Application Exchange (APEX) Option Party Pack, Part Deux!
:)
 
Summer of Rage 2013!
 
7:09 PM
 
7:36 PM
Hey guys, I could use your input on something.
Are you familiar with Ruby on Rails?
 
aye
 
Well, as you know then in Rails when you define your logical model, it creates classes for every entity.
So say you generate a model by the name of "user", you can then use it as both a static and instantiated class in your code, e.g. :user = Users.find(:id), or :user = new User()
I'm trying to achieve similar syntax in a framework I'm tinkering on. However, I'm stumped on dynamically creating classes at runtime, which as it is I'm basing on YAML files.
 
AT runtime?
 
@Sommer So you want to mimic RoR's bad practices in PHP?
 
Well the only alternative is to generate actual class files.
And PeeHaa, yes.
 
7:39 PM
like eval("class User { public function getName() { return 'Mike'; } }"); ?
 
@Mike, yes, but I really don't want to use eval() or {} or anything like that.
So if that's the only technically available option I'm going with another approach, but I was wondering if you guys had clues.
I mean the usual approach in PHP would be making some sort of tree structure but that still disallows static functions as I just described. I'd really like to make a class named after the model entity.
 
I'm not sure I understand. What static function wouldn't work?
 
Sorry, I should've phrased that differently.
 
I'm not very familiar with RoR, so some of the terms might get lost in translation :)
 
Nah Mike, I was getting mixed up there
I mean I could emulate all the needed features but one thing I really dig about Ruby is how creating such classes allows for far more semantic code.
So I'm looking at options.
So if I can get away with recreating it in PHP and writing "$user = Users.find($id);" I'll definitely take that over for example "$user = $model->users->find($id);"
 
7:44 PM
Well, using your RoR code as an example I would translate it to something like $user = Users::find($id), or $user = new User;
 
Haha, yeah sorry, Users::find rather than Users.find, used Ruby syntax there.
But yes that's what I want to achieve, which as far as I can see right now entails creating extended classes at runtime.
 
Because Users and User doesn't exist as concrete classes?
 
Exactly. The idea is to create them automatically upon initializing the framework in order to avoid having to manually create classes up front.
Based on the schematic provided.
It may seem odd from a PHP perspective, but the idea is to avoid work in the future and like I said, make the syntax as semantic as possible.
If I get this to work the entire model, including the managing DB entities and making classes, will be handled on the fly.
 
I've had this issue before and I cannot remember how to go about it. I have an array of stdClass objects, each with a name and a category - basically I want to display them in unordered lists by category. how would I go about "organizing" this?
 
Well, one approach would be to catch the class-lookup in your own Autoloader. That will get invoked when you try to use a non-existant class. Once in the autoloader you can prototype out your class and get it into PHP's internal class index
 
7:50 PM
@Mike, I'm gonna go read up on that now. I thought autoloading relied on already present files though?
 
@rlemon You mean sorting it?
 
Oh I see.. I could create an instance off a base class and provide that as a return value..
Thanks for the tip Mike!
 
"Too localized close vote" when is that too much?
 
@PeeHaa I suppose, i'm probably making this harder than it needs to be. right now my idea is to group them all in arrays based on their 'category' then use those arrays to produce the list.
<?php
$category_items = array();
foreach( $links as $link ) {
	if( array_key_exists($link->category, $category_items) ) {
		array_push($category_items[$link->category], $link);
	} else {
		$category_items[$link->category] = array($link);
	}
}
?>
 
Though, I fear this may give problems with static functions.. I'll play around with it.
 
7:54 PM
@rlemon You could simply use usort() to sort the original array based on the catageories
 
well it's sorted from the SQL return. however I do need to work with each 'list' a few times on the page - would this approach be considered "harmful" or "wrong"??
why am I always so paranoid when writing PHP :P
 
I would rather write it like:
<?php
$category_items = array();
foreach( $links as $link ) {
	if( !array_key_exists($link->category, $category_items) ) {
		$category_items[$link->category] = array();
	}

    $category_items[$link->category][] = $link;
}
Only with correct identation :)
 
yes yes that is better
ugh - if this were js I would be all over this!
 
Other than that looks fine to me
 
hi
 
7:59 PM
hello @techno
 
now my first inkling would tell me array_push($arr, $item) would be faster than $arr[] = $item; ???
but that is speculation with no actual fact to back it :P
 

« first day (691 days earlier)      last day (4273 days later) »