« first day (503 days earlier)      last day (4431 days later) » 

3:00 AM
in the view....
anyways i modified already my question
thanks for reminding me
 
I don't see "actionLogin" anywhere in your view
 
the view invokes the actionLogin() in the controller by sending a HTTP request came from view
you can see it on the submit button...
 
Got it compiling so far
let's see if it works
 
try that, and report back
 
My guess is no, I'll be floored if it does...
 
3:03 AM
0
A: Stucked with Yii Framework Form tutorial

andrewjacksonThis is just a shot in the dark... For your controller public function actionLogin(){ add return $model; at the end. Add <?php $model = actionLogin(); ?> to the top of your view.

 
ok thanks
 
user895378
@ircmaxell I view every large/major block of code like an arranged marriage: if it doesn't work out I'm not surprised and that way if it does I'm super-pumped that I got a positive result :)
 
nope, compile failed. make distclean && ./configure --enable-debug && make
let's see...
@rdlowrey actually, this patch is really tiny
at least given what it does
 
it returned an error "Fatal error: Call to undefined function actionLogin() in D:\xampp\htdocs\wiltalk\protected\views\sandbox\index.php on line 10"
 
My favorite error as of late:
You know it's never a good thing to see this error: "PHP Warning: Interface Traversable cannot contain non abstract method }Bn() in Unknown"
 
user895378
3:07 AM
@ircmaxell Haha I saw that last night -- funny
 
Yeah, that one was interesting...
well, let's see if this compile works this time. If so, I'm going tob e a happy camper, as I will have pulled off something quite cool
 
@Mahan wait... what??
 
anyways thanks for the effort on helping me...
 
"on line 10" in "index"???
 
yes...
its shown by Yii framework error page
 
user895378
3:09 AM
This chat room has completely commandeered my superfluous third monitor. I'm going to have to start minimizing this Chrome instance if I ever want to get anything done. The movement each time a new message is posted invariably rips me out of whatever it was I thought I was working on.
 
This enables the following:
function foo((int) $bar) { var_dump($bar); }

foo(1); // int(1)
foo("1"); // int(1)
foo(1.5); // int(1)
foo("foo"); // E_RECOVERABLE_ERROR - argument must be integer
 
@Mahan maybe you should learn PHP before trying to use a framework...
 
user895378
Oh dude that's sweet
 
@andrewjackson i know PHP, but the problem is i really can't get into the yii framework form tutorial...
 
user895378
And have you worked it out for the other scalars as well or only ints for now?
 
3:12 AM
surprisingly it wasn't that difficult, but there are issues with it that I know of. I'm just doing (int) as a POC, and not worrying about the edge cases
@rdlowrey I'm just doing (int) as a POC for discussion, then the plan is to do (int), (float), (bool), (string), and (object) (for generic object parameters, of any type)
 
the form tutorial is kinda a confusing... and if you have time you can try yii framework ^_^ but in case of PHP experience, i have a lot of it
 
actually, I modified the parser to support all 5, but not the implementation checks (they will error out right now if you try to use them)
 
I'm not going near a PHP framework with a 30' pole
 
user895378
Plans for an RFC soon(ish) then?
 
@rdlowrey Yup. The POC will be used for discussion and creating an RFC
 
user895378
3:15 AM
@andrewjackson +1 unless it's something I wrote. Homebrew == OK
 
@andrewj this is the tutorial i am currently following yiiframework.com/doc/guide/1.1/en/form.view
 
well follow this one first:
http://www.yiiframework.com/doc/guide/1.1/en/form.model
it's a problem with your model, not your view
 
ok I better read it again for the 12th time...
^^
 
Woot! The parser works, and one tiny bug in the executor
 
@Mahan instead of tutorial, try an example...
that's all the help I can offer you for now, I'm not gonna learn this thing just to get your tutorial working.
 
3:23 AM
Woah! It actually works!
 
thank you andrewjackson
 
MUAHAHAHAHAHAHAHA
 
user895378
I think that feeling of "OMG it works and it's awesome and ... I can't believe I got this to work! HOLY CRAP this is so great" is the hook that originally gets everyone into programming ...
 
# sapi/cli/php -r 'function foo((int) $bar) { var_dump($bar); } foo("123");'
int(123)
# sapi/cli/php -r 'function foo((int) $bar) { var_dump($bar); } foo("foo");'

Catchable fatal error: Argument 1 passed to foo() must be of the type integer, string given, called in Command line code on line 1 and defined in Command line code on line 1
@rdlowrey Agreed!!!!
 
@ircmaxell what in the world are you doing anyways?
 
3:28 AM
@andrewjackson trying to add scalar type hinting to PHP using auto-casting
 
Well, I shouldn't say trying, I did
 
user895378
I haven't read the internals list discussions for why scalar typehinting has been left out previously -- was it that people were unsure of how to do it without breaking stuff?
 
@rdlowrey That was one reason
Another is dealing with all the edge cases
for example, this won't work long term, since it happens pre-reference separation, so :
# sapi/cli/php -r 'function foo((int) $bar) { var_dump($bar); } $a = "1"; foo($a); var_dump($a);'
int(1)
int(1)
which is not good
 
user895378
I always just assumed it was because people wanted to encourage a more OO style and nudge PHP users into using objects instead of primitive types as arguments :)
 
3:33 AM
@rdlowrey you can't, since $obj + $obj will give 2...
 
why's your name italic in this chat?
 
which means it's quite hard to implement wrapper classes without a whole lot of bloat
and that's why I built this patch: gist.github.com/1947259
@andrewjackson I am a room owner
 
basically, I have limited moderator rights to this room
 
user895378
@ircmaxell So that's the one you were talking about working on in place of the __castTo RFC implementation
 
3:39 AM
yeah
 
user895378
Nice: "the (object) cast/hint would then provide that ability to accept a generic object"
 
yeah, that's something I have found a use for that's annoying that it doesn't support
 
user895378
Shenanigans. Apparently I don't know how to do a blockquote in chat.
 
> this is a blockquote
just prefix the line with > space (followed by a space)
 
user895378
> aha
 
user895378
3:56 AM
doh
 
user895378
ah, there we go.
 
One cool thing, is for completeness, I may add a bunch more casts... $class = (class) $obj, $path = (path) $string (which checks if it's a valid path)... With those 2 additions, all the parameters (except resource) can be hinted and casted
 
user895378
I can imagine people littering their function/method signatures with (path) hints and having a million file stats :)
 
user895378
Like most things, it would be very helpful when used correctly
 
odd, aparently the p argument identifier just checks to see if there's a null byte in the middle of the string
quite odd
So no, (path) wouldn't be implemented
 
user895378
4:05 AM
Alas, I need to do some actual real work. Keep it up dude. Looks solid.
 
Thanks! Take it easy
 
4:19 AM
is this the best practice of passing objects?
 
HUH?
you mean storing objects in a session?
 
serializing and unserializing from page to page
 
Well, in general I'd say avoid storing objects in sessions, but there are cases to do it
 
what do you suggest?
 
and in those cases, I'd suggest just puting the native object in, and letting the session handle serialization for you
but beware, that the session must start after either the class is defined, or an autoloader is, so that it can find the class
What is your need?
(aka: why do you want to persist an object)?
 
4:27 AM
just playing around with an idea. what is the best practice for moving say.. a user object from page to page without multiple connections to a db?
 
Just toss the user object into the session
no serialization
it'll do that for you
just make sure the class is defined (or an autoloader is) prior to starting the session
 
thanks!
 
@CarrieKendall @ircmaxell Storing more data than is needed in the Session could hurt scalability?
 
Sure. But a user object may be good...
 
 
1 hour later…
6:09 AM
I can't get sessions to work on a new virtual host I created. I'm not getting any errors in my error log. It can create files, I checked to make sure sessions were being created, and I can write to the session, but it doesn't persist from request-to-request. Ideas?
 
6:22 AM
hi
 
It seems my session file is not being modified, only created.
 
user895378
@LeviMorrison strange ... can't offer any suggestions at the moment
 
7:23 AM
mornings
 
7:57 AM
Ah, so the solution to the mysterious / was suhosin?
Reminds me of some discussions
 
morning :)
 
morning @Vlad
 
@NikiC thanks, morning to you too :)
ok, if anyone not sleepy :) this question: is there someone from GMT+02 or GMT+00, but not from GMT+01? I need the output from this function print_r( localtime(time(),true));
 
8:23 AM
posted on January 24, 2012

The PHP development team announces the 6th release candidate of PHP 5.4. PHP 5.4 includes new language features and removes several legacy (deprecated) behaviours. Windows binaries can be downloaded from the Windows QA site. THIS IS A RELEASE CANDIDATE - DO NOT USE IT IN PRODUCTION!. This is the

posted on February 02, 2012

The PHP development team would like to announce the immediate availability of PHP 5.3.10. This release delivers a critical security fix. Security Fixes in PHP 5.3.10: Fixed arbitrary remote code execution vulnerability reported by Stefan Esser, CVE-2012-0830. All users are strongly encouraged to upgrade to PHP 5.3.10

posted on February 09, 2012

Wanting to share your experiences with a larger PHP community? Please submit your name and topic ideas (even if you are only suggesting topics and not wishing to actually present them) - each topic requires a separate submission, submit as many as you like: http://speakers.northeastphp.org We hope to have topics and hands-on workshops in four tracks:

posted on February 24, 2012

The PHP development team would like to announce the 8th release candidate of PHP 5.4. PHP 5.4 includes new language features and removes several legacy (deprecated) behaviours. Windows binaries can be downloaded from the Windows QA site. THIS IS A RELEASE CANDIDATE - DO NOT USE IT IN PRODUCTION! .

posted on March 01, 2012

The PHP development team is proud to announce the immediate availability of PHP 5.4.0. This release is a major leap forward in the 5.x series, which includes a large number of new features and bug fixes. Some of the key new features include: traits, a shortened array syntax, a built-in webserver for testing purpose

 
@tereško Nope.
 
@Eugene , well .. it is a fluid layout with a sticky footer
@Feeds , you suck
 
9:22 AM
@tereško I know, I see, but I for example wouldn't want to work in such backend. I'm using Twitter Bootstrap for backend in my application. For now everything seems great. Will see later how it goes.
 
good morning gentlemen
 
anyone, this question: is there someone from GMT+02 or GMT+00, but not from GMT+01? I need the output from this function print_r( localtime(time(),true));
 
$ php -r "print_r( localtime(time(),true));"
Array
(
[tm_sec] => 22
[tm_min] => 29
[tm_hour] => 9
[tm_mday] => 2
[tm_mon] => 2
[tm_year] => 112
[tm_wday] => 5
[tm_yday] => 61
[tm_isdst] => 0
)
 
you are GMT+00 @Leigh?
 
@Vlad: Yes
 
9:36 AM
whats the difference between UTC and GMT. I am UTC+01 but i get that i am two hours further aording to GMT and this function print_r( localtime(time(),true));
i get this output Array ( [tm_sec] => 49 [tm_min] => 36 [tm_hour] => 11 [tm_mday] => 2 [tm_mon] => 2 [tm_year] => 112 [tm_wday] => 5 [tm_yday] => 61 [tm_isdst] => 0 )
 
i have the following code and i´m gettin crazy with calling an auto_increment id

$sql = "INSERT INTO tablename (x1, x2) VALUES(?,?)";
if($query = $db->prepare($sql)){
$query->bind_param('ss', $x1, $x2);
$query->execute();

$id = mysqli_insert_id($query);

for a reason i don´t know why this is not working. i also tried

$id = mysqli_insert_id($sql);

and

$id = mysqli_insert_id();

could someone please be that friendly and would say what i´m doing wrong with that? i just decided to work with mysqli. before that i only used mysql where i had no problem with
 
@Vlad: Pretty sure UTC+1 doesn't officially exist. As far as I understand while UTC = GMT+0, all offsets are referred to as GMT+x, not UTC+x
@John: Did you try mysqli_insert_id($db); ?
@John, also, use PDO
 
OMG thats it! thanks alot. you saved my day! have a nice day.
 
Morning
 
according to this I am UTC+01 why php localtime() gives i am two hours further, any idea bout this?
 
9:51 AM
@Vlad: Is your date wrong and the machine thinks it is summer time? :D
 
@Leigh no my pc is correct it shows UTC+01. I think the apache or php.ini is not configured properly, or maybe something else? what do you think?
 
check the timezone in php.ini
 
weird it says "Europe/London" :)
its sumerr time :D
 
Sumer Time? Ancient Bablyonian ;)
 
9:59 AM
maybe localtime() gives meridian time, which is not the same as we use the time
Am I right?
@Gordon no php localtime gives I am two hours further which is considered summer time instead of winter time which is UTC+01 not UTC+02
 
@Vlad that was a joke. mind the emoticon
 
so time() always give meridian time ?
not what we actually use
 
I feel dirty, using REGEXP in my queries :(
 
Hello all
I wonder if anyone can help me with an issue I am having. In relation to php-cgi.exe on IIS7. I know it is a server question but you might have knowledge on the topic.
 
how it is possible to run this function localtime(time(),true) on the same apache server but in two different php files and both give two different results?
two hours difference.
when i run index.php with this function it gives it is 12 oclock. when using custom made script like test.php it gives it is 10 oclock which is GMT+00. how is this possible on same apache server
 
@Vlad: runtime configuration, per directory php.ini values
 
ouu but it has date_default_timezone_set thats why. it sets to Izrael time :)
yes so time() and date and whatever time functions work according to timezone in php.ini
 
Good morning
 
good evening :D
 
11:11 AM
@hakre turning bold text to italics is a somewhat superfluous edit, isnt it?
 
@Gordon No, bold sucks big time.
 
@hakre i'd say that boils down to personal preference. its definitely not a worthwhile edit.
 
@Gordon Ah fine, that will not make you press the rollback button ;)
you don't really wanna argue about it, aren't you?
 
@hakre no, i wont rollback. I already got copy editor ;)
 
@Gordon Me as well, since long time. I just did the edit to show what would happen if you override the bold function with the italic implementation ^^
 
11:34 AM
hi
anybody have idea abt this erro r
 
Sorry, I don't click links from people with names that hurt my eyes.
 
@Leigh i didnt get you ?
 
good
I don't like to be got before I've had a cheese and pickle sandwich
 
12:34 PM
If I execute a PHP script in CLI and I get a windows MsgBox with an error message which needs the press of OK, should I report this as a bug?
Error Message is: Class DOMNodesArrayIterator could not implement interface Iterator, MsgBox Title is Fatal error.
What happens if the script is headless?
 
hi guys. Is it possible to detect local timezone with php somehow?
I can set up fixed value in php.ini but what if I am in different time zone and i am not the owner of the site
?
 
> PHP 5.1.2 Fixed bug #30760 (Remove MessageBox on win32 for E_CORE errors if display_startup_error is off). (Ilia) - bugs.php.net/bug.php?id=30760
@Vlad You can set it manually as well when your script starts or you can use user-ini files.
 
@Vlad: You ask the same question in here over and over again, did you actually think about posting a question on SO?
 
:D i am talkin about detecting the current timezone. time() function works accordingly to php.ini
 
> PHP Crashes and issues a windows message box - bugs.php.net/bug.php?id=36978
 
12:44 PM
uhhh
 
well i gues it is stupid qustion. there is only one website
and one timezone :)
 
> Bug #32304 Invalid exception code hangs server thread. - bugs.php.net/bug.php?id=32304
I think I should report it.
 
but still how to adjust the user time if i dont know his timezone?
 
In case someone missed it PHP 5.4.0 released!
 
12:48 PM
for example if i have a textfield that has current local time. how to adjust to be the time of the user that access the page
wooo :D thanks
 
@Gordon
 
@hakre check out the first pin
 
Can any of you guys explain why a PDOException is generated (SQLSTATE[HY000]: General error) when my framework attempts to $stmt->fetch() after an INSERT query?
 
inserts don't support fetch()?
 
1:03 PM
I've just changed my codebase so PDO throws exceptions rather than outputting warnings
the way the code works at the moment is the first result is fetched automatically (if possible)
@ircmaxell so... instead if checking if(false !== ($result = $stmt->fetch()) ) {...} should I wrap it in a try...catch?
 
@ircmaxell I looked there but didn't see it oO ;)
 
No, you souldn't call fetch on insert queries
 
Anyone using windows?
I don't find the PHP setting that is changing some behaviour.
 
@ircmaxell hmm, ok... how can I identify what kind of query it is? I've got access to the PDOStatement and the original SQL string.
 
> php -r "class Foo extends DOMNodeList implements Iterator {}"
gives me a message box with a fatal error. But if I use the `-n`switch things are fine:
> php -nr "class Foo extends DOMNodeList implements Iterator {}"
 
1:09 PM
don't try to automated fetch. Fetch from the are where you make the query
 
good morning
 
afternoon
 
open up email. see this: Lynette Gough North Alabama Web Developers

Hi, could you help me? I've forgotten more about Front Page than I ever knew. My work is very simple. Can a great helper help a novice out?
cry.
 
hey @ircmaxell
Could you give me a quick overview of what the current state of scalar type hinting is?
I haven't been following the discussions closely, as they were quite OT and overlonged, so I would appreciate a short summary of what the current state is :)
 
1:27 PM
@NikiC some folks want them, some preliminary patches, core devs bored of history repeating, to summarise: business as usual. :P
 
@salathe Yeah, I got the political part (that's why I don't read it), but I'd be interested in the technological part a bit more :)
 
@NikiC oh, so you were just wanting to know about @ircmaxell's patch? ;)
 
@salathe I'm not sure what I want myself :D
 
Just some overview of whatever is appropriate :D
 
1:29 PM
umm, am i blind or is there no function to get all class constants?
apart from reflection
 
gratefully ;)
I mean, there can't be functions for everything, right? (wrong!)
 
@NikiC frankly, I've gotten sick of most of what they were going around with
 
@ircmaxell welcome to php-src :)
 
So I put together a POC to show what I was thinking
 
You mean the function ((int) $a) {} approach?
 
1:32 PM
yes
I think it's a heck of a lot more useful than function foo (scalar $bar)... That's all but useless to me...
 
Is the (int) really supposed to stay so, or is this only temporary to make the patch simpler?
@ircmaxell definitely
 
@NikiC I'm in the middle on that. Part of me likes the implication, and the difference from the class casts. So it's dead simple at a glance to know if it's a class type hint or a scalar one...
 
@ircmaxell I also like that it clearly shows that it's a casting typehint
But I dislike everything else about it ^^
I mean, it just feels ugly
 
oh?
 
foo (int $a) seems much nicer.
I don't know, the parenthesis make it feel so lispy. And lispyness in non-lispy languages is very unlispy
 
1:35 PM
Well, but that can cause collisions and BC break, since you can have a class int... So it's an inconsistency...
 
Yes, it's a tough question
 
yup...
 
One could argue that those could be simply disallowed. It's not like they are used much
 
and that's why I picked (int) for now, as it's both easy to implement, clear to read and actually in a weird way indicates what's happening (although not exactly)
@NikiC Well, that's still a BC break
This concept already has a deck stacked against it, so I'd rather have as little against it as possible
 
It really is a tough question ^^
 
1:40 PM
yeah, which is why I posed that to the list
I think I'm just going to work on a production worthy patch, make the decision myself, and then justify it in an RFC
 
Pro:
* Indicates that it is casting
* Does not break BC
* Simple implementation
* Leaves open the option for stricter type hints in the future
Con:
* Ugly
 
Yeah, not arguing that...
 
function add((int) $a, (int) $b) {
    return $a + $b;
}
Looks strange
 
but if you can come up with a better idea that still keeps most of those pros, I'm all ears
 
Oh, no, not saying anything against it
Just thinking loud ^^
 
1:43 PM
(and I'm not too worried about simple implementation, as long as it's possible)
@NikiC as am I. I agree it isn't the cleanest looking think in the world. But I'm stuck on how else to implement it without breaking either BC or possibility of stricter types later...
if you can think of a way, I'm all ears and willing to build a POC...
 
Especially that double (( at the start looks strange.
 
posted on March 02, 2012 by Ilia Alshanetsky

My slides from the Confoo presentation on PHP 5.4 are up and can be viewed/downloaded from here: http://ilia.ws/files/confoo_php54.pdf I look forward to everyone's feedback either on this blog or via Joind.in. And in case you didn't know, PHP 5.4 was released yesterday!

 
@NikiC Yup
it muddles whether or not it's a definition or a call...
but anyway, off to work
 
And I think there will be a big outcry from the community about this, if it is going to be implemented
 
to get around people who have classes called int, you could just (int)(int) $a ... ;D
 
1:46 PM
Just like they hated the \ ns sepraator
 
later
 
hm you could actually use the \ operator to differentiate between classes and builtin types when using that syntax (\int) would be the class, (int) would be the type
 
@ircmaxell later
 
@NikiC You can't apease all of the people all of the time
 
2:05 PM
@ircmaxell But we should try
eh, I hate merging on svn
 
Hi all ^_^
 
hiya @Neal
 
posted on March 02, 2012 by Ulf Wendel

Cache all queries which match a schema pattern is one of the few visible feature additions to PECL/mysqlnd_qc 1.1, the client-side query cache plugin for the mysqlnd library. As usual, this client-side cache is mostly transparent, works with all PHP MySQL APIs (mysql, mysqli, PDO_MySQL) and, of course, supports various ...

 
@Neal hey
 
Just browsing through those confoo PHP 5.4 slides. It mentions __invoke() which has been in since 5.3, did something change with it? (slides obviously come without dialogue)
 
2:14 PM
@Leigh Not that I know of
I think that was a fault on ilia's side ;)
 
that's a shame, (not that I can think of anything else i'd like __invoke to do - just that more magic is always awesome)
 
@Leigh :D
Well, some people would argue that magic is evil, but ...
 
well those people are muggles
 
:D
 
Hey, has anyone here ever used Behat?
 
2:20 PM
Oh, call time reference passing, I didn't see that in the list of features before, nice! :)
 
@Leigh Yes, it was removed
Not added ;)
 
oh
:(
well I never used it before, so I guess its no loss
 
symfony2? o.O
 
2:40 PM
@NikiC Well, that's why the discussion and POC patch
 
This is interesting: bugs.php.net/bug.php?id=53823
@ircmaxell Yep :)
 
odd, I wonder if it's because of the output encoding
 
It will be good.
 
If I wanted to submit a fix to PHP, how would I get involved?
 
Yeah, I'm going to do a "full patch" this weekend, something intending to be committed if approved
 
2:41 PM
@ircmaxell With you working on it, everything will be good :)
 
:-D
 
@Incognito Do you want to submit a fix?
 
I just realized it's been patched.
 
what was it?
 
I came across a bug when doing this answer but it's been patched. (I think.)
 
2:42 PM
@bjori not sure, I see genuine interest from @ircmaxell @nikita_ppv (ok, they are new blood, but still)
^^ That is odd, since you haven't chimed in at all on the subject...
 
@ircmaxell No idea where that came from ^^ But I do have genuine interest, I just don't like politics much :P
 
posted on March 02, 2012 by blog.phpdeveloper.org » PHP

For those that know me, you know I’ve been working here at SoftLayer for about the last year and a half. I’ve definitely enjoyed my time here, it’s time to move on. My last day here will be a week from today. Following that I’ll be moving over to another local Dallas company called iSight Partners where I’ll be using some of the skills I’ve learned here at SoftLayer to help improve their curre

 
user895378
Quick opinions anyone? Stylistically, do you only start your try blocks with code that may throw an exception or do you sometimes group in logically related lines before the specific bits that might result in an exception?
 
I'm not sure what your second case looks like.
 
user895378
@Incognito I guess that really answers my question: there's no point in having extraneous lines that you aren't trying to catch an exception from inside the try block.
 
2:52 PM
@rdlowrey: Personally I only put the exception triggering code in the block
 
:-D
 
@rdlowrey Whatever is going to be less error prone and more maintainable. I still can't visualize what your cases look like.
Pretend that after you write this code you'll have to make big changes after lunch.
 
user895378
@Incognito Thanks for the input ... I'm not going to post an example for the second case because I think hearing it from others made me realize it's a pretty straightforward case. It muddies the water for what might actually be the cause of a caught exception if you include extra lines before the line that could throw.
 
user895378
@Leigh thanks for your thoughts as well
 
@rdlowrey Sounds like you're on the right path.
 

« first day (503 days earlier)      last day (4431 days later) »