« first day (1305 days earlier)      last day (3643 days later) » 

12:00 AM
I haven't stepped through the zend_hash_str_del() yet ... that's the next step.
 
I'd help but I don't have PHPNG set up yet, sorry.
 
No worries :)
Hmm, I take it that there was some excitement in the room while I was away? :)
 
Well a few users were going nutso on Kolink (or Niet the Absol or whatever he goes by now)
 
@Jack Also, it was illuminating that certain rep-farmers appear to be upvoting each other. As well as people being dicks to them.
 
yeah, Shankar and Kolink appear to be repwhore buddies.
 
12:04 AM
For a site that is based on 'gamification' there doesn't seem to be a coherent plan to make the rules prevent behaviour that people object to.
 
They must live in an IRC channel somewhere; they don't use chat.stackoverflow.com
 
There is absolutely no reason for people not to upvote all the things......and if they collaborate occasionally upvoting is a net positive for the people who do it.
So, the resulting behaviour is not surprising.
 
@LeviMorrison How did you figure that out? :)
 
@Jack Levi had already posted a decent answer to a question, and the subsequent rep-farm attempt got downvoted, and claims were made by upvote buddies that people were 'rep-raeping' the rep-farmer.
As well as the duplicate answer getting to about +6/-6
Which summoned the Shoggolith.
¯\_(ツ)_/¯
 
Ah, everyone can enjoy a good game of politics.
 
12:22 AM
I've forgotten the number of times he(?) was called out for rep++
Audits can be quite ridiculous sometimes .. look at this one ... now, why would they tag this with ?
This is a safety measure to prevent you installing and using such a dreadful programming language if you aren't really, really sure about it. — sudowned 57 mins ago
Everyone's a joker ^^
Valgrind: More than 10000000 total errors detected. I'm not reporting any more.
 
12:52 AM
^^
@Jack Sounds like you or PHPNG has some serious issues.
 
Not me, I have the hammer!
It seems that when an array is packed, it still tries to update the ->arHash field when a new indexed value is inserted.
Could be the way in which the array is initialised, though.
 
I think array_init is a packed array (0 indexed, sequential)
Internal code may have to specifically convert or something.
 
@LeviMorrison I wish that were true, but this hangs too =(
The best part, if I insert the record at position 0 it works fine .. another clue :)
 
1:31 AM
I love when companies use English names for foreign employees.
 
does anyone have a simple example of a PRG?
 
@webarto In some cases, I prefer it that way :)
@LeviMorrison Think I found it! github.com/php/php-src/pull/673
 
1:53 AM
Hey all. I'm running a LAMP server without using MYSQL yet, and most certainly not using perl; however, I'm seeing this all over the error logs: Execution error - PCRE limits exceeded (-8): (null) Any ideas?
 
So, it's a LAP server?
 
@Jack hehe... yeah sorta. :)
 
Are you sure they're PHP related?
 
Not really... I haven't used mod_security before, so I'm a bit of a newbie on this stuff.
I figured you guys might have come across this before. Google isn't doing me any good tonight.
 
Hmm, I found this article.
Not sure whether that solves anything, but it might.
 
2:00 AM
Yeah... I found that on google, but it doesn't really state why its happening.
Nothing in mod_sec_audit.log either...
 
It tends to happen if the backtrack limits are too low.
I LOVE the hammer!
 
Another question... Do you recommend that I use the optional_rules from OWASP for mod_security ?
 
Link?
 
I'm thinking of shutting it off because most of my errors are from these rules. owasp.org/index.php/…
Those base rules are for mod_security
 
heh
 
2:13 AM
The folders are linked to in mod_security.conf github.com/SpiderLabs/owasp-modsecurity-crs
 
What's a good name for start, end if we're talking about time period?
OCD
 
You can have either (start, end) or (start, duration)
 
@HelpingHand mod_security seems to love getting in the way...particularly if you just use some other schmoe's filtering rules
 
I prefer using mod_obscurity :)
 
i prefer not writing broken code :)
 
2:20 AM
@Jack Thanks.
@cHao I've never had need for this "added security".
 
@cHao Agreed. So optional_rules necessary, recommended?
 
Either your code sucks or you'll get pwned by botnet.
 
@webarto My code probably sucks.
 
So... that won't make it better, fix your code.
 
Or make the server private, that always helps for me :)
 
2:21 AM
@Jack How'd you do that?
 
Bind Apache to 127.0.0.1 or ::1 >D
 
@Jack What's the point?
 
Security.
 
@webarto me either. frankly, it only seems useful to me if you're plopping a pre-built app in the site and running it without changes
 
@cHao Yeah, yeah. Because you can't guarantee for it, and you're securing yourself as much as possble.
 
2:24 AM
@webarto I am using ssl though... and I'm not too worried about my users doing something to the site (fam and friends)
 
@HelpingHand SSL is not there because of you.
 
@webarto What do you mean?
 
SSL is there to protect your fam and friends.
 
That ^^ and using SSL in this case seems a bit overkill imho
Unless there's a remote possibility that they're the victim of MitM
 
OK, how to name a table with aforementioned data, user_periods ^^ ?
It's for validity of the service they bought.
 
2:27 AM
user_periods? that sounds .... gender biased somehow
What does it mean?
What are they periods of?
 
Unrelated example. You bought a domain today (start), it will expire in a year (end).
 
Why can't I see what the Error is. On youtube, when they forgot to put in a ; an error along with which file and which line on that file was displayed. When I get an error, I just get "Server Error

500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
 
(Sigh)... Well I'm gonna rest on it. Too much of this server stuff tonight. Good night/day/evening/morning.
 
Something like service validity interval.
I'm bad with words there.
 
Night all... Signing out.
 
2:28 AM
Night.
 
@webarto So you call it user_domains?
 
Installing webserver should take no less than half hour.
 
if your server gets attacked, the only thing SSL will do for you is give you a little more faith in the evidence in the access logsnight
 
@Jack Multiple services, thought "normalizing" the periods in separate table, dunno why. Thanks.
@cHao Hah!
 
@webarto well, if you have multiple tables that each have (start) and (end) ...
... you could create a separate timeperiods table and dependent tables will have <xyz>_timeperiod_id.
 
2:36 AM
Yes, something like that, last time I thought about it, opted for that, few months ago.
Thanks.
 
No problem :)
 
Gone.
 
Many thanks.
Not sure what I hated more, the question or the tag.
 
2:49 AM
Look at the answer, lol
 
We're doomed, doomed I tell ya!
Seriously, I'm not insulting, but how can anyone be that stupid?
It goes against common sense.
There is an error in your answer, Array is indented. — webarto 6 secs ago
 
@Jack Yeah man, definitely. "if the ht is packed, then the "str" key delete must fails , right?"
 
Thanks your answer JakeGould. Here, orange is value and 12 is id of [0]. [0],[1],[2],[3] are not a index of array. Its is items. — hoangdung 5 mins ago
> Its is items.
 
You definitely should have known that.
 
> Its is
 
2:52 AM
:D
 
@LeviMorrison Yeah, because arHash is not allocated :)
 
Why not do the conversion outside of the function?
 
Hmm?
 
Any particular reason to do it inside?
 
If the conversion can be done outside, the pre-condition of the function must change to: can only delete from nonpacked arrays.
Which is kinda silly.
Besides, _zend_hash_add_or_update() does the same thing.
@webarto Blegh, Handel is a bit boring to my taste heh
Or, repetitive I should say .. for this piece.
 
2:56 AM
Must, not... fall... asleep.
 
Great film score music :)
 
Anyone want to help me try and understand how class extensions work, and why I can't access the parent object ($this) from within the child class?
 
@Hybridwebdev Example?
 
@Hybridwebdev codes pls..
 
For example:

class parent class {

$this->something="foo";

}

class child extends parent {
echo $this->something
 
2:59 AM
Not a valid syntax, mate.
 
@webarto Presto ;-)
 
yeahyeah... it is fixed — HenryW 6 mins ago
 
well obv ignore missing closures etc
 
@Jack You really enjoy classical music :P
 
heh
 
3:01 AM
From what I can ascertain, whilst you can use a parents methods from within an extended class as such:

parent::some_method();

You should be able to address any variables etc stored within the parent object as usual
 
@Hybridwebdev There is no such thing as a parent object.
When a class extends another, the parent is a class, not an object.
 
the instances of $this
 
Objects are instances of classes.
 
@Hybridwebdev You use parent if you've already overloaded the method in current class.
 
Inside the methods of a class, $this is always the current class.
^^ and that.
 
3:02 AM
if I have $this->some_var within the parent class, how do I access it from within the child?
 
Like you've wrote.
 
but if I echo $this->something within the child class, it's empty
 
It should't be if something is declared protected or public in the parent class.
 
@Hybridwebdev, you probably want to review the manual pages on OOP in PHP 5.x
 
We're talking hypothetically here, there's no code.
 
3:05 AM
Oh trust me, I have. As well, been a long time reader at SO, just can't wrap my head around this part of OOP
 
We've discovered many "OOP" peculiarities here, but your's is just a RTFM.
 
so you have to declare a variable as protected or public within the parent class first?
 
Paste code...
Try it for yourself, eih.
 
class parent {

$this->something = "foo";
}

class child extends parent {
echo $this->something;
}
 
That's not a valid syntax, try harder.
 
3:08 AM
@LeviMorrison Blah, I've updated the fix :)
 
How is that not valid syntax? It's perfectly valid.
 
@Hybridwebdev, please please please go read through the relevant manual pages and experiment with actual code before continuing.
 
I have
<?php class validate_select_array extends formz {

public function __construct ($parent) {
//$this->parent = $parent;
}

public function validate_select_array($array) {
var_dump($this);
foreach ($this->form_entry_array['array_list'] as $check) {

if (($check['value'] == $array['post_value'])) {

return array('value'=>$check['value']);
}

}
return array('value'=>'', parent::add_error_message(array('message'=>'Invalid charachters.')));
}
}
 
php > class parent {
php {
php { $this->something = "foo";
php { }
PHP Fatal error:  Cannot use 'parent' as class name as it is reserved in php shell code on line 1
^^ At the PHP interactive prompt. That syntax is completely totally bogus.
 
> class validate_select_array extends formz
 
3:09 AM
Also, please use the "fixed font" button / select and hit Ctrl+K. Makes it possible to actually read...
 
You can get shot for this in certain circles.
 
canhaz_class_extension(foo, bar)
 
Well I'm looking for insight into what my issue is, not pointers on best coding practices :)
 
You haven't explained the problem yet.
 
You're problem is not following best coding practices :)
 
3:12 AM
the issue is we couldn't get what your issue is...
 
You've given us unworking examples and the way you're explaining things tells us you don't know what you're doing yet... and the code you provided, while it makes me cry a little, it isn't obviously broken...
So, let's start over.
You've pasted a bit of a class above. What's wrong with it?
I mean, other than everything.
Also, without knowing what the contents of the formz class are, we're gonna have a hard time helping.
 
I cant access parent variables from within the child class
 
=.=
 
Which specific variables are you unable to access, and where are they defined?
Also, did you know there are like four or five different PHP projects called "formz?" Disturbing.
 
3:14 AM
I'd c/p the formz code, however it's around 400 lines of code. Essentially it's a class to dynamically build forms that I developed. I'm looking to add "modules" that can be used for validation
that's not surprising, there are a lot of these kind of projects floating around.
 
They all suck. Even the good ones. Which one did you pick, in specific?
 
Form is probably the most ungrateful thing to work with, and you've decided you can be smarter?
 
I built my own from the ground up, just because yeah they do suck majorly. Most of them either force you to use sessions, or force you to use javascript. I want to build a class that serves as a platform that can have JS ext added with
 
But meh, #YOLO.
 
Okay. So, let's try again. You still haven't described the problem. Which specific class variable from the parent are you unable to access, what happens when you try (you have error_reporting cranked all the way up to -1, right?), and what other research have you done?
 
3:18 AM
I speak from experience when I say that a good forms framework is a myth.
 
Seriously. The instant you go beyond trivial form creation with even the "best" of them, it becomes a nightmare.
 
People who made them said they suck.
 
@charles, the way I code, I basically store all variables within $this; $this->1, $this->2 etc. I want to be able to access all variables within the child class
 
You access parent methods using the parent keyword.
 
$this->1 ??
 
3:20 AM
well in a perfect world, a good form class will allow you to throw some arrays or variables at it, output the html and take care of things like auto-populating form data etc
@jack it's an example
 
@Hybridwebdev *sigh* ... okay, let me lay it out for you, my friend. We don't see the parent class, and we don't see inside your head. Go put the parent class up on pastebin or something, please, and then lay out a specific, answerable problem for us. "I can't access variables" is not something we can answer.
 
A bad one.
 
Just FYI, I don't think this Q should be closed (hence why I answered it): stackoverflow.com/q/23619127/538216
 
@LeviMorrison You got more upvotes than repwhore, congrats!
 
3:21 AM
@LeviMorrison btw, did you actually notice that $timeout is never actually used by the original code?
 
include( plugin_dir_path( __FILE__ ) . '/validation/plain_text.php');
 
@Charles Yes, and so did the person who asked the question.
 
Okay good
@Hybridwebdev Thank you. Give me a few to review things.
 
disregard the includes, it's temporary
 
3:22 AM
foreach ($_POST as $key => $value) {
        $this -> post_array[$key] = $value;
}
I am not sure... are you for real?
 
$this->post_array = $_POST; ... maybe?
 
mmm
that's actually a good point
thanks for pointing that out
 
Yay, I made an actually good point today.
 
method_exists('formz', "build_" . $array['type']) restricts any child classes, you should use $this instead of 'formz'
 
3:24 AM
($array['array']['name'] && ($array['array']['name_array'])) ? $this -> options_array[$array['array']['name']][$array['array']['name_array']] = $temp['value'] : $this -> options_array[$array['array']['name']] = $temp['value'];
:D
Stop, stop.
 
With all that code, it seems a lot easier to just type the HTML and do some templating. :P
 
At this point, it's maybe better you use Zend Form or something...
 
Also, I don't see any escaping going on here. Anything that could have come from the user needs to pass through htmlspecialchars before you stick it back into the form...
 
it does
if you trace the code, everything is run through a function that is supposed to access the "modules" I want to add and validates, then output
both in and outgoing
 
$this->form_entry_array['error']['error']['error_messages'][] = $array['message'];
Hnggggg..
Hokay. Now, lemme see here...
Sorry, that reminded me of some of the code we have, which does stuff like $this->fields['fields']
 
3:28 AM
:D
It's funny when errors have errors.
 
I can't help but feel some people are likely experiencing brain seizures while reading my code
 
psdfjoipa oejf
 
To be honest, I find it difficult reading your code.
 
I've seen worse. Dude, we still run worse, in production, powering mid-eight-figures worth of sales a year.
 
So... still the original question remains... why can't you access properties?
@Charles Every enterprise ever.
 
3:30 AM
Oh yes, I have seen and fixed much worse myself. I freelance, so I've seen a lot of terrible spaghetti
 
Also, it's worth noting that you've never actually declared any of the properties you're accessing. This tells me that you aren't actually using error_reporting(-1);... please go fix that, then fix all of the new warnings and notices that show up...
Oh, wait, I forgot.
 
@Charles He's maybe thinking getter can work here magically.
 
PHP doesn't warn you when you create an undeclared property...
 
Implicit public properties, yay.
Declare __set() to throw exceptions.
 
That's awesome.
 
While I do appreciate all the critique, what I'm trying to grasp is why none of the parents variables are unavailable within the child
 
^repwhoring the wrong way
 
@Hybridwebdev Which specific variable are you missing? Be specific. Don't say "none" or "all". Say like "$this->foo when I access it on line 99"
 
$this->form_entry_array['array_list'] for example
 
@Chris hammered it! :D
 
3:35 AM
That property only seems to get created when you call add().
At least, as far as I can see so far.
 
@Jack ka-chow! TY
 
but from within the add() the child class function is called
 
Wait. Wait, wait, wait.
I have a question.
 
$class_name = ($this->form_entry_array['validate']['function']) ? 'validate_' . "{$this->form_entry_array['validate']['function']}" : "";

if (class_exists($class_name)) {

// old one

$b = new $class_name($this);
$temp = $b->$class_name(array(
'post_value'=>($array['name'] && ($array['name_array'])) ? $this -> post_array[$array['name']][$array['name_array']] : $this -> post_array[$array['name']],
));
 
Okay, I think I see the problem.
CLASS INHERITANCE DOES NOT WORK THAT WAY!
</Morbo>
So, you're creating a new validation class instance.
 
3:38 AM
yes
 
I love Morbo haha
 
That validation class does inherit the methods from the declaration of the formz class.
However.
That instance -- the instance of the class contained in $b, does not get a copy of $this.
You've created a brand new instance of the validation class.
It has its own internal data.
 
so essentially passing it through the construct, or through the function argument is the only way to access it?
 
Inside of it, $this is it, not the parent.
Correct. And then, honestly, it shouldn't be derived from that parent, as that makes no sense.
 
Your validation class really should be taking in an instance of formz to validate.
 
3:41 AM
that's pretty much my goal, thus why I want to pass $this to the child, because I want access to all of the parents variables
 
So, I again encourage you to go review the PHP 5.x OO manual pages... and while you're at it, please look up the SOLID principles. It's heavy reading, and conceptually difficult, but beginning to understand them will help you avoid OO design pitfalls...
 
class Charles {};
$charles = ((new  ${!${''}=$charles='Charles'}))->{$charles} = $charles;
not works,,, help its URGENT
 
Well correct me if I'm wrong here. I KNOW I'm likely doing it ass-backwards here. In fact I know I am, since I had to fudge the function to even call the child class
 
@webarto Parse error: syntax error, unexpected -> (T_OBJECT_OPERATOR) in php shell code on line 1
:)
 
3:43 AM
yea not works
 
However, my understanding is, the way class extensions SHOULD work, is you develop the base class, and then use the child class to build on that
 
@Hybridwebdev So, pass $this in to the child, access it as something else... and then make sure that the properties that you need to access are expressly declared public... and it could work.
 
obv I can'
 
@Hybridwebdev No... well.. I mean, yes, but no. Hold on, let me type a thing.
 
@Hybridwebdev Base class... no such thing...
 
3:44 AM
obv I can't change the parents variables from within the child, unless I pass them back
 
^^ That, also.
 
Your entire concept is based on false premise.
And, yes, I'm speaking exactly what I would want to hear from someone I turned to help me.
 
Classes exist for multiple purposes.
 
Well my concept is the form class, that has all the primary functions associated with it, then the child classes act as modules. If i'm wrong, the child class is instantiated instead of the parent class
 
Sometimes, people use them to collect related functions together.
Sometimes, people use them to collect related data together.
Sometimes, people use them to collect data and their related functions together.
The first case is an antipattern. Don't do that.
In the second and third cases, you use inheritance to change something about the base class without actually changing it.
However, the child is still a copy of the parent.
It can and should do everything the parent does.
Now, let's think about your validation code.
Is your validation class also a form builder?
 
3:49 AM
no
 
Bingo.
 
it's an extension of the parent
 
No, it's not.
It shouldn't be.
The thing you're trying to do with the validator is to ... validate. Right?
 
So, all of the code it contains - including in any hypothetical parent class - should be related just to performing validation tasks.
 
3:50 AM
The "S" in SOLID -- single purpose
 
All of the data that it needs to operate should be provided to it,.
 
Sever your validation bits from the form builder class.
Have them accept just the data to be validated, either at construction time or in another method.
 
that's 100% my goal
 
Soooo... what's stopping you.
If you're calling the validator from the form builder, then the form builder has all the data.
The form builder then just needs to pass that specific data into the validator, right?
The validator shouldn't reach out and grab the data itself.
 
3:52 AM
okay, to clarify. The form class does everything. It takes in input, it builds and populates form elements.

The idea is, to dynamically pass say "some_func" as one of the parameters to the formz class, and then have the formz class instantiate and call the relevant class
see, that way I can add the module, and then just pass an argument to the formz class and it automatically checks for and calls the module
 
Is some_func a function, a function that returns a class name, a method name of the form builder class, a class name of the validator, etc?
 
again I realize it's somewhat unorthodox, but I believe it's got its merits
 
It is not unorthodox
 
$class_name = ($this->form_entry_array['validate']['function']) ? 'validate_' . "{$this->form_entry_array['validate']['function']}" : "";

if (class_exists($class_name)) {

// old one

$b = new $class_name($this);
$temp = $b->$class_name(array(
'post_value'=>($array['name'] && ($array['name_array'])) ? $this -> post_array[$array['name']][$array['name_array']] : $this -> post_array[$array['name']],
));
what that does, is take the passed argument, check if the class exists and then instantiates it and calls it
 
OKay, so, yes, it's a class name.
 
3:56 AM
and yes, I really love shorthand syntax :)
 
That's what I thought, but you called it some_func and I got confused.
So, yes, that's ... fine.
However, your validator should still implement an Interface, and you should make sure that it implements that interface in your code before trying to call methods.
 
so in this sense, whilst the parents methods are available to the child, the data isn't inherited automatically. That seems...odd to me
 
Lemme draw a diagram.
This might take a bit.
No, actually..
here
 
@Hybridwebdev How so? If you define two variables, why would you expect data from one to be automatically inserted into another?
 
I really do appreciate the help :) I've been working with OOP for around a year now, and while I have the basic fundamentals down, stuff like reflection etc is just greek to me. Kinda like how I felt when I FIRST started studying PHP
 
3:59 AM
class Foo { public $x; }
class Bar extends Foo {}
$f = new Foo();
$f->x = 'hi':
$not_f = new Foo();
echo $not_f->x; // WHAT HAPPENS HERE?
 
Interface would not work if you name the function to be called the same name as the dynamically generated class name. Say your validator class is called "ValidateMyCareerChoice', the call is ValidateMyCareerChoice::ValidateMyCareerChoice() -- can't use interfaces. Should do away with that function name and make the validators implement a pre-determined class name, that way interfaces are feasible.
 
This isn't reflection. :) But don't sweat OO is hard to grasp. Takes practice.
 
@cypher because if a parents methods are inherited, why wouldnt the data be?
 

« first day (1305 days earlier)      last day (3643 days later) »