cvs: ZendEngine2 / zend_compile.c /tests 022.phpt

[email protected] ("Johannes Schl??ter")
Newsgroups php.zend-engine.cvs
Message-ID <cvsjohannes1204379590@cvsserver>
johannes		Sat Mar  1 13:53:10 2008 UTC

  Added files:                 
    /ZendEngine2/tests	022.phpt 

  Modified files:              
    /ZendEngine2	zend_compile.c 
  Log:
  - Allow implementation of abstract methods with optional parameters (Christian
    Schneider)
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.804&r2=1.805&diff_format=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.804 ZendEngine2/zend_compile.c:1.805
--- ZendEngine2/zend_compile.c:1.804	Sat Feb 23 21:24:18 2008
+++ ZendEngine2/zend_compile.c	Sat Mar  1 13:53:10 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_compile.c,v 1.804 2008/02/23 21:24:18 helly Exp $ */
+/* $Id: zend_compile.c,v 1.805 2008/03/01 13:53:10 johannes Exp $ */
 
 #include <zend_language_parser.h>
 #include "zend.h"
@@ -2482,7 +2482,7 @@
 	}
 
 	/* check number of arguments */
-	if (proto->common.required_num_args != fe->common.required_num_args
+	if (proto->common.required_num_args < fe->common.required_num_args
 		|| proto->common.num_args > fe->common.num_args) {
 		return 0;
 	}

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/022.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/022.phpt
+++ ZendEngine2/tests/022.phpt
--TEST--
Implementating abstracting methods and optional parameters
--FILE--
<?php

abstract class Base
{
	abstract function someMethod($param);
}

class Ext extends Base
{
	function someMethod($param = "default")
	{
		echo $param, "\n";
	}
}

$a = new Ext();
$a->someMethod("foo");
$a->someMethod();
--EXPECT--
foo
default
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.