« first day (1590 days earlier)      last day (3374 days later) » 

12:00 AM
@bwoebi That would result in everyone disabling E_DEPRECATED as it would be far too annoying.
And mask actual deprecation things.
 
@ircmaxell I disagree.
 
They will have to deal with it. Also prevents (hopefully) new software from relying on that.
At least when php 8 comes.
 
They would deal with it by turning the warning off.
 
At least when php 8 comes.
 
holly shit, the Babylon 5 pilot episode (the gathering) was aired 22 years ago
also, on a different note: they the hell One-punch Man chapters are 2 weeks apart ?!
 
12:09 AM
@Danack for legacy, definitely. Question is… how much will need change in real projects?
 
12:24 AM
I want to add a feature to OpenCart that allows customers to add X number of items to their shopping cart, however I'm having some difficulties passing the quantity variable from my <input> to PHP
 
12:42 AM
@Kensing just limit user to input only numbers, no letters (using javascript) and double check it server side mh
 
@animaacija creating a binding between the input and my PHP variable is the problem
 
@Kensing what technique u use? post get , via ajax ?
 
get
 
no ajax ?
 
trying to do it the way OpenCart already does it with other variables
but it's not all that transparent to me
 
12:48 AM
is it the drop does selection box or just input field ?
 
right now only 1 item is added when you try to add multiple
 
usually in html input tags are provided with name (which will be GET variable key) and value attributes
 
aye
sorry that I don't have a more specific question
 
<option value="http://lidtgodt.dk/index.php?route=product/category&amp;path=59&amp;limit‌​=100">100</option>
should work like it is.
 
trying it out :D
same still, live with your example now, seems I'm missing something in my PHP
 
12:54 AM
yes, if you want to update value based on php's response u must use ajax/
it was not my example, it was raw paste from yr page :D
 
ah xD
 
have you really used fun_get_args like this? Why?

$fn = "func_get_args"; $args = $fn();
 
Keep reading - and that's not what I said.
 
k, I see the other message below :)
 
:-)
 
1:00 AM
function test(){}
test(1)
PHP warning: test() expects 0 parameters, 1 given, defined in ...
$fn = "test";
$fn(1)
PHP warning: test() expects 0 parameters, 1 given, defined in ...
@Danack quick tested here, it works
 
The point is that sometimes you're calling a function dynamically, and you can't be sure of how many params it needs, only that it needs at least x, but might also take more.
It's a feature to be able to do that, not a bug.
 
I am starting a new project, new to codignater, almost all classes have methods for add, edit, delete, listAll methods. Will it be a good practice to put them in an interface?
 
@Code Are you being forced to use CodeIgniter?
 
No.
@Danack No. Any good alternative?
 
Then I would recommend not using it - either Symfony or Laravel are more likely to be nice for your to use.
CodeIgniter was developed a long time ago. Even though they're trying to update it, it's probably better to go with something a lot of other people are actively using.
 
1:09 AM
@Danack Thanks for your suggestion. If i am not wrong, Laravel and Symfony also is based on MVC. Can i put those repetitive method names in Interface in Laravel or Symfony?
 
@Code You may do whatever you want.....however I don't think that is a useful thing to do. The top level of an application where a router dispatches requests to something that is going to handle them does not fit into an OO paradigm.
 
ok. I will go with Laravel. thanks @Danack
 
@Danack actually that's very debatable. I'd say people pass exceeding argument counts to non variadic and non variable-length argument functions by mistake or by pure bad design. Like on your example on the debug function. See python behavior:
def fn(a, b): return 1
fn(1, 2, 3)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: x() takes exactly 2 arguments (3 given)
 
"by pure bad design" I don't care. And this is the PHP way - it doesn't enforce you to do everything 'correctly'.
 
PHP only added this "feature" because of the func_get_arg*, func_num_arg issue.
 
1:15 AM
Feb 8 at 16:35, by rdlowrey
PHP is shit language, but it's easy. If you take away the "easy" part you're only left with a shit language.
 
it won't make the language harder, actually it's pretty good to catch bugs ;)
 
The other side is that I use static analysis for almost all of my code. The number of times where I have accidentally passed in too many vars is probably fewer than the number of times I've done it deliberately.
 
But that's what I just told you it's really bad. On the example about the debug function you gave me, both debug functions should have a compatible signature if you're planning to use then interchangeably... (that's really bad design) and most of the times this works against people. The proposal would also make userland functions match the same behavior of internal functions.
strlen(1, 2)
PHP warning:  strlen() expects exactly 1 parameter, 2 given on line 1
 
They're not debug functions normally - the extra parameter is just hacked in to allow me to debugging, and it will be removed before the code is checked in.
People aren't able to hack the internal functions.
 
you are using the wrong tool for debugging... you sould be using $debug = func_get_arg(2);
that's why this API exists ;)
Besides that, the proposal includes just a warning, production code won't break. We both agree that warnings are not part of production env right? Hum... maybe I could use a deprecate...
 
1:24 AM
@marcio Nah - that doesn't show up automatically in a debugger. When it's a param it's right there.
 
you really shouldn't be doing that :p that's the wrong reason for not wanting the argcount check, even languages more dynamic than PHP have that.
 
@marcio "We both agree that warnings are not part of production env right?" No. I have the same environment in dev as production. Warnings are either suppressed with the @ operator (e.g. for fopen) or are turned into exceptions. The separate dev / prod schema is not good.
@marcio "you really shouldn't be doing that" This is the strength of PHP .....not a weakness.
 
yea, I'm thinking about using a deprecate instead... you have no excuse to enable deprecated messages on production.
 
1 hour ago, by Danack
@bwoebi That would result in everyone disabling E_DEPRECATED as it would be far too annoying.
Using deprecated for anything other than a function that is going to be removed, is not clever.
And even then, I think deprecation is better done via documentation....
 
@Danack that's like saying "nobody will enable strict types because it's too annoying", in this context
@Danack not a strength, people should be using the func_get_arg* API or variadic functions if they want to handle arguments dynamically, not having functions taking wrong number of arguments at will.
And the proposal takes both use cases into account.
 
1:30 AM
> I would love to have strict type hints in PHP, and this may sound
contradictory, but they would almost never ever get triggered in my
code. The only time they would be triggered is when there is a mistake
and I have missed converting something to the expected type.
> Having the scalar type defined on the parameter allows for code
analysis tools to find errors. This would make cases where I forget to
convert them properly be almost non-existant. With asserts inside the
function those errors would only be detectable at run time.
Same thing with number of params. It's just not a problem in my code, and being able to use the hacky behaviour in an emergency is nice.
 
ok, I don't think it's a legit reason mostly because we have a dedicated API to handle variable-lengh arg lists. And the max argcount count check would be as good as the check for mim arg count IMMO.
 
It would probably be worth you adding to the RFC why you think it's an issue that needs addressing. I've never heard of people having problems with it.
 
I've seen people rambling about it right here on this room... but they stopped thinking about fixing it exactly because of the existance of the "func_get_arg*" API, hence the proposal being aware of it.
 
@marcio That's never been true with older var_args:
printf("Foo %s", $foo, $bar);
printf("Foo %s Bar %s", $foo);
One of those errors - the other is not treated as an error, as the function is able to carry out it's, er, function.
 
hummm, I'm pretty sure printf() is **intended** to be variadic... it's not an accidental behavior
(hope you are talking about the native printf function)
 
 
2 hours later…
3:21 AM
@marcio I don't want either behavior.
I've talked in the past about unifying php and internal function behavior on error, but I don't like either way we handle this currently.
 
yo little cat, what behavior?
 
Behavior such as passing too many arguments or too little.
I don't like how user-land handle them or how internals handles them.
 
@Danack I wrote a little use case FY gist.github.com/marcioAlmada/37002ffd2906b1a94df9
@LeviMorrison have you checked the RFC? wiki.php.net/rfc/strict_argcount
 
@marcio I haven't; I've been very busy.
 
What's the way users are handling it currently?
 
3:24 AM
@marcio Where is interface? WHAR?
 
@marcio Looks okay at a glance.
 
Danack hated it lol
 
Not sure about a few details.
Notably this one:
> this RFC also proposes to block func_get_arg(), func_get_args() and func_num_args() from being called dynamically by emitting a fatal error
 
That just totally isn't a problem for me - all of that is covered by interface based unit testing. And for pure functions within an application being refactored, that is what the 'find all usages' search is for.
 
In general I would actually want all var-arg functions to declare that with ...
I am uncertain if this proposal is a helpful stepping stone to that end.
 
3:28 AM
I don't know what to do about it... people using:

$fn = "func_get_args"; $args = $fn();
 
I can't think of a valid use-case for people dynamically calling func_get_args but it just seems odd to disallow it.
One point of feedback that has little to do with the RFC content:
Require two-thirds vote, always.
 
@LeviMorrison it is, it introduces a warning telling people about their errors and doesn't break code using func_get_arg* and func_num_arg api.
I see no impediment for not warn about that if it won't break code. People intentionally using this behavior should use variadic functions or func_get_args.
 
It's the latter part I disagree with.
I want all variadic usage to be declared as variadic using ...
I think PHP 7 would be too soon for such a change, in any case.
 
@LeviMorrison oh, but that will never happen, if we are going to add the argcount check it should take func_get_arg into account.
 
I'll think about your RFC. The general idea is good, but as with all RFC the details often break the deal.
 
3:34 AM
what's the worst detail FY?
 
@marcio I'm going to bed - but it totally breaks code. I've already explained above the (shitty) reasons I like the current ability to pass extra params. Although it's admirable that you're enthusiastic about making things better, the way you shrug off feedback is not.
 
@Danack Can you link this to me
@marcio I'd have to think about them. It sometimes takes a while for the impact of RFCs to really settle into people's minds.
(This is one reason I think a vote on scalar types would be rushed for PHP 7)
(We've barely had a functional patch; how can we truly understand the impact it makes yet)
 
@Danack I'm not shrugging your arguments. In fact your example (about the debug function) was making use of two incompatible functions interchangeably and I pointed it, this is not shrugging.
@LeviMorrison this one is hard to swallow for some people but I consider it in the same level as warning about converting arrays to strings. Some people see it as a feature, but it would be very useful to catch bugs.
I made a small user story because I already know this will have to explained many times: gist.github.com/marcioAlmada/37002ffd2906b1a94df9
 
hi guys
 
3:50 AM
@LeviMorrison From here down. That code is a nasty hack, but it's one that works now and has been useful in the past.
I actually do like the Javascript way of allowing function to proceed even if they don't have sufficient arguments, and inserting 'undefined' for the missing args. Yes, it's not a way of writing provably correct code - but it's sometimes really useful.
 
You really like JavaScript's behavior on this one? o.O
 
@marcio You were shrugging off Levi's point that it's a language change, and so needs 2/3 vote.
@LeviMorrison It's case where usability overcomes reasonability.
s/case/a case/
 
Ugh. If I wasn't handed the expected args I want a hard-failure. I do not like coding in a world where theoretically every argument could be undefined.
 
@Danack sorry, but no, you got it wrong. He told me that because the RFC says:
> TODO: check if it requires 2/3 majority before put into discussion.
 
It breaks code that currently works - what's to discuss?
 
3:54 AM
O_o I'm not discussing this...
 
Well nn then.
 
I haven't disagreed with his advice, in fact I didn't know that it would require a 2/3 majority and he informed me.
 
Does 3v4l have any known issues right now?
Look at this: 3v4l.org/gaNPV
I don't think I'm using # anywhere >.<
 
you just broke 3v4al :D 3v4l.org/i6LCu
or maybe they are using my new lexer xD
 
4:15 AM
I wandered through all 100 pages of a github search for "func_get_args" and eveybody is using it as a direct call: github.com/…
not a single obfuscated call :) that's great to know
 
5:16 AM
Is there any reason to use the old PHP array syntax? I like the short syntax much better? Backwards PHP compatibility is the only thing that comes to mind
Also, when did nested functions in PHP become a thing? This is nice.
 
5:31 AM
So funny lmao
 
6:26 AM
oh my gods this codebase
    $row = $db->query_row("SHOW COLUMNS FROM `Items` LIKE 'status'");
    return array_map(create_function('$a', 'return trim($a, "\'");'), explode(",", preg_replace('/^.*\((.*)\).*$/', '\1', $row[1])));
That code extracts the legal values out of a MySQL ENUM field.
 
6:55 AM
@Charles hahaha, I've done something awful like that in my developer infancy
although I did it with a simple regex: preg_match_all('/\'(.*?)\'/'.....
 
Yeah, no idea why they made it this complicated.
or why they even did it.
 
buddies got a minute for me
got in to a big problem
any one
 
Just ask.
 
it use to work before output is a xml file . its on hostgator server and same code is working on my xamp local host
trying from past 4 hours and spoke to hostgator and its effecting my other stuff
 
@farooqshaik "Warning: get_headers(): This function may only be used against URLs"
so whatever you're passing to it isn't a valid URL.
Double check that it's an actual fully-qualified URL.
 
7:00 AM
its working on local host
headers are for generating xml
 
 
2 hours later…
8:56 AM
morning
 
9:11 AM
morning
 
morning ...
/me is sick
 
@JoeWatkins :-( get well soon, good thing it's a sunday...
 
9:36 AM
thanks, feel so rough, but can't lay in bed anymore ... so figure I'll get up and just carry on with day ...
stupid feeble human body ...
Pierre is really pissing me off
 
10:29 AM
@farooqshaik that's a really terrible name for a website
and it has a high possibility to backfire
 
10:57 AM
$email=$this->email->find(12);
$email_data=$email->with('attachment')->get();
It returns all the emails and associated attachments. All I want just find associated attachments.
I don't want to fetch the attachments like this because I need the email data too
$email=$this->email->find(12)->attachments;
 
Moo rning
 
11:32 AM
morning
 
user1804599
hello
 
11:53 AM
@JoeWatkins Tea helps me a lot in those days.
 
12:21 PM
Hey guys,
Would you recommend me to code in the Model-View-Controller architecture?
 
@HassanAlthaf try reading blog.ircmaxell.com/2014/11/…
 
Oh, can you share a nice application which highly focuses on separation of concerns? @RonniSkansing
 
nope, dunno what that should be, do you need a example to focus on the separations?
 
12:36 PM
Remember kids, it's all about SoC
 
Hi, would anyone know how to access the (body)-contents of a node (article), via FTP (via the directory structures)? Or is this perhaps saved in the SQL? Thanks.
 
@Jimbo I already am doing it. ;]
 
@VincentVerheyen what?
 
:) @RonniSkansing - I want to recreate my website (but can currently not access my website, due to an error " PDOException: SQLSTATE[42S02]: Base table or view not found:") .... I would like to save the contents of my articles though and copy them. Is this possible via FTP access or via PHPMyadmin?
 
@VincentVerheyen are you using a CMS of some sorts?? Your articles are probably saved in the mySql database which you can export and import via phpmyadmin
 
12:47 PM
Yes, I'm using Drupal @RonniSkansing - Sorry: I hadn't mentioned that. My apologies ...
 
@VincentVerheyen no problem, I am not really familiar with drupal.. but are you moving the site from one domain to another? and which version of drupal?
and yea, the articles are saved in the database and can not be accessed via. the ftp
 
@RonniSkansing I'm using the latest version (not the dev), I would like to stay on the same domain, but just recreate the website from scratch; since I am experiencing problems with this Drupal installation. So I would like to re-install Drupal completely. - Thanks a lot, I'll try to research some more in the hope of finding the article's contents.
I am wondering if I would do a 1-click-install this time ... I'll might try that out.
 
oh, so you are trying to do a fresh install?
 
Yes, at the moment I can't access the website via URL, completely offline...
 
you should do a complete backup of the old stuff
download all the files via. ftp
and go to phpmyadmin and export the database
 
12:52 PM
Yea, that I already did. You are indeed right about the content of the articles stored in MYsql: drupal.stackexchange.com/questions/105179/…
 
then delete it all (files and database, upload your new drupal files, edit the some config file (host, username, password) and follow the install instructions
 
Will do in a minute, but I would first like to find exactly the contents of the articles in the MYsql, since I can now still easily access the database.
Ok, they are inside field_data_body
 
you should export all of the database
 
This I did, but I don't just want to import them all at once, since I want a fresh install to clear out some issues.
 
1:12 PM
Guys, you wouldn't believe this. A stupid whiteboard cleaner which hardly takes 5 minutes to make got the 3rd prize in our Science and Technology Fair. But, my accounting system which I worked on for over a month didn't even get a merit award. :/
 
What school is that?
 
Lyceum International School, Sri Lanka.
 
But what was so special about this whiteboard cleaner then?
 
Nothing
 
@HassanAlthaf What was so special about your accounting system then?
 
1:17 PM
Its speed and mathematical accuracy.
 
I think you shouldn't be too bothered by this prestige. Physical schools have many problems. Be sure to keep on studying and spreading your stuff digitally though, that's my advice.
 
@HassanAlthaf People can look at a chemical reaction (or the results thereof) and go "cool". Technology projects are much harder for non-developers to understand.
 
Ikr. :/
I got great comments from my Computing Teachers and Parents, however, the examiners were blank.
A lot of students parents asked copies of the system and I did give them.
 
/me wonders how bad the coders / computers in Hassan's country are if "speed" and "mathematical accuracy" are things
They must be all running original Pentium 1 chips or something
 
LOL
I meant,
If you try to do a Trial Balance in real life,
You'll have to add up crap loads of transactions and balance so many accounts, which takes a couple of days.
Or if it is a small business, at least a day.
But with a system like this, you can generate trial balances, etc in just a fucking second.
Look how much time you save.
you don't even need a pen/your journals, all you have to do is get on your phone/desktop and logon to the site the system is hosted in, login and log the transaction. Simple as that.
 
1:25 PM
The examiners were probably academics who have never had to deal with finances =D
 
Exactly.
Examiners were all Advanced Level science subject teachers
 
But they know how to erase penises from whiteboards and what a pain it can be if the wrong pen is used
 
lol
You see that?
The whiteboard cleaner wasn't even atleast like that.
It was a tiny white board
With a wooden stick which is fixed horizontally in it
and below it, there's a brush.
To use it, you have to manually slide it up and down
 
That's even better - if the eraser is bolted to the whiteboard, no one can steal it and you don't have to hunt around for half an hour when people do put penises on your whiteboard
 
lol
Its not bolted, its just fit.
And with so much effort, you gotta slide it up and down a couple of times
And you know what got the second prize?
An umbrella with LEDs mounted on top of it and the person claims that those are water proof and so you can travel with some kinda light.
First prize deserved it anyway, it was an automated shirt folder.
 
1:39 PM
Hi all, my php page is not running on my webserver , I have checked apache2.4 is configured properly
Whenever I go to the page it makes me download the php file
Any ideas?
 
@loosebruce Have you restarted Apache since configuring PHP?
 
@loosebruce httpd.conf in pastebin plz
(unrelated)
 
This is my website loosebruce.co.uk
I just upgraded from Apache 2.2
 
You don't have an internal handler registered within Apache for application/x-httpd-php
ugh, I'd forgotten how stupid Apache is :-(
 
Here is my apache2.conf pastebin.com/a4f3ZkvK
 
1:46 PM
@DaveRandom I've been to two talks where people have said that there's not much speed difference between Nginx and properly configured Apache.......so hard not to shout out, "NO1CURR - using nginx means you don't need to configure Apache."
 
@Danack Also that's absolutely, 110% definitely, only true in the context of serving PHP, Nginx blows Apache away in terms of perf wrt. static content (I'm confident because I've tested it myself). But yeh, that's totally not why I use Nginx, I don't operate any sites that need the perf, I use it because it's, y'know, sane.
Also, I do wonder if a native SAPI for Nginx might give it the edge. but I suspect not enough of an edge to make it worth the effort
 
Ok I restarted apache
Checked 000-default is pointing at the right directory in sites enabled

Anything else?
 
If PHP had native nbio that could be muxed in with Nginx's ev loop though... could be a very different story
 
A sane cgi SAPI....would be a good start.
 
@loosebruce presumbly somewhere in mods-enabled/ is where you want to look. since there's no PHP related config in your httpd.conf itself
 
1:53 PM
Ok I am in that folder, what should I be looking at?
 
@loosebruce Well I'd guess that there's some file with "php" somewhere the name
Within your httpd.conf there are these lines:
# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

...

# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf
 
0
A: How is my voting system? Any security, design or other issues?

Hassan AlthafFirstly, lets talk about the coding standard issues which can be found here. Have a space between a keyword and a curly brace. It improves readability without making it a clutter. However, you should not open the braces for Classes and Methods in the same line as the keywords. This is how you d...

 
^^ somewhere in that lot, a file is (should be) included that contains the PHP related config
 
There is no php5 module there, I just tried a2enmod php5
 
1:59 PM
/me has totally forgotten how to configure apache/mod_php
 
Yay, I followed this tutorial
Turns out when upgrading my php5 install didnt add the module into apache2 directory
Oh may have spoken too soon
 
Guys, where do you buy VPS? Any vouches? Looking for a Linux one.
 
@HassanAlthaf prometeus.net/site <-- had a VPS there for a couple of years, no complaints
 
brb, got to go clean out the fireplace before my house becomes >50% ash
 
ThW
2:06 PM
Morning
 
morning
 
Has anyone experienced valgrind slowing down massively during a "php run-tests.php -m" run?
Taken almost an hour to get to TEST 85/241
 
2:21 PM
0
A: How is my voting system? Any security, design or other issues?

JimboA Vote should not have access to the database. It should be a dumb 'entity' with setters, getters and a constructor to make the required object a valid one. You should take a look at the Repository and Data Mapper patterns. The point is, the object you want to save should not know how it is save...

 
Hey guys, how do you fetch an associative array with all the column data in MySQLi Prepared statements
 
@Jimbo +1
 
@HassanAlthaf google.co.uk/… ?
 
It don't show any scenarios for Prepared Statements @Danack
Nvm, I found one on SO.
 
just curios well we ever see some cool features such as class accessibility modifiers like Public,Private classes in a namespace, enums,` __setStatic` and __getStatic in the near future ? these are on my wish list :)
 
2:26 PM
@someone '__getStatic' wat?
 
magic method for getting static properties in a class similar to __callStatic for methods
 
how about a killing off the __callStatic instead
 
you will kill facades in laravel i think
 
Yes everyone will benefit from that, especially laravel
 
:)
 
2:28 PM
@someone That's a good thing. Perhaps we can kill off Laravel next.
 
Without the statics proxies in laravel, it would be much easier for us not to get distracted by the "magic spooky action" and actually talk about the code in laravel
atleast it is better then Yii, CodeIgniter and etc.
 
@someone If you want to do this, you can accomplish exactly the same thing with global variables.
 
it's too ugly to use global variables for this
 
@someone it is as ugly
as using a static call to a magic method to call the method on a object (in a not static context) that you really wanted call when you started.. and call it "convenience"
 
@someone THEY'RE THE EXACT SAME THING. A VARIABLE REFERENCED BY A STATIC GLOBALLY RECOGNISED NAME. You just feel better using it as a static var on a class because you can pretend that you're not using global variables.
 
2:31 PM
I'm not fast enough
 
Guys what is the best way to handle user sessions in PHP?
Like logging them off appropriately, and having secure sessions
 
@HassanAlthaf depends on what you are using the session for
 
@RonniSkansing like for Users, Moderators, Administrators.
Idk how to say
 
yes it's the same only looks better. but you didn't answer my question what about enums and class accessbility modifiers @Danack. i saw an RFC on enums it's inactive since 2010
 
@someone it does not look better imo..
 
2:33 PM
Uh, like handling users to have maximum logged on times and to automatically log them off after an x amount of time and log them off automatically if they leave the website.
 
User::getAll();
 
@RonniSkansing why do you hate __callStatic() ? it's really good that you don't have to instanitate the object every time you need to use some of it's method.
 
@someone if you instanitate the object when you need to use it, you are doing it wrong
 
@RonniSkansing do you know any nice user system which I can study? Study as in like understand how it handles stuff
 
someone the dependencies should be injected in the construct preferably by reflection injection imo, you could also do this in laravel
 
2:37 PM
@RonniSkansing call static will be faster than using reflection
 
@someone oh.. how much? And When did you then instantiate the object?
 
"it's really good that you don't have to instanitate the object every time you need to use some of it's method." Except for factory methods, if you don't need to instantiate an object to use it, you should have written it as just a function.
 
@HassanAlthaf try looking into handling the sessions in the database.. =] this makes it easier for example to count the number of active users and etc.
 
@Danack it's not that simple methods depends on other things you will have to use globals if don't want to inject $eloquent for example. it will be too ugly and the code won't be separated into separate parts like in classes and we will go back to procedural style
 
@someone and if you do not think that is a premature optimization, do not user reflection injectinon, just inject them manually
I think you are too attached to laravel and the common frameworks and need to try and break free from those mind-cages
 
2:42 PM
@someone "you will have to use globals" No I won't. I can do dependncy injeciton on functions: github.com/rdlowrey/auryn "we will go back to procedural style" Sometimes procedural code is better. Not using it, and just always using classes is dumb.
 
Also the use of the spooky::action(); hides the dependencies away in the class
 
Have runtime-decided variables that need to be injected into an object that you want to dependency inject? Use a factory :-)
 
@someone why not use laravel without doing the static calls? I know you can do that
 
@Danack procedural style is better when you have simple helpers but will quickly grow to become spaghetti code. @RonniSkansing "mind-cages" they are not if you understand what's happening do you really want to use PHP in the wild ? development speed has increased significantly when i used laravel.
and i tried a lot of frameworks
 
@someone Ok.....you need to stop making sweeping statements about how the way Laravel does stuff is the one true way.
 
2:48 PM
no it's not nothing is perfect
 
@someone no.. I do not always want to use php, it is really powerfull and fun, it is my favorite lang for hack and work. But I try when it is possible to write what I think and feel is good code. Just because it allow for static magic does not mean I would use it, it looks and feels like globals, it hides information in the class, its ugly and would also be ugly in other languages. I did not say, do not use laravel, I said, do not use the static facades and I think even Taylor would agree
It is a mere marketing tool for creating a low barrier and get all those who fled from CodeIgniter 2 into a new framework imo
and btw. notice that
$app['router']->get('/', 'HomeController@showWelcome');
 
yes i did notice this. but don't know why i like using them
:)
 
Yea.. lol I am done rambling [= I really do not hate laravel as much as others in this room...
 
they use them heavily in the docs. so they developed an habit. maybe in the next versions they will change this
 
3:03 PM
I don't hate it - I just hate the way it makes people stupid and say things like 'don't use procedural code'.
 
@Danack really ? i didn't say don't use procedural style.
and relying on OO is not stupid
is C# stupid because there is no procedural style can someone say that ?
 
Yes. Any language that lacks functions is (at least on one level) fundamentally stupid.
 
    public function displayMessage(Array $messages, $errorType)
    {
        $data = [];

        if ($errorType == 'Error') {
            $data['errors'] = new \ArrayIterator($messages);
        } elseif ($errorType == 'Success') {
            $data['messages'] = new \ArrayIterator($messages);
        }

        $html = $this->frontendRenderer->render('Homepage', $data);

        $this->response->setContent($html);
    }
                {% for error in errors %}
                <div class="error">
                    {{ error }}
                </div>
                {% endfor %}

                {% for message in messages %}
                <div class="success">
                    {{ message }}
                </div>
                {% endfor %}
I handle my Twig template like this, however.
I get this error:
An exception has been thrown during the rendering of a template ("Array to string conversion") in "Layout.html" at line 98.
 
@HassanAlthaf It sounds like you are trying to convert an array to a string - probably on line 98.
Also, pastebin or gist....
 
Ok, sorry, let me do it asap.
Template File: pastebin.com/h3CLrWFi
 
3:16 PM
2 mins ago, by Danack
@HassanAlthaf It sounds like you are trying to convert an array to a string - probably on line 98.
 
@Danack I know, how do I loop the elements of the array in there and display it there?
 
@Danack and what really functions are ? they are the same. think of a function as a book in a library the library has sections called classes and bigger sections namespaces. procedural style does not have those sections. everything in one place that's the different
 
@Danack I googled a lot but still can't seem to fix it, thats why I came to this chatroom.
 
yesterday, by Danack
People - someone asking a question twice is not spam. It's annoying but spam is for things like "Click for sexeh chicks".
Same goes for walls of text.
@HassanAlthaf Two things i) If you knew that was your question, you should ask that as your question. Asking "I get this error:...." does not tell people what you are actually after. ii) The first link (and probably the others) show you exactly how to loop over arrays in Twig. What more information do you need?
 
3:23 PM
Oh, I got my problem after debugging a bit.
My template is perfectly fine but my looping isnt.
PHP logic problem
 
@HassanAlthaf 99% of PHP problems can be solved with var_dump common errors like this are not even worth asking
 
array(1) {
    ["errors"]=> array(2) {
        [0]=> string(2) "Hi”
	    [1]=> string(3) "Hey”
    }
}
Thats my array, how do I loop over that?
Nvm, done it.
 
3:51 PM
can you explain more
 

« first day (1590 days earlier)      last day (3374 days later) »