[PHP-CVS-DAILY] cvs: ZendEngine2 / ChangeLog

2008-06-25 Thread changelog
changelog   Thu Jun 26 01:31:56 2008 UTC

  Modified files:  
/ZendEngine2ChangeLog 
  Log:
  ChangeLog update
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/ChangeLog?r1=1.1324r2=1.1325diff_format=u
Index: ZendEngine2/ChangeLog
diff -u ZendEngine2/ChangeLog:1.1324 ZendEngine2/ChangeLog:1.1325
--- ZendEngine2/ChangeLog:1.1324Sat Jun 21 01:31:50 2008
+++ ZendEngine2/ChangeLog   Thu Jun 26 01:31:56 2008
@@ -1,3 +1,24 @@
+2008-06-25  Felipe Pena  [EMAIL PROTECTED]
+
+* (PHP_5_3)
+  tests/is_a.phpt:
+  - Fixed test
+
+* tests/is_a.phpt
+  tests/magic_by_ref_008.phpt
+  tests/magic_by_ref_009.phpt:
+  - Fixed tests
+
+* zend_builtin_functions.c:
+  - MFB: Removed E_DEPRECATED on is_a()
+(http://marc.info/?l=php-internalsm=121390431523970w=2)
+
+* (PHP_5_3)
+  zend_builtin_functions.c:
+  - Removed E_DEPRECATED on is_a()
+(http://marc.info/?l=php-internalsm=121390431523970w=2)
+  [doc]
+
 2008-06-20  Dmitry Stogov  [EMAIL PROTECTED]
 
 * zend_compile.c
@@ -24313,7 +24334,7 @@
 2003-06-10  Jani Taskinen  [EMAIL PROTECTED]
 
 * zend_multiply.h:
-  - Missing $Id: ChangeLog,v 1.1324 2008/06/21 01:31:50 changelog Exp $ tag
+  - Missing $Id: ChangeLog,v 1.1325 2008/06/26 01:31:56 changelog Exp $ tag
 
 2003-06-10  James Cox  [EMAIL PROTECTED]
 
@@ -26037,7 +26058,7 @@
   zend_types.h
   zend_variables.c
   zend_variables.h:
-  - Added some missing CVS $Id: ChangeLog,v 1.1324 2008/06/21 01:31:50 
changelog Exp $ tags, headers and footers.
+  - Added some missing CVS $Id: ChangeLog,v 1.1325 2008/06/26 01:31:56 
changelog Exp $ tags, headers and footers.
 
 2003-01-30  Ilia Alshanetsky  [EMAIL PROTECTED]
 




[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard formatted_print.c

2008-06-25 Thread David Coallier
davidc  Wed Jun 25 08:56:42 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   formatted_print.c 
  Log:
  - Hackish but working parameter parsing, no longer using 
zend_get* at least
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/formatted_print.c?r1=1.82.2.1.2.16.2.4r2=1.82.2.1.2.16.2.5diff_format=u
Index: php-src/ext/standard/formatted_print.c
diff -u php-src/ext/standard/formatted_print.c:1.82.2.1.2.16.2.4 
php-src/ext/standard/formatted_print.c:1.82.2.1.2.16.2.5
--- php-src/ext/standard/formatted_print.c:1.82.2.1.2.16.2.4Tue Jun 24 
22:53:01 2008
+++ php-src/ext/standard/formatted_print.c  Wed Jun 25 08:56:42 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: formatted_print.c,v 1.82.2.1.2.16.2.4 2008/06/24 22:53:01 davidc Exp $ 
*/
+/* $Id: formatted_print.c,v 1.82.2.1.2.16.2.5 2008/06/25 08:56:42 davidc Exp $ 
*/
 
 #include math.h  /* modf() */
 #include php.h
@@ -760,14 +760,22 @@
php_stream *stream;
zval **arg1;
char *result;
-   int len;
+   int num_args, len;

+   /**
+* Here's the deal, I extract the first resource, it's 
+* a ressource, then a string and then an array. In theory
+* the parsing should be rsa however, if I do so, the 
+* Argument number checking in php_formatted_print fails.
+* I am therefore leaving this check here so I do not break
+* php_formatted_print
+*/
if (ZEND_NUM_ARGS() != 3) {
WRONG_PARAM_COUNT;
}

-   if (zend_get_parameters_ex(1, arg1)==FAILURE) {
-   RETURN_FALSE;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z+, arg1, 
num_args) == FAILURE) {
+   return;
}

php_stream_from_zval(stream, arg1);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard formatted_print.c

2008-06-25 Thread Dmitry Stogov
David,

Are you going to run make test before commits?

I see more than 60 new failed tests and some of them show memory corruption.
make doesn't work too, as it crashes during phar.phar build.

Also why don't you commit to HEAD?

Thanks. Dmitry.

David Coallier wrote:
 davidcTue Jun 24 22:53:01 2008 UTC
 
   Modified files:  (Branch: PHP_5_3)
 /php-src/ext/standard formatted_print.c 
   Log:
   - New parsing parameter API
   - Tests have been adjusted, if you have something else failing
 let me know now! All tests seem to pass fine at the moment.
   
   
 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/formatted_print.c?r1=1.82.2.1.2.16.2.3r2=1.82.2.1.2.16.2.4diff_format=u
 Index: php-src/ext/standard/formatted_print.c
 diff -u php-src/ext/standard/formatted_print.c:1.82.2.1.2.16.2.3 
 php-src/ext/standard/formatted_print.c:1.82.2.1.2.16.2.4
 --- php-src/ext/standard/formatted_print.c:1.82.2.1.2.16.2.3  Mon Mar 17 
 23:06:32 2008
 +++ php-src/ext/standard/formatted_print.cTue Jun 24 22:53:01 2008
 @@ -16,7 +16,7 @@
 +--+
   */
  
 -/* $Id: formatted_print.c,v 1.82.2.1.2.16.2.3 2008/03/17 23:06:32 stas Exp $ 
 */
 +/* $Id: formatted_print.c,v 1.82.2.1.2.16.2.4 2008/06/24 22:53:01 davidc Exp 
 $ */
  
  #include math.h/* modf() */
  #include php.h
 @@ -373,26 +373,22 @@
  static char *
  php_formatted_print(int ht, int *len, int use_array, int format_offset 
 TSRMLS_DC)
  {
 - zval ***args, **z_format;
 + zval ***args = NULL, **z_format;
   int argc, size = 240, inpos = 0, outpos = 0, temppos;
   int alignment, currarg, adjusting, argnum, width, precision;
   char *format, *result, padding;
   int always_sign;
  
 - argc = ZEND_NUM_ARGS();
 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, +, args, argc) 
 == FAILURE) {
 + return;
 + }
  
   /* verify the number of args */
   if ((use_array  argc != (2 + format_offset)) 
   || (!use_array  argc  (1 + format_offset))) {
   WRONG_PARAM_COUNT_WITH_RETVAL(NULL);
   }
 - args = (zval ***)safe_emalloc(argc, sizeof(zval *), 0);
  
 - if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
 - efree(args);
 - WRONG_PARAM_COUNT_WITH_RETVAL(NULL);
 - }
 - 
   if (use_array) {
   int i = 1;
   zval ***newargs;
 @@ -690,6 +686,7 @@
   if ((result=php_formatted_print(ht, len, 1, 0 TSRMLS_CC))==NULL) {
   RETURN_FALSE;
   }
 +
   RETVAL_STRINGL(result, len, 0);
  }
  /* }}} */
 @@ -731,18 +728,17 @@
  PHP_FUNCTION(fprintf)
  {
   php_stream *stream;
 - zval **arg1;
 + zval **arg1 = NULL;
 + zval **args = NULL;
 + int num_args;
   char *result;
 + zval **format;
   int len;
 - 
 - if (ZEND_NUM_ARGS()  2) {
 - WRONG_PARAM_COUNT;
 - }
 - 
 - if (zend_get_parameters_ex(1, arg1)==FAILURE) {
 - RETURN_FALSE;
 +
 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z+, arg1, 
 args) == FAILURE) {
 + return;
   }
 - 
 +
   php_stream_from_zval(stream, arg1);
  
   if ((result=php_formatted_print(ht, len, 0, 1 TSRMLS_CC))==NULL) {
 
 
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard formatted_print.c

2008-06-25 Thread David Coallier
2008/6/25 Dmitry Stogov [EMAIL PROTECTED]:
 David,

 Are you going to run make test before commits?


I have

 I see more than 60 new failed tests and some of them show memory corruption.
 make doesn't work too, as it crashes during phar.phar build.

I have ran the tests on standards/tests/strings/ let me run it on the whole repo
maybe the failing tests are in my skipped tests, can you send me the
list of failing tests?

I have some failing tests but they are the same that were there before
I applied my patch:

Test posix_strerror() function : error conditions
[ext/posix/tests/posix_strerror_error.phpt]
Test posix_strerror() function : usage variations
[ext/posix/tests/posix_strerror_variation1.phpt]
Test session_save_path() function : variation
[ext/session/tests/session_save_path_variation5.phpt]
Bug #34657 (If you get a communication problem when loading the WSDL,
it fatal's) [ext/soap/tests/bugs/bug34657.phpt]
Sort with SORT_LOCALE_STRING [ext/standard/tests/array/locale_sort.phpt]
parse_ini_file() multiple calls
[ext/standard/tests/general_functions/parse_ini_file.phpt]
highlight_file() and output buffer [ext/standard/tests/strings/006.phpt]
php_strip_whitespace() and output buffer [ext/standard/tests/strings/007.phpt]

And from what I see, most of the failing tests are simply outdated
messages but nothing affected by my changes.

Moreover, phar builds just fine here, have you cvs up'ed? what OS are you on?


 Also why don't you commit to HEAD?

Haven't you noticed that I am not the only one not committing to HEAD?
We are doing this for the 5_3 release since this is the most realistic
and close one from now. I agree that it HEAD should be kept to date
but if you are to pick on me, pick on everyone who is doing this
zend-parse-parameter cleanup move please. This is not the first commit
related to the cleanup.


So just send me a list of your failing tests (offlist presumably)
Thanks,

-- 
Slan,
David

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard formatted_print.c

2008-06-25 Thread Dmitry Stogov
I would suggest you to revert your patches and commit them when they are
ready and tested. For now your patch is just invalid.

Also please run tests on debug build, as it shows some memory corruption
errors.

=
TEST RESULT SUMMARY
-
Exts skipped:   46
Exts tested :   33
-

Number of tests : 7215  6022
Tests skipped   : 1193 ( 16.5%) 
Tests warned:3 (  0.0%) (  0.0%)
Tests failed:   73 (  1.0%) (  1.2%)
Expected fail   :4 (  0.1%) (  0.1%)
Tests passed: 5942 ( 82.4%) ( 98.7%)
-
Time taken  :  257 seconds
=

=
FAILED TEST SUMMARY
-
Formatted print functions [tests/strings/002.phpt]
Bug #16069 (ICONV transliteration failure) [ext/iconv/tests/bug16069.phpt]
iconv stream filter [ext/iconv/tests/iconv_stream_filter.phpt]
Persistent connections and mysql.max_persistent
[ext/mysql/tests/mysql_pconn_max_links.phpt]
mysql_pconnect() - disabling feature
[ext/mysql/tests/mysql_pconn_reuse.phpt]
Test fscanf() function: usage variations - float formats with resource
[ext/standard/tests/file/fscanf_variation10.phpt]
Test fscanf() function: usage variations - float formats with arrays
[ext/standard/tests/file/fscanf_variation11.phpt]
Test fscanf() function: usage variations - float formats with strings
[ext/standard/tests/file/fscanf_variation12.phpt]
Test fscanf() function: usage variations - float formats with boolean
[ext/standard/tests/file/fscanf_variation13.phpt]
Test fscanf() function: usage variations - string formats with strings
[ext/standard/tests/file/fscanf_variation14.phpt]
Test fscanf() function: usage variations - string formats with float
values [ext/standard/tests/file/fscanf_variation15.phpt]
Test fscanf() function: usage variations - string formats with resource
[ext/standard/tests/file/fscanf_variation16.phpt]
Test fscanf() function: usage variations - string formats with arrays
[ext/standard/tests/file/fscanf_variation17.phpt]
Test fscanf() function: usage variations - string formats with integer
values [ext/standard/tests/file/fscanf_variation18.phpt]
Test fscanf() function: usage variations - string formats with boolean
[ext/standard/tests/file/fscanf_variation19.phpt]
Test fscanf() function: usage variations - integer formats with integer
values [ext/standard/tests/file/fscanf_variation2.phpt]
Test fscanf() function: usage variations - char formats with integer
values [ext/standard/tests/file/fscanf_variation20.phpt]
Test fscanf() function: usage variations - char formats with float
values [ext/standard/tests/file/fscanf_variation21.phpt]
Test fscanf() function: usage variations - char formats with resource
[ext/standard/tests/file/fscanf_variation22.phpt]
Test fscanf() function: usage variations - char formats with arrays
[ext/standard/tests/file/fscanf_variation23.phpt]
Test fscanf() function: usage variations - char formats with strings
[ext/standard/tests/file/fscanf_variation24.phpt]
Test fscanf() function: usage variations - char formats with boolean
[ext/standard/tests/file/fscanf_variation25.phpt]
Test fscanf() function: usage variations - char formats with chars
[ext/standard/tests/file/fscanf_variation26.phpt]
Test fscanf() function: usage variations - octal formats with integer
values [ext/standard/tests/file/fscanf_variation27.phpt]
Test fscanf() function: usage variations - octal formats with float
values [ext/standard/tests/file/fscanf_variation28.phpt]
Test fscanf() function: usage variations - octal formats with resource
[ext/standard/tests/file/fscanf_variation29.phpt]
Test fscanf() function: usage variations - integer formats with float
values [ext/standard/tests/file/fscanf_variation3.phpt]
Test fscanf() function: usage variations - octal formats with arrays
[ext/standard/tests/file/fscanf_variation30.phpt]
Test fscanf() function: usage variations - octal formats with strings
[ext/standard/tests/file/fscanf_variation31.phpt]
Test fscanf() function: usage variations - octal formats with boolean
[ext/standard/tests/file/fscanf_variation32.phpt]
Test fscanf() function: usage variations - hexa formats with integer
values [ext/standard/tests/file/fscanf_variation33.phpt]
Test fscanf() function: usage variations - hexa formats with float
values [ext/standard/tests/file/fscanf_variation34.phpt]
Test fscanf() function: usage variations - hexa formats with resource
[ext/standard/tests/file/fscanf_variation35.phpt]
Test fscanf() function: usage variations - hexa formats with arrays
[ext/standard/tests/file/fscanf_variation36.phpt]
Test fscanf() function: usage 

Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard formatted_print.c

2008-06-25 Thread David Coallier
2008/6/25 Dmitry Stogov [EMAIL PROTECTED]:
 I would suggest you to revert your patches and commit them when they are
 ready and tested. For now your patch is just invalid.

 Also please run tests on debug build, as it shows some memory corruption
 errors.

 =
 TEST RESULT SUMMARY
 -
 Exts skipped:   46
 Exts tested :   33
 -

 Number of tests : 7215  6022
 Tests skipped   : 1193 ( 16.5%) 
 Tests warned:3 (  0.0%) (  0.0%)
 Tests failed:   73 (  1.0%) (  1.2%)
 Expected fail   :4 (  0.1%) (  0.1%)
 Tests passed: 5942 ( 82.4%) ( 98.7%)
 -
 Time taken  :  257 seconds
 =

 =
 FAILED TEST SUMMARY
 -
 Formatted print functions [tests/strings/002.phpt]
 Bug #16069 (ICONV transliteration failure) [ext/iconv/tests/bug16069.phpt]
 iconv stream filter [ext/iconv/tests/iconv_stream_filter.phpt]
 Persistent connections and mysql.max_persistent
 [ext/mysql/tests/mysql_pconn_max_links.phpt]
 mysql_pconnect() - disabling feature
 [ext/mysql/tests/mysql_pconn_reuse.phpt]
 Test fscanf() function: usage variations - float formats with resource
 [ext/standard/tests/file/fscanf_variation10.phpt]
 Test fscanf() function: usage variations - float formats with arrays
 [ext/standard/tests/file/fscanf_variation11.phpt]
 Test fscanf() function: usage variations - float formats with strings
 [ext/standard/tests/file/fscanf_variation12.phpt]
 Test fscanf() function: usage variations - float formats with boolean
 [ext/standard/tests/file/fscanf_variation13.phpt]
 Test fscanf() function: usage variations - string formats with strings
 [ext/standard/tests/file/fscanf_variation14.phpt]
 Test fscanf() function: usage variations - string formats with float
 values [ext/standard/tests/file/fscanf_variation15.phpt]
 Test fscanf() function: usage variations - string formats with resource
 [ext/standard/tests/file/fscanf_variation16.phpt]
 Test fscanf() function: usage variations - string formats with arrays
 [ext/standard/tests/file/fscanf_variation17.phpt]
 Test fscanf() function: usage variations - string formats with integer
 values [ext/standard/tests/file/fscanf_variation18.phpt]
 Test fscanf() function: usage variations - string formats with boolean
 [ext/standard/tests/file/fscanf_variation19.phpt]
 Test fscanf() function: usage variations - integer formats with integer
 values [ext/standard/tests/file/fscanf_variation2.phpt]
 Test fscanf() function: usage variations - char formats with integer
 values [ext/standard/tests/file/fscanf_variation20.phpt]
 Test fscanf() function: usage variations - char formats with float
 values [ext/standard/tests/file/fscanf_variation21.phpt]
 Test fscanf() function: usage variations - char formats with resource
 [ext/standard/tests/file/fscanf_variation22.phpt]
 Test fscanf() function: usage variations - char formats with arrays
 [ext/standard/tests/file/fscanf_variation23.phpt]
 Test fscanf() function: usage variations - char formats with strings
 [ext/standard/tests/file/fscanf_variation24.phpt]
 Test fscanf() function: usage variations - char formats with boolean
 [ext/standard/tests/file/fscanf_variation25.phpt]
 Test fscanf() function: usage variations - char formats with chars
 [ext/standard/tests/file/fscanf_variation26.phpt]
 Test fscanf() function: usage variations - octal formats with integer
 values [ext/standard/tests/file/fscanf_variation27.phpt]
 Test fscanf() function: usage variations - octal formats with float
 values [ext/standard/tests/file/fscanf_variation28.phpt]
 Test fscanf() function: usage variations - octal formats with resource
 [ext/standard/tests/file/fscanf_variation29.phpt]
 Test fscanf() function: usage variations - integer formats with float
 values [ext/standard/tests/file/fscanf_variation3.phpt]
 Test fscanf() function: usage variations - octal formats with arrays
 [ext/standard/tests/file/fscanf_variation30.phpt]
 Test fscanf() function: usage variations - octal formats with strings
 [ext/standard/tests/file/fscanf_variation31.phpt]
 Test fscanf() function: usage variations - octal formats with boolean
 [ext/standard/tests/file/fscanf_variation32.phpt]
 Test fscanf() function: usage variations - hexa formats with integer
 values [ext/standard/tests/file/fscanf_variation33.phpt]
 Test fscanf() function: usage variations - hexa formats with float
 values [ext/standard/tests/file/fscanf_variation34.phpt]
 Test fscanf() function: usage variations - hexa formats with resource
 [ext/standard/tests/file/fscanf_variation35.phpt]
 Test fscanf() function: 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard formatted_print.c

2008-06-25 Thread David Coallier
davidc  Wed Jun 25 10:16:52 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   formatted_print.c 
  Log:
  Reverted zpp API Cleanup patch - memory troubles?
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/formatted_print.c?r1=1.82.2.1.2.16.2.5r2=1.82.2.1.2.16.2.6diff_format=u
Index: php-src/ext/standard/formatted_print.c
diff -u php-src/ext/standard/formatted_print.c:1.82.2.1.2.16.2.5 
php-src/ext/standard/formatted_print.c:1.82.2.1.2.16.2.6
--- php-src/ext/standard/formatted_print.c:1.82.2.1.2.16.2.5Wed Jun 25 
08:56:42 2008
+++ php-src/ext/standard/formatted_print.c  Wed Jun 25 10:16:52 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: formatted_print.c,v 1.82.2.1.2.16.2.5 2008/06/25 08:56:42 davidc Exp $ 
*/
+/* $Id: formatted_print.c,v 1.82.2.1.2.16.2.6 2008/06/25 10:16:52 davidc Exp $ 
*/
 
 #include math.h  /* modf() */
 #include php.h
@@ -373,22 +373,26 @@
 static char *
 php_formatted_print(int ht, int *len, int use_array, int format_offset 
TSRMLS_DC)
 {
-   zval ***args = NULL, **z_format;
+   zval ***args, **z_format;
int argc, size = 240, inpos = 0, outpos = 0, temppos;
int alignment, currarg, adjusting, argnum, width, precision;
char *format, *result, padding;
int always_sign;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, +, args, argc) 
== FAILURE) {
-   return;
-   }
+   argc = ZEND_NUM_ARGS();
 
/* verify the number of args */
if ((use_array  argc != (2 + format_offset)) 
|| (!use_array  argc  (1 + format_offset))) {
WRONG_PARAM_COUNT_WITH_RETVAL(NULL);
}
+   args = (zval ***)safe_emalloc(argc, sizeof(zval *), 0);
 
+   if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
+   efree(args);
+   WRONG_PARAM_COUNT_WITH_RETVAL(NULL);
+   }
+   
if (use_array) {
int i = 1;
zval ***newargs;
@@ -686,7 +690,6 @@
if ((result=php_formatted_print(ht, len, 1, 0 TSRMLS_CC))==NULL) {
RETURN_FALSE;
}
-
RETVAL_STRINGL(result, len, 0);
 }
 /* }}} */
@@ -728,17 +731,18 @@
 PHP_FUNCTION(fprintf)
 {
php_stream *stream;
-   zval **arg1 = NULL;
-   zval **args = NULL;
-   int num_args;
+   zval **arg1;
char *result;
-   zval **format;
int len;
-
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z+, arg1, 
args) == FAILURE) {
-   return;
+   
+   if (ZEND_NUM_ARGS()  2) {
+   WRONG_PARAM_COUNT;
}
-
+   
+   if (zend_get_parameters_ex(1, arg1)==FAILURE) {
+   RETURN_FALSE;
+   }
+   
php_stream_from_zval(stream, arg1);
 
if ((result=php_formatted_print(ht, len, 0, 1 TSRMLS_CC))==NULL) {
@@ -760,22 +764,14 @@
php_stream *stream;
zval **arg1;
char *result;
-   int num_args, len;
+   int len;

-   /**
-* Here's the deal, I extract the first resource, it's 
-* a ressource, then a string and then an array. In theory
-* the parsing should be rsa however, if I do so, the 
-* Argument number checking in php_formatted_print fails.
-* I am therefore leaving this check here so I do not break
-* php_formatted_print
-*/
if (ZEND_NUM_ARGS() != 3) {
WRONG_PARAM_COUNT;
}

-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z+, arg1, 
num_args) == FAILURE) {
-   return;
+   if (zend_get_parameters_ex(1, arg1)==FAILURE) {
+   RETURN_FALSE;
}

php_stream_from_zval(stream, arg1);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /main main.c php_ticks.c php_ticks.h

2008-06-25 Thread Dmitry Stogov
dmitry  Wed Jun 25 12:18:22 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-srcNEWS 
/php-src/main   main.c php_ticks.c php_ticks.h 
  Log:
  Fixed bug #45352 (Segmentation fault because of tick function on second 
request)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1165r2=1.2027.2.547.2.1166diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1165 php-src/NEWS:1.2027.2.547.2.1166
--- php-src/NEWS:1.2027.2.547.2.1165Thu Jun 19 12:09:21 2008
+++ php-src/NEWSWed Jun 25 12:18:21 2008
@@ -8,6 +8,8 @@
   functions. (Andrey)
 - Fixed a bug where exec() on Windows would eat the first and last double 
quotes
   (Scott)
+- Fixed bug #45352 (Segmentation fault because of tick function on second
+  request). (Dmitry)
 - Fixed bug #45312 (Segmentation fault on second request for array functions).
   (Dmitry)
 - Fixed bug #45251 (double free or corruption with setAttributeNode()). (Rob)
http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.640.2.23.2.62r2=1.640.2.23.2.63diff_format=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.640.2.23.2.62 php-src/main/main.c:1.640.2.23.2.63
--- php-src/main/main.c:1.640.2.23.2.62 Wed Mar  5 20:58:08 2008
+++ php-src/main/main.c Wed Jun 25 12:18:21 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: main.c,v 1.640.2.23.2.62 2008/03/05 20:58:08 pajoye Exp $ */
+/* $Id: main.c,v 1.640.2.23.2.63 2008/06/25 12:18:21 dmitry Exp $ */
 
 /* {{{ includes
  */
@@ -1435,6 +1435,8 @@
EG(opline_ptr) = NULL;
EG(active_op_array) = NULL;
 
+   php_deactivate_ticks(TSRMLS_C);
+
/* 1. Call all possible shutdown functions registered with 
register_shutdown_function() */
if (PG(modules_activated)) zend_try {
php_call_shutdown_functions(TSRMLS_C);
http://cvs.php.net/viewvc.cgi/php-src/main/php_ticks.c?r1=1.20.2.1.2.2r2=1.20.2.1.2.3diff_format=u
Index: php-src/main/php_ticks.c
diff -u php-src/main/php_ticks.c:1.20.2.1.2.2 
php-src/main/php_ticks.c:1.20.2.1.2.3
--- php-src/main/php_ticks.c:1.20.2.1.2.2   Mon Dec 31 07:20:15 2007
+++ php-src/main/php_ticks.cWed Jun 25 12:18:22 2008
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: php_ticks.c,v 1.20.2.1.2.2 2007/12/31 07:20:15 sebastian Exp $ */
+/* $Id: php_ticks.c,v 1.20.2.1.2.3 2008/06/25 12:18:22 dmitry Exp $ */
 
 #include php.h
 #include php_ticks.h
@@ -27,6 +27,11 @@
return SUCCESS;
 }
 
+void php_deactivate_ticks(TSRMLS_D)
+{
+   zend_llist_clean(PG(tick_functions));
+}
+
 void php_shutdown_ticks(TSRMLS_D)
 {
zend_llist_destroy(PG(tick_functions));
http://cvs.php.net/viewvc.cgi/php-src/main/php_ticks.h?r1=1.14.2.1.2.2r2=1.14.2.1.2.3diff_format=u
Index: php-src/main/php_ticks.h
diff -u php-src/main/php_ticks.h:1.14.2.1.2.2 
php-src/main/php_ticks.h:1.14.2.1.2.3
--- php-src/main/php_ticks.h:1.14.2.1.2.2   Mon Dec 31 07:20:15 2007
+++ php-src/main/php_ticks.hWed Jun 25 12:18:22 2008
@@ -16,12 +16,13 @@
+--+
 */
 
-/* $Id: php_ticks.h,v 1.14.2.1.2.2 2007/12/31 07:20:15 sebastian Exp $ */
+/* $Id: php_ticks.h,v 1.14.2.1.2.3 2008/06/25 12:18:22 dmitry Exp $ */
 
 #ifndef PHP_TICKS_H
 #define PHP_TICKS_H
 
 int php_startup_ticks(TSRMLS_D);
+void php_deactivate_ticks(TSRMLS_D);
 void php_shutdown_ticks(TSRMLS_D);
 void php_run_ticks(int count);
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /main main.c php_ticks.c php_ticks.h

2008-06-25 Thread Dmitry Stogov
dmitry  Wed Jun 25 12:18:36 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/main   main.c php_ticks.c php_ticks.h 
  Log:
  Fixed bug #45352 (Segmentation fault because of tick function on second 
request)
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.640.2.23.2.57.2.23r2=1.640.2.23.2.57.2.24diff_format=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.640.2.23.2.57.2.23 
php-src/main/main.c:1.640.2.23.2.57.2.24
--- php-src/main/main.c:1.640.2.23.2.57.2.23Sat Jun 21 02:41:27 2008
+++ php-src/main/main.c Wed Jun 25 12:18:36 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: main.c,v 1.640.2.23.2.57.2.23 2008/06/21 02:41:27 felipe Exp $ */
+/* $Id: main.c,v 1.640.2.23.2.57.2.24 2008/06/25 12:18:36 dmitry Exp $ */
 
 /* {{{ includes
  */
@@ -1472,6 +1472,8 @@
EG(opline_ptr) = NULL;
EG(active_op_array) = NULL;
 
+   php_deactivate_ticks(TSRMLS_C);
+
/* 1. Call all possible shutdown functions registered with 
register_shutdown_function() */
if (PG(modules_activated)) zend_try {
php_call_shutdown_functions(TSRMLS_C);
http://cvs.php.net/viewvc.cgi/php-src/main/php_ticks.c?r1=1.20.2.1.2.1.2.1r2=1.20.2.1.2.1.2.2diff_format=u
Index: php-src/main/php_ticks.c
diff -u php-src/main/php_ticks.c:1.20.2.1.2.1.2.1 
php-src/main/php_ticks.c:1.20.2.1.2.1.2.2
--- php-src/main/php_ticks.c:1.20.2.1.2.1.2.1   Mon Dec 31 07:17:17 2007
+++ php-src/main/php_ticks.cWed Jun 25 12:18:36 2008
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: php_ticks.c,v 1.20.2.1.2.1.2.1 2007/12/31 07:17:17 sebastian Exp $ */
+/* $Id: php_ticks.c,v 1.20.2.1.2.1.2.2 2008/06/25 12:18:36 dmitry Exp $ */
 
 #include php.h
 #include php_ticks.h
@@ -27,6 +27,11 @@
return SUCCESS;
 }
 
+void php_deactivate_ticks(TSRMLS_D)
+{
+   zend_llist_clean(PG(tick_functions));
+}
+
 void php_shutdown_ticks(TSRMLS_D)
 {
zend_llist_destroy(PG(tick_functions));
http://cvs.php.net/viewvc.cgi/php-src/main/php_ticks.h?r1=1.14.2.1.2.1.2.1r2=1.14.2.1.2.1.2.2diff_format=u
Index: php-src/main/php_ticks.h
diff -u php-src/main/php_ticks.h:1.14.2.1.2.1.2.1 
php-src/main/php_ticks.h:1.14.2.1.2.1.2.2
--- php-src/main/php_ticks.h:1.14.2.1.2.1.2.1   Mon Dec 31 07:17:17 2007
+++ php-src/main/php_ticks.hWed Jun 25 12:18:36 2008
@@ -16,12 +16,13 @@
+--+
 */
 
-/* $Id: php_ticks.h,v 1.14.2.1.2.1.2.1 2007/12/31 07:17:17 sebastian Exp $ */
+/* $Id: php_ticks.h,v 1.14.2.1.2.1.2.2 2008/06/25 12:18:36 dmitry Exp $ */
 
 #ifndef PHP_TICKS_H
 #define PHP_TICKS_H
 
 int php_startup_ticks(TSRMLS_D);
+void php_deactivate_ticks(TSRMLS_D);
 void php_shutdown_ticks(TSRMLS_D);
 void php_run_ticks(int count);
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /main main.c php_ticks.c php_ticks.h

2008-06-25 Thread Dmitry Stogov
dmitry  Wed Jun 25 12:18:51 2008 UTC

  Modified files:  
/php-src/main   main.c php_ticks.c php_ticks.h 
  Log:
  Fixed bug #45352 (Segmentation fault because of tick function on second 
request)
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.770r2=1.771diff_format=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.770 php-src/main/main.c:1.771
--- php-src/main/main.c:1.770   Wed Mar 26 14:46:17 2008
+++ php-src/main/main.c Wed Jun 25 12:18:51 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: main.c,v 1.770 2008/03/26 14:46:17 scottmac Exp $ */
+/* $Id: main.c,v 1.771 2008/06/25 12:18:51 dmitry Exp $ */
 
 /* {{{ includes
  */
@@ -1577,6 +1577,8 @@
EG(opline_ptr) = NULL;
EG(active_op_array) = NULL;
 
+   php_deactivate_ticks(TSRMLS_C);
+
/* 1. Call all possible __destruct() functions */
zend_try {
zend_call_destructors(TSRMLS_C);
http://cvs.php.net/viewvc.cgi/php-src/main/php_ticks.c?r1=1.23r2=1.24diff_format=u
Index: php-src/main/php_ticks.c
diff -u php-src/main/php_ticks.c:1.23 php-src/main/php_ticks.c:1.24
--- php-src/main/php_ticks.c:1.23   Mon Dec 31 07:12:18 2007
+++ php-src/main/php_ticks.cWed Jun 25 12:18:51 2008
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: php_ticks.c,v 1.23 2007/12/31 07:12:18 sebastian Exp $ */
+/* $Id: php_ticks.c,v 1.24 2008/06/25 12:18:51 dmitry Exp $ */
 
 #include php.h
 #include php_ticks.h
@@ -27,6 +27,11 @@
return SUCCESS;
 }
 
+void php_deactivate_ticks(TSRMLS_D)
+{
+   zend_llist_clean(PG(tick_functions));
+}
+
 void php_shutdown_ticks(TSRMLS_D)
 {
zend_llist_destroy(PG(tick_functions));
http://cvs.php.net/viewvc.cgi/php-src/main/php_ticks.h?r1=1.17r2=1.18diff_format=u
Index: php-src/main/php_ticks.h
diff -u php-src/main/php_ticks.h:1.17 php-src/main/php_ticks.h:1.18
--- php-src/main/php_ticks.h:1.17   Mon Dec 31 07:12:18 2007
+++ php-src/main/php_ticks.hWed Jun 25 12:18:51 2008
@@ -16,12 +16,13 @@
+--+
 */
 
-/* $Id: php_ticks.h,v 1.17 2007/12/31 07:12:18 sebastian Exp $ */
+/* $Id: php_ticks.h,v 1.18 2008/06/25 12:18:51 dmitry Exp $ */
 
 #ifndef PHP_TICKS_H
 #define PHP_TICKS_H
 
 int php_startup_ticks(TSRMLS_D);
+void php_deactivate_ticks(TSRMLS_D);
 void php_shutdown_ticks(TSRMLS_D);
 void php_run_ticks(int count);
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/reflection/tests ReflectionFunction_getNamespaceName.phpt reflectionClass_getNamespaceName.phpt

2008-06-25 Thread Dmitry Stogov
dmitry  Wed Jun 25 12:33:46 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/reflection/tests   

ReflectionFunction_getNamespaceName.phpt 
reflectionClass_getNamespaceName.phpt 

  Modified files:  
/php-src/ext/reflection php_reflection.c 
  Log:
  Added support for namespaces
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.16r2=1.164.2.33.2.45.2.17diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.16 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.17
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.16Sat Jun 
21 02:41:27 2008
+++ php-src/ext/reflection/php_reflection.c Wed Jun 25 12:33:46 2008
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.16 2008/06/21 02:41:27 felipe Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.17 2008/06/25 12:33:46 dmitry Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -2550,6 +2550,66 @@
 }
 /* }}} */
 
+/* {{{ proto public bool ReflectionFunction::inNamespace()
+   Returns whether this function is defined in namespace */
+ZEND_METHOD(reflection_function, inNamespace)
+{
+   zval **name;
+   char *colon;
+
+   METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0);
+   if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
(void **) name) == FAILURE) {
+   RETURN_FALSE;
+   }
+   if (Z_TYPE_PP(name) == IS_STRING 
+   (colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
+   colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
+   RETURN_TRUE;
+}
+   RETURN_FALSE;
+}
+/* }}} */
+
+/* {{{ proto public string ReflectionFunction::getNamespaceName()
+   Returns the name of namespace where this function is defined */
+ZEND_METHOD(reflection_function, getNamespaceName)
+{
+   zval **name;
+   char *colon;
+
+   METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0);
+   if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
(void **) name) == FAILURE) {
+   RETURN_FALSE;
+   }
+   if (Z_TYPE_PP(name) == IS_STRING 
+   (colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
+   colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
+   RETURN_STRINGL(Z_STRVAL_PP(name), colon - Z_STRVAL_PP(name) - 
1, 1);
+}
+   RETURN_EMPTY_STRING();
+}
+/* }}} */
+
+/* {{{ proto public string ReflectionFunction::getShortName()
+   Returns the short name of the function (without namespace part) */
+ZEND_METHOD(reflection_function, getShortName)
+{
+   zval **name;
+   char *colon;
+
+   METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0);
+   if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
(void **) name) == FAILURE) {
+   RETURN_FALSE;
+   }
+   if (Z_TYPE_PP(name) == IS_STRING 
+   (colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
+   colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
+   RETURN_STRINGL(colon + 1, Z_STRLEN_PP(name) - (colon - 
Z_STRVAL_PP(name) + 1), 1);
+}
+RETURN_ZVAL(*name, 1, 0);
+}
+/* }}} */
+
 /* {{{ proto public bool ReflectionMethod::isConstructor()
Returns whether this method is the constructor */
 ZEND_METHOD(reflection_method, isConstructor)
@@ -3760,6 +3820,66 @@
 }
 /* }}} */
 
+/* {{{ proto public bool ReflectionClass::inNamespace()
+   Returns whether this class is defined in namespace */
+ZEND_METHOD(reflection_class, inNamespace)
+{
+   zval **name;
+   char *colon;
+
+   METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
+   if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
(void **) name) == FAILURE) {
+   RETURN_FALSE;
+   }
+   if (Z_TYPE_PP(name) == IS_STRING 
+   (colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
+   colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
+   RETURN_TRUE;
+}
+   RETURN_FALSE;
+}
+/* }}} */
+
+/* {{{ proto public string ReflectionClass::getNamespaceName()
+   Returns the name of namespace where this class is defined */
+ZEND_METHOD(reflection_class, getNamespaceName)
+{
+   zval **name;
+   char *colon;
+
+   METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
+   if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
(void **) name) == FAILURE) {
+   RETURN_FALSE;
+   }
+   if (Z_TYPE_PP(name) == IS_STRING 
+   (colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
+   colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
+   

[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests ReflectionFunction_getNamespaceName.phpt reflectionClass_getNamespaceName.phpt

2008-06-25 Thread Dmitry Stogov
dmitry  Wed Jun 25 12:34:14 2008 UTC

  Modified files:  
/php-src/ext/reflection php_reflection.c 
/php-src/ext/reflection/tests   

ReflectionFunction_getNamespaceName.phpt 
reflectionClass_getNamespaceName.phpt 
  Log:
  Added support for namespaces
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.296r2=1.297diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.296 
php-src/ext/reflection/php_reflection.c:1.297
--- php-src/ext/reflection/php_reflection.c:1.296   Sun Jun  1 03:13:54 2008
+++ php-src/ext/reflection/php_reflection.c Wed Jun 25 12:34:14 2008
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.296 2008/06/01 03:13:54 felipe Exp $ */
+/* $Id: php_reflection.c,v 1.297 2008/06/25 12:34:14 dmitry Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -2596,6 +2596,78 @@
 }
 /* }}} */
 
+/* {{{ proto public bool ReflectionFunction::inNamespace()
+   Returns whether this function is defined in namespace */
+ZEND_METHOD(reflection_function, inNamespace)
+{
+   zval **name;
+   zstr colon;
+
+   METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0);
+   if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
(void **) name) == FAILURE) {
+   RETURN_FALSE;
+   }
+   if (Z_TYPE_PP(name) == IS_STRING 
+   (colon.s = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 

+   colon.s  Z_STRVAL_PP(name)  *(colon.s-1) == ':') {
+   RETURN_TRUE;
+   } else if (Z_TYPE_PP(name) == IS_UNICODE 
+   (colon.u = u_memrchr(Z_USTRVAL_PP(name), ':', Z_USTRLEN_PP(name))) 

+   colon.u  Z_USTRVAL_PP(name)  *(colon.u-1) == ':') {
+   RETURN_TRUE;
+}
+   RETURN_FALSE;
+}
+/* }}} */
+
+/* {{{ proto public string ReflectionFunction::getNamespaceName()
+   Returns the name of namespace where this function is defined */
+ZEND_METHOD(reflection_function, getNamespaceName)
+{
+   zval **name;
+   zstr colon;
+
+   METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0);
+   if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
(void **) name) == FAILURE) {
+   RETURN_FALSE;
+   }
+   if (Z_TYPE_PP(name) == IS_STRING 
+   (colon.s = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 

+   colon.s  Z_STRVAL_PP(name)  *(colon.s-1) == ':') {
+   RETURN_STRINGL(Z_STRVAL_PP(name), colon.s - Z_STRVAL_PP(name) - 
1, 1);
+   } else if (Z_TYPE_PP(name) == IS_UNICODE 
+   (colon.u = u_memrchr(Z_USTRVAL_PP(name), ':', Z_USTRLEN_PP(name))) 

+   colon.u  Z_USTRVAL_PP(name)  *(colon.u-1) == ':') {
+   RETURN_UNICODEL(Z_USTRVAL_PP(name), colon.u - 
Z_USTRVAL_PP(name) - 1, 1);
+}
+   RETURN_EMPTY_TEXT();
+}
+/* }}} */
+
+/* {{{ proto public string ReflectionFunction::getShortName()
+   Returns the short name of the function (without namespace part) */
+ZEND_METHOD(reflection_function, getShortName)
+{
+   zval **name;
+   zstr colon;
+
+   METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0);
+   if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
(void **) name) == FAILURE) {
+   RETURN_FALSE;
+   }
+   if (Z_TYPE_PP(name) == IS_STRING 
+   (colon.s = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 

+   colon.s  Z_STRVAL_PP(name)  *(colon.s-1) == ':') {
+   RETURN_STRINGL(colon.s + 1, Z_STRLEN_PP(name) - (colon.s - 
Z_STRVAL_PP(name) + 1), 1);
+   } else if (Z_TYPE_PP(name) == IS_UNICODE 
+   (colon.u = u_memrchr(Z_USTRVAL_PP(name), ':', Z_USTRLEN_PP(name))) 

+   colon.u  Z_USTRVAL_PP(name)  *(colon.u-1) == ':') {
+   RETURN_UNICODEL(colon.u + 1, Z_USTRLEN_PP(name) - (colon.u - 
Z_USTRVAL_PP(name) + 1), 1);
+}
+RETURN_ZVAL(*name, 1, 0);
+}
+/* }}} */
+
 /* {{{ proto public bool ReflectionMethod::isConstructor() U
Returns whether this method is the constructor */
 ZEND_METHOD(reflection_method, isConstructor)
@@ -3842,6 +3914,78 @@
 }
 /* }}} */
 
+/* {{{ proto public bool ReflectionClass::inNamespace()
+   Returns whether this class is defined in namespace */
+ZEND_METHOD(reflection_class, inNamespace)
+{
+   zval **name;
+   zstr colon;
+
+   METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
+   if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
(void **) name) == FAILURE) {
+   RETURN_FALSE;
+   }
+   if (Z_TYPE_PP(name) == IS_STRING 
+   (colon.s = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 

+   colon.s  Z_STRVAL_PP(name)  *(colon.s-1) == ':') {
+   RETURN_TRUE;
+   

Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/reflection/tests ReflectionFunction_getNamespaceName.phpt reflectionClass_getNamespaceName.phpt

2008-06-25 Thread Lars Strojny
Thank you very much!

Am Mittwoch, den 25.06.2008, 12:33 + schrieb Dmitry Stogov:
 dmitryWed Jun 25 12:33:46 2008 UTC
 
   Added files: (Branch: PHP_5_3)
 /php-src/ext/reflection/tests 
   
 ReflectionFunction_getNamespaceName.phpt 
   reflectionClass_getNamespaceName.phpt 
 
   Modified files:  
 /php-src/ext/reflection   php_reflection.c 
   Log:
   Added support for namespaces
   
   
 http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.16r2=1.164.2.33.2.45.2.17diff_format=u
 Index: php-src/ext/reflection/php_reflection.c
 diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.16 
 php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.17
 --- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.16  Sat Jun 
 21 02:41:27 2008
 +++ php-src/ext/reflection/php_reflection.c   Wed Jun 25 12:33:46 2008
 @@ -20,7 +20,7 @@
 +--+
  */
  
 -/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.16 2008/06/21 02:41:27 felipe 
 Exp $ */
 +/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.17 2008/06/25 12:33:46 dmitry 
 Exp $ */
  
  #ifdef HAVE_CONFIG_H
  #include config.h
 @@ -2550,6 +2550,66 @@
  }
  /* }}} */
  
 +/* {{{ proto public bool ReflectionFunction::inNamespace()
 +   Returns whether this function is defined in namespace */
 +ZEND_METHOD(reflection_function, inNamespace)
 +{
 + zval **name;
 + char *colon;
 +
 + METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0);
 + if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
 (void **) name) == FAILURE) {
 + RETURN_FALSE;
 + }
 + if (Z_TYPE_PP(name) == IS_STRING 
 + (colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
 + colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
 + RETURN_TRUE;
 +}
 + RETURN_FALSE;
 +}
 +/* }}} */
 +
 +/* {{{ proto public string ReflectionFunction::getNamespaceName()
 +   Returns the name of namespace where this function is defined */
 +ZEND_METHOD(reflection_function, getNamespaceName)
 +{
 + zval **name;
 + char *colon;
 +
 + METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0);
 + if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
 (void **) name) == FAILURE) {
 + RETURN_FALSE;
 + }
 + if (Z_TYPE_PP(name) == IS_STRING 
 + (colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
 + colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
 + RETURN_STRINGL(Z_STRVAL_PP(name), colon - Z_STRVAL_PP(name) - 
 1, 1);
 +}
 + RETURN_EMPTY_STRING();
 +}
 +/* }}} */
 +
 +/* {{{ proto public string ReflectionFunction::getShortName()
 +   Returns the short name of the function (without namespace part) */
 +ZEND_METHOD(reflection_function, getShortName)
 +{
 + zval **name;
 + char *colon;
 +
 + METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0);
 + if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
 (void **) name) == FAILURE) {
 + RETURN_FALSE;
 + }
 + if (Z_TYPE_PP(name) == IS_STRING 
 + (colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
 + colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
 + RETURN_STRINGL(colon + 1, Z_STRLEN_PP(name) - (colon - 
 Z_STRVAL_PP(name) + 1), 1);
 +}
 +RETURN_ZVAL(*name, 1, 0);
 +}
 +/* }}} */
 +
  /* {{{ proto public bool ReflectionMethod::isConstructor()
 Returns whether this method is the constructor */
  ZEND_METHOD(reflection_method, isConstructor)
 @@ -3760,6 +3820,66 @@
  }
  /* }}} */
  
 +/* {{{ proto public bool ReflectionClass::inNamespace()
 +   Returns whether this class is defined in namespace */
 +ZEND_METHOD(reflection_class, inNamespace)
 +{
 + zval **name;
 + char *colon;
 +
 + METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
 + if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
 (void **) name) == FAILURE) {
 + RETURN_FALSE;
 + }
 + if (Z_TYPE_PP(name) == IS_STRING 
 + (colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
 + colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
 + RETURN_TRUE;
 +}
 + RETURN_FALSE;
 +}
 +/* }}} */
 +
 +/* {{{ proto public string ReflectionClass::getNamespaceName()
 +   Returns the name of namespace where this class is defined */
 +ZEND_METHOD(reflection_class, getNamespaceName)
 +{
 + zval **name;
 + char *colon;
 +
 + METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
 + if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
 (void **) name) == FAILURE) {
 + RETURN_FALSE;
 + }
 + if (Z_TYPE_PP(name) == IS_STRING 
 + (colon = zend_memrchr(Z_STRVAL_PP(name), 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/dbase dbase.c /ext/dbase/tests 001.phpt

2008-06-25 Thread Felipe Pena
felipe  Wed Jun 25 14:46:19 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/dbase  dbase.c 
/php-src/ext/dbase/tests001.phpt 
  Log:
  - New parameter parsing API
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/dbase/dbase.c?r1=1.74.2.2.2.9.2.2r2=1.74.2.2.2.9.2.3diff_format=u
Index: php-src/ext/dbase/dbase.c
diff -u php-src/ext/dbase/dbase.c:1.74.2.2.2.9.2.2 
php-src/ext/dbase/dbase.c:1.74.2.2.2.9.2.3
--- php-src/ext/dbase/dbase.c:1.74.2.2.2.9.2.2  Mon Dec 31 07:17:07 2007
+++ php-src/ext/dbase/dbase.c   Wed Jun 25 14:46:18 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: dbase.c,v 1.74.2.2.2.9.2.2 2007/12/31 07:17:07 sebastian Exp $ */
+/* $Id: dbase.c,v 1.74.2.2.2.9.2.3 2008/06/25 14:46:18 felipe Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -118,41 +118,41 @@
Opens a dBase-format database file */
 PHP_FUNCTION(dbase_open)
 {
-   zval **dbf_name, **options;
+   char *dbf_name;
+   int dbf_name_len;
+   long options;
dbhead_t *dbh;
int handle;
DBase_TLS_VARS;
 
-   if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, dbf_name, 
options) == FAILURE) {
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, sl, dbf_name, 
dbf_name_len, options) == FAILURE) {
+   return;
}
-   convert_to_string_ex(dbf_name);
-   convert_to_long_ex(options);
 
-   if (!Z_STRLEN_PP(dbf_name)) {
+   if (!dbf_name_len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, The filename 
cannot be empty.);
RETURN_FALSE;
}
 
-   if (Z_LVAL_PP(options) == 1) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Cannot open %s in 
write-only mode, Z_STRVAL_PP(dbf_name));
+   if (options == 1) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Cannot open %s in 
write-only mode, dbf_name);
RETURN_FALSE;
-   } else if (Z_LVAL_PP(options)  0 || Z_LVAL_PP(options)  3) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid access 
mode %ld, Z_LVAL_PP(options));
+   } else if (options  0 || options  3) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid access 
mode %ld, options);
RETURN_FALSE;
}
 
-   if (PG(safe_mode)  (!php_checkuid(Z_STRVAL_PP(dbf_name), NULL, 
CHECKUID_CHECK_FILE_AND_DIR))) {
+   if (PG(safe_mode)  (!php_checkuid(dbf_name, NULL, 
CHECKUID_CHECK_FILE_AND_DIR))) {
RETURN_FALSE;
}

-   if (php_check_open_basedir(Z_STRVAL_PP(dbf_name) TSRMLS_CC)) {
+   if (php_check_open_basedir(dbf_name TSRMLS_CC)) {
RETURN_FALSE;
}
 
-   dbh = dbf_open(Z_STRVAL_PP(dbf_name), Z_LVAL_PP(options) TSRMLS_CC);
+   dbh = dbf_open(dbf_name, options TSRMLS_CC);
if (dbh == NULL) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, unable to open 
database %s, Z_STRVAL_PP(dbf_name));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, unable to open 
database %s, dbf_name);
RETURN_FALSE;
}
 
@@ -165,22 +165,22 @@
Closes an open dBase-format database file */
 PHP_FUNCTION(dbase_close)
 {
-   zval **dbh_id;
+   long dbh_id;
dbhead_t *dbh;
int dbh_type;
DBase_TLS_VARS;
 
-   if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, dbh_id) == 
FAILURE)) {
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, dbh_id) == 
FAILURE) {
+   return;
}
-   convert_to_long_ex(dbh_id);
-   dbh = zend_list_find(Z_LVAL_PP(dbh_id), dbh_type);
+
+   dbh = zend_list_find(dbh_id, dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to find 
database for identifier %ld, Z_LVAL_PP(dbh_id));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to find 
database for identifier %ld, dbh_id);
RETURN_FALSE;
}
 
-   zend_list_delete(Z_LVAL_PP(dbh_id));
+   zend_list_delete(dbh_id);
RETURN_TRUE;
 }
 /* }}} */
@@ -189,18 +189,18 @@
Returns the number of records in the database */
 PHP_FUNCTION(dbase_numrecords)
 {
-   zval **dbh_id;
+   long dbh_id;
dbhead_t *dbh;
int dbh_type;
DBase_TLS_VARS;
 
-   if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, dbh_id) == 
FAILURE)) {
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, dbh_id) == 
FAILURE) {
+   return;
}
-   convert_to_long_ex(dbh_id);
-   dbh = zend_list_find(Z_LVAL_PP(dbh_id), dbh_type);
+
+   dbh = zend_list_find(dbh_id, dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
-   php_error_docref(NULL TSRMLS_CC, 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/readline readline.c

2008-06-25 Thread Felipe Pena
felipe  Wed Jun 25 15:06:58 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/readline   readline.c 
  Log:
  - New parameter parsing API
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/readline/readline.c?r1=1.42.2.3.2.3.2.2r2=1.42.2.3.2.3.2.3diff_format=u
Index: php-src/ext/readline/readline.c
diff -u php-src/ext/readline/readline.c:1.42.2.3.2.3.2.2 
php-src/ext/readline/readline.c:1.42.2.3.2.3.2.3
--- php-src/ext/readline/readline.c:1.42.2.3.2.3.2.2Mon Dec 31 07:17:12 2007
+++ php-src/ext/readline/readline.c Wed Jun 25 15:06:58 2008
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: readline.c,v 1.42.2.3.2.3.2.2 2007/12/31 07:17:12 sebastian Exp $ */
+/* $Id: readline.c,v 1.42.2.3.2.3.2.3 2008/06/25 15:06:58 felipe Exp $ */
 
 /* {{{ includes  prototypes */
 
@@ -154,21 +154,20 @@
 
 /* }}} */
 
-/* {{{ proto mixed readline_info([string varname] [, string newvalue]) 
-   Gets/sets various internal readline variables. */
-
 #define SAFE_STRING(s) ((s)?(char*)(s):)
 
+/* {{{ proto mixed readline_info([string varname [, string newvalue]]) 
+   Gets/sets various internal readline variables. */
 PHP_FUNCTION(readline_info)
 {
-   zval **what;
+   char *what;
zval **value;
-   int oldval;
+   int what_len, oldval;
char *oldstr;
int ac = ZEND_NUM_ARGS();
 
-   if (ac  0 || ac  2 || zend_get_parameters_ex(ac, what, value) == 
FAILURE) {
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |sZ, what, 
what_len, value) == FAILURE) {
+   return;
}
 
if (ac == 0) {
@@ -189,9 +188,7 @@
add_assoc_string(return_value,library_version,(char 
*)SAFE_STRING(rl_library_version),1);
add_assoc_string(return_value,readline_name,(char 
*)SAFE_STRING(rl_readline_name),1);
} else {
-   convert_to_string_ex(what);
-
-   if (! strcasecmp(Z_STRVAL_PP(what),line_buffer)) {
+   if (!strcasecmp(what,line_buffer)) {
oldstr = rl_line_buffer;
if (ac == 2) {
/* XXX if (rl_line_buffer) 
free(rl_line_buffer); */
@@ -199,34 +196,34 @@
rl_line_buffer = strdup(Z_STRVAL_PP(value));
}
RETVAL_STRING(SAFE_STRING(oldstr),1);
-   } else if (! strcasecmp(Z_STRVAL_PP(what),point)) {
+   } else if (!strcasecmp(what, point)) {
RETVAL_LONG(rl_point);
-   } else if (! strcasecmp(Z_STRVAL_PP(what),end)) {
+   } else if (!strcasecmp(what, end)) {
RETVAL_LONG(rl_end);
 #ifdef HAVE_LIBREADLINE
-   } else if (! strcasecmp(Z_STRVAL_PP(what),mark)) {
+   } else if (!strcasecmp(what, mark)) {
RETVAL_LONG(rl_mark);
-   } else if (! strcasecmp(Z_STRVAL_PP(what),done)) {
+   } else if (!strcasecmp(what, done)) {
oldval = rl_done;
if (ac == 2) {
convert_to_long_ex(value);
rl_done = Z_LVAL_PP(value);
}
RETVAL_LONG(oldval);
-   } else if (! strcasecmp(Z_STRVAL_PP(what),pending_input)) {
+   } else if (!strcasecmp(what, pending_input)) {
oldval = rl_pending_input;
if (ac == 2) {
convert_to_string_ex(value);
rl_pending_input = Z_STRVAL_PP(value)[0];
}
RETVAL_LONG(oldval);
-   } else if (! strcasecmp(Z_STRVAL_PP(what),prompt)) {
+   } else if (!strcasecmp(what, prompt)) {
RETVAL_STRING(SAFE_STRING(rl_prompt),1);
-   } else if (! strcasecmp(Z_STRVAL_PP(what),terminal_name)) {
+   } else if (!strcasecmp(what, terminal_name)) {
RETVAL_STRING((char *)SAFE_STRING(rl_terminal_name),1);
 #endif
 #if HAVE_ERASE_EMPTY_LINE
-   } else if (! strcasecmp(Z_STRVAL_PP(what),erase_empty_line)) {
+   } else if (!strcasecmp(what, erase_empty_line)) {
oldval = rl_erase_empty_line;
if (ac == 2) {
convert_to_long_ex(value);
@@ -234,9 +231,9 @@
}
RETVAL_LONG(oldval);
 #endif
-   } else if (! strcasecmp(Z_STRVAL_PP(what),library_version)) {
+   } else if (!strcasecmp(what,library_version)) {
RETVAL_STRING((char 
*)SAFE_STRING(rl_library_version),1);
-   } else if (! strcasecmp(Z_STRVAL_PP(what),readline_name)) {
+   } else if 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/odbc birdstep.c

2008-06-25 Thread Felipe Pena
felipe  Wed Jun 25 16:18:56 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/odbc   birdstep.c 
  Log:
  - New parameter parsing API
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/odbc/birdstep.c?r1=1.13.2.2.2.2.2.2r2=1.13.2.2.2.2.2.3diff_format=u
Index: php-src/ext/odbc/birdstep.c
diff -u php-src/ext/odbc/birdstep.c:1.13.2.2.2.2.2.2 
php-src/ext/odbc/birdstep.c:1.13.2.2.2.2.2.3
--- php-src/ext/odbc/birdstep.c:1.13.2.2.2.2.2.2Mon Dec 31 07:17:11 2007
+++ php-src/ext/odbc/birdstep.c Wed Jun 25 16:18:55 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: birdstep.c,v 1.13.2.2.2.2.2.2 2007/12/31 07:17:11 sebastian Exp $ */
+/* $Id: birdstep.c,v 1.13.2.2.2.2.2.3 2008/06/25 16:18:55 felipe Exp $ */
 
 /*
  * TODO:
@@ -104,8 +104,8 @@
 THREAD_LS birdstep_module php_birdstep_module;
 THREAD_LS static HENV henv;
 
-#define PHP_GET_BIRDSTEP_RES_IDX(id) convert_to_long_ex(id); if (!(res = 
birdstep_find_result(list, Z_LVAL_PP(id { php_error_docref(NULL TSRMLS_CC, 
E_WARNING, Birdstep: Not result index (%ld), Z_LVAL_PP(id)); RETURN_FALSE; } 
-#define PHP_BIRDSTEP_CHK_LNK(id) convert_to_long_ex(id); if (!(conn = 
birdstep_find_conn(list,Z_LVAL_PP(id { php_error_docref(NULL TSRMLS_CC, 
E_WARNING, Birdstep: Not connection index (%ld), Z_LVAL_PP(id)); 
RETURN_FALSE; }
+#define PHP_GET_BIRDSTEP_RES_IDX(id) if (!(res = birdstep_find_result(list, 
id))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Birdstep: Not result index 
(%ld), id); RETURN_FALSE; } 
+#define PHP_BIRDSTEP_CHK_LNK(id) if (!(conn = birdstep_find_conn(list, id))) { 
php_error_docref(NULL TSRMLS_CC, E_WARNING, Birdstep: Not connection index 
(%ld), id); RETURN_FALSE; }
 
 
 static void _close_birdstep_link(zend_rsrc_list_entry *rsrc TSRMLS_DC)
@@ -231,36 +231,30 @@
  */
 PHP_FUNCTION(birdstep_connect)
 {
-   zval **serv,**user,**pass;
-   char *Serv = NULL;
-   char *User = NULL;
-   char *Pass = NULL;
+   char *serv, *user, *pass;
+   int serv_len, user_len, pass_len;
RETCODE stat;
HDBC hdbc;
VConn *new;
long ind;
 
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, sss, serv, 
serv_len, user, user_len, pass, pass_len) == FAILURE) {
+   return;
+   }
+   
if ( php_birdstep_module.max_links != -1  
php_birdstep_module.num_links == php_birdstep_module.max_links ) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Birdstep: Too many 
open connections (%d),php_birdstep_module.num_links);
RETURN_FALSE;
}
-   if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, serv, user, 
pass) == FAILURE ) {
-   WRONG_PARAM_COUNT;
-   }
-   convert_to_string_ex(serv);
-   convert_to_string_ex(user);
-   convert_to_string_ex(pass);
-   Serv = Z_STRVAL_PP(serv);
-   User = Z_STRVAL_PP(user);
-   Pass = Z_STRVAL_PP(pass);
+
stat = SQLAllocConnect(henv,hdbc);
if ( stat != SQL_SUCCESS ) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Birdstep: Could 
not allocate connection handle);
RETURN_FALSE;
}
-   stat = SQLConnect(hdbc,Serv,SQL_NTS,User,SQL_NTS,Pass,SQL_NTS);
+   stat = SQLConnect(hdbc, serv, SQL_NTS, user, SQL_NTS, pass, SQL_NTS);
if ( stat != SQL_SUCCESS  stat != SQL_SUCCESS_WITH_INFO ) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Birdstep: Could 
not connect to server \%s\ for %s,Serv,User);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Birdstep: Could 
not connect to server \%s\ for %s, serv, user);
SQLFreeConnect(hdbc);
RETURN_FALSE;
}
@@ -275,17 +269,18 @@
  */
 PHP_FUNCTION(birdstep_close)
 {
-   zval **id;
+   long id;
VConn *conn;
 
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, id) == FAILURE) {
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, id) == 
FAILURE) {
+   return;
}
+
PHP_BIRDSTEP_CHK_LNK(id);
 
SQLDisconnect(conn-hdbc);
SQLFreeConnect(conn-hdbc);
-   birdstep_del_conn(list,Z_LVAL_PP(id));
+   birdstep_del_conn(list, id);
php_birdstep_module.num_links--;
RETURN_TRUE;
 }
@@ -295,22 +290,20 @@
  */
 PHP_FUNCTION(birdstep_exec)
 {
-   zval **ind, **exec_str;
-   char *query = NULL;
-   int indx;
+   char *query;
+   long ind;
+   int query_len, indx;
VConn *conn;
Vresult *res;
RETCODE stat;
SWORD cols,i,colnamelen;
SDWORD rows,coldesc;
 
-   if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, ind, exec_str) 
== FAILURE) {
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ls, ind, 
query, query_len) == FAILURE) {
+

[PHP-CVS] cvs: php-src /ext/odbc birdstep.c

2008-06-25 Thread Felipe Pena
felipe  Wed Jun 25 16:20:38 2008 UTC

  Modified files:  
/php-src/ext/odbc   birdstep.c 
  Log:
  - New parameter parsing API
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/odbc/birdstep.c?r1=1.19r2=1.20diff_format=u
Index: php-src/ext/odbc/birdstep.c
diff -u php-src/ext/odbc/birdstep.c:1.19 php-src/ext/odbc/birdstep.c:1.20
--- php-src/ext/odbc/birdstep.c:1.19Mon Dec 31 07:12:12 2007
+++ php-src/ext/odbc/birdstep.c Wed Jun 25 16:20:38 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: birdstep.c,v 1.19 2007/12/31 07:12:12 sebastian Exp $ */
+/* $Id: birdstep.c,v 1.20 2008/06/25 16:20:38 felipe Exp $ */
 
 /*
  * TODO:
@@ -104,8 +104,8 @@
 THREAD_LS birdstep_module php_birdstep_module;
 THREAD_LS static HENV henv;
 
-#define PHP_GET_BIRDSTEP_RES_IDX(id) convert_to_long_ex(id); if (!(res = 
birdstep_find_result(list, Z_LVAL_PP(id { php_error_docref(NULL TSRMLS_CC, 
E_WARNING, Birdstep: Not result index (%ld), Z_LVAL_PP(id)); RETURN_FALSE; } 
-#define PHP_BIRDSTEP_CHK_LNK(id) convert_to_long_ex(id); if (!(conn = 
birdstep_find_conn(list,Z_LVAL_PP(id { php_error_docref(NULL TSRMLS_CC, 
E_WARNING, Birdstep: Not connection index (%ld), Z_LVAL_PP(id)); 
RETURN_FALSE; }
+#define PHP_GET_BIRDSTEP_RES_IDX(id) if (!(res = birdstep_find_result(list, 
id))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Birdstep: Not result index 
(%ld), id); RETURN_FALSE; } 
+#define PHP_BIRDSTEP_CHK_LNK(id) if (!(conn = birdstep_find_conn(list, id))) { 
php_error_docref(NULL TSRMLS_CC, E_WARNING, Birdstep: Not connection index 
(%ld), id); RETURN_FALSE; }
 
 
 static void _close_birdstep_link(zend_rsrc_list_entry *rsrc TSRMLS_DC)
@@ -231,36 +231,30 @@
  */
 PHP_FUNCTION(birdstep_connect)
 {
-   zval **serv,**user,**pass;
-   char *Serv = NULL;
-   char *User = NULL;
-   char *Pass = NULL;
+   char *serv, *user, *pass;
+   int serv_len, user_len, pass_len;
RETCODE stat;
HDBC hdbc;
VConn *new;
long ind;
 
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, sss, serv, 
serv_len, user, user_len, pass, pass_len) == FAILURE) {
+   return;
+   }
+   
if ( php_birdstep_module.max_links != -1  
php_birdstep_module.num_links == php_birdstep_module.max_links ) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Birdstep: Too many 
open connections (%d),php_birdstep_module.num_links);
RETURN_FALSE;
}
-   if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, serv, user, 
pass) == FAILURE ) {
-   WRONG_PARAM_COUNT;
-   }
-   convert_to_string_ex(serv);
-   convert_to_string_ex(user);
-   convert_to_string_ex(pass);
-   Serv = Z_STRVAL_PP(serv);
-   User = Z_STRVAL_PP(user);
-   Pass = Z_STRVAL_PP(pass);
+
stat = SQLAllocConnect(henv,hdbc);
if ( stat != SQL_SUCCESS ) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Birdstep: Could 
not allocate connection handle);
RETURN_FALSE;
}
-   stat = SQLConnect(hdbc,Serv,SQL_NTS,User,SQL_NTS,Pass,SQL_NTS);
+   stat = SQLConnect(hdbc, serv, SQL_NTS, user, SQL_NTS, pass, SQL_NTS);
if ( stat != SQL_SUCCESS  stat != SQL_SUCCESS_WITH_INFO ) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Birdstep: Could 
not connect to server \%s\ for %s,Serv,User);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Birdstep: Could 
not connect to server \%s\ for %s, serv, user);
SQLFreeConnect(hdbc);
RETURN_FALSE;
}
@@ -275,17 +269,18 @@
  */
 PHP_FUNCTION(birdstep_close)
 {
-   zval **id;
+   long id;
VConn *conn;
 
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, id) == FAILURE) {
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, id) == 
FAILURE) {
+   return;
}
+
PHP_BIRDSTEP_CHK_LNK(id);
 
SQLDisconnect(conn-hdbc);
SQLFreeConnect(conn-hdbc);
-   birdstep_del_conn(list,Z_LVAL_PP(id));
+   birdstep_del_conn(list, id);
php_birdstep_module.num_links--;
RETURN_TRUE;
 }
@@ -295,22 +290,20 @@
  */
 PHP_FUNCTION(birdstep_exec)
 {
-   zval **ind, **exec_str;
-   char *query = NULL;
-   int indx;
+   char *query;
+   long ind;
+   int query_len, indx;
VConn *conn;
Vresult *res;
RETCODE stat;
SWORD cols,i,colnamelen;
SDWORD rows,coldesc;
 
-   if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, ind, exec_str) 
== FAILURE) {
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ls, ind, 
query, query_len) == FAILURE) {
+   return;
}
-   PHP_BIRDSTEP_CHK_LNK(ind);
 
-   convert_to_string_ex(exec_str);
-   

[PHP-CVS] cvs: php-src /ext/readline readline.c

2008-06-25 Thread Felipe Pena
felipe  Wed Jun 25 16:22:13 2008 UTC

  Modified files:  
/php-src/ext/readline   readline.c 
  Log:
  - New parameter parsing API
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/readline/readline.c?r1=1.50r2=1.51diff_format=u
Index: php-src/ext/readline/readline.c
diff -u php-src/ext/readline/readline.c:1.50 
php-src/ext/readline/readline.c:1.51
--- php-src/ext/readline/readline.c:1.50Mon Dec 31 07:12:13 2007
+++ php-src/ext/readline/readline.c Wed Jun 25 16:22:13 2008
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: readline.c,v 1.50 2007/12/31 07:12:13 sebastian Exp $ */
+/* $Id: readline.c,v 1.51 2008/06/25 16:22:13 felipe Exp $ */
 
 /* {{{ includes  prototypes */
 
@@ -154,21 +154,20 @@
 
 /* }}} */
 
-/* {{{ proto mixed readline_info([string varname] [, string newvalue]) 
-   Gets/sets various internal readline variables. */
-
 #define SAFE_STRING(s) ((s)?(char*)(s):)
 
+/* {{{ proto mixed readline_info([string varname [, string newvalue]]) 
+   Gets/sets various internal readline variables. */
 PHP_FUNCTION(readline_info)
 {
-   zval **what;
+   char *what;
zval **value;
-   int oldval;
+   int what_len, oldval;
char *oldstr;
int ac = ZEND_NUM_ARGS();
 
-   if (ac  0 || ac  2 || zend_get_parameters_ex(ac, what, value) == 
FAILURE) {
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |sZ, what, 
what_len, value) == FAILURE) {
+   return;
}
 
if (ac == 0) {
@@ -189,9 +188,7 @@
add_assoc_string(return_value,library_version,(char 
*)SAFE_STRING(rl_library_version),1);
add_assoc_string(return_value,readline_name,(char 
*)SAFE_STRING(rl_readline_name),1);
} else {
-   convert_to_string_ex(what);
-
-   if (! strcasecmp(Z_STRVAL_PP(what),line_buffer)) {
+   if (!strcasecmp(what,line_buffer)) {
oldstr = rl_line_buffer;
if (ac == 2) {
/* XXX if (rl_line_buffer) 
free(rl_line_buffer); */
@@ -199,34 +196,34 @@
rl_line_buffer = strdup(Z_STRVAL_PP(value));
}
RETVAL_STRING(SAFE_STRING(oldstr),1);
-   } else if (! strcasecmp(Z_STRVAL_PP(what),point)) {
+   } else if (!strcasecmp(what, point)) {
RETVAL_LONG(rl_point);
-   } else if (! strcasecmp(Z_STRVAL_PP(what),end)) {
+   } else if (!strcasecmp(what, end)) {
RETVAL_LONG(rl_end);
 #ifdef HAVE_LIBREADLINE
-   } else if (! strcasecmp(Z_STRVAL_PP(what),mark)) {
+   } else if (!strcasecmp(what, mark)) {
RETVAL_LONG(rl_mark);
-   } else if (! strcasecmp(Z_STRVAL_PP(what),done)) {
+   } else if (!strcasecmp(what, done)) {
oldval = rl_done;
if (ac == 2) {
convert_to_long_ex(value);
rl_done = Z_LVAL_PP(value);
}
RETVAL_LONG(oldval);
-   } else if (! strcasecmp(Z_STRVAL_PP(what),pending_input)) {
+   } else if (!strcasecmp(what, pending_input)) {
oldval = rl_pending_input;
if (ac == 2) {
convert_to_string_ex(value);
rl_pending_input = Z_STRVAL_PP(value)[0];
}
RETVAL_LONG(oldval);
-   } else if (! strcasecmp(Z_STRVAL_PP(what),prompt)) {
+   } else if (!strcasecmp(what, prompt)) {
RETVAL_STRING(SAFE_STRING(rl_prompt),1);
-   } else if (! strcasecmp(Z_STRVAL_PP(what),terminal_name)) {
+   } else if (!strcasecmp(what, terminal_name)) {
RETVAL_STRING((char *)SAFE_STRING(rl_terminal_name),1);
 #endif
 #if HAVE_ERASE_EMPTY_LINE
-   } else if (! strcasecmp(Z_STRVAL_PP(what),erase_empty_line)) {
+   } else if (!strcasecmp(what, erase_empty_line)) {
oldval = rl_erase_empty_line;
if (ac == 2) {
convert_to_long_ex(value);
@@ -234,9 +231,9 @@
}
RETVAL_LONG(oldval);
 #endif
-   } else if (! strcasecmp(Z_STRVAL_PP(what),library_version)) {
+   } else if (!strcasecmp(what,library_version)) {
RETVAL_STRING((char 
*)SAFE_STRING(rl_library_version),1);
-   } else if (! strcasecmp(Z_STRVAL_PP(what),readline_name)) {
+   } else if (!strcasecmp(what, readline_name)) {
oldstr = (char*)rl_readline_name;