[PHP-CVS] cvs: php-src /ext/standard type.c var.c /ext/standard/tests/class_object get_class_variation_001.phpt get_object_vars_variation_003.phpt is_a_variation_002.phpt is_subclass_of_variation_002

2008-08-18 Thread Felipe Pena
felipe  Tue Aug 19 02:51:28 2008 UTC

  Modified files:  
/php-src/ext/standard   type.c var.c 
/php-src/ext/standard/tests/class_object
get_class_variation_001.phpt 

get_object_vars_variation_003.phpt 
is_a_variation_002.phpt 

is_subclass_of_variation_002.phpt 

method_exists_variation_002.phpt 
/php-src/ext/standard/tests/filefread_error.phpt fscanf.phpt 
/php-src/ext/standard/tests/general_functions   
debug_zval_dump_e.phpt 
floatval.phpt 

gettype_settype_error.phpt 
intval.phpt 
is_numeric.phpt 
is_scalar.phpt 
is_string.phpt 
strval.phpt 
var_dump.phpt 
/php-src/ext/standard/tests/strings join_error.phpt 
  Log:
  - MFB: New parameter parsing API
  - Fixed tests
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/standard/type.c?r1=1.56r2=1.57diff_format=u
Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.56 php-src/ext/standard/type.c:1.57
--- php-src/ext/standard/type.c:1.56Sat Aug  2 04:40:45 2008
+++ php-src/ext/standard/type.c Tue Aug 19 02:51:27 2008
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: type.c,v 1.56 2008/08/02 04:40:45 felipe Exp $ */
+/* $Id: type.c,v 1.57 2008/08/19 02:51:27 felipe Exp $ */
 
 #include php.h
 #include php_incomplete_class.h
@@ -27,8 +27,8 @@
 {
zval **arg;
 
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, arg) == FAILURE) 
{
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z, arg) == 
FAILURE) {
+   return;
}
 
switch (Z_TYPE_PP(arg)) {
@@ -94,16 +94,14 @@
Set the type of the variable */
 PHP_FUNCTION(settype)
 {
-   zval **var, **type;
+   zval **var;
char *new_type;
+   int new_type_len;
 
-   if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, var, type) == 
FAILURE) {
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Zs, var, 
new_type, new_type_len) == FAILURE) {
+   return;
}
 
-   convert_to_string_ex(type);
-   new_type = Z_STRVAL_PP(type);
-
if (!strcasecmp(new_type, integer)) {
convert_to_long(*var);
} else if (!strcasecmp(new_type, int)) {
@@ -147,27 +145,16 @@
Get the integer value of a variable using the optional base for the 
conversion */
 PHP_FUNCTION(intval)
 {
-   zval **num, **arg_base;
-   int base;
-
-   switch (ZEND_NUM_ARGS()) {
-   case 1:
-   if (zend_get_parameters_ex(1, num) == FAILURE) {
-   WRONG_PARAM_COUNT;
-   }
-   base = 10;
-   break;
-
-   case 2:
-   if (zend_get_parameters_ex(2, num, arg_base) == 
FAILURE) {
-   WRONG_PARAM_COUNT;
-   }
-   convert_to_long_ex(arg_base);
-   base = Z_LVAL_PP(arg_base);
-   break;
+   zval **num;
+   long arg_base = 0;
+   int base = 10;
 
-   default:
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z|l, num, 
arg_base) == FAILURE) {
+   return;
+   }
+   
+   if (ZEND_NUM_ARGS() == 2) {
+   base = arg_base;
}
 
RETVAL_ZVAL(*num, 1, 0);
@@ -181,8 +168,8 @@
 {
zval **num;
 
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, num) == FAILURE) 
{
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z, num) == 
FAILURE) {
+   return;
}
 
RETVAL_ZVAL(*num, 1, 0);
@@ -198,8 +185,8 @@
zval expr_copy;
int use_copy;
 
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, num) == FAILURE) 
{
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z, num) == 
FAILURE) {
+   return;
}
 
if (UG(unicode)) {
@@ -329,14 +316,13 @@
Returns true if variable is a Unicode or binary string */
 PHP_FUNCTION(is_string)
 {
-   zval 

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

2008-03-29 Thread Felipe Pena
felipe  Sat Mar 29 22:02:20 2008 UTC

  Modified files:  
/php-src/ext/standard   type.c 
  Log:
  - Fixed bug #44533 (floatval() issues E_NOTICE non well formed numeric 
value)
  (Keep the old behavior, as other related functions)
  
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/type.c?r1=1.54r2=1.55diff_format=u
Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.54 php-src/ext/standard/type.c:1.55
--- php-src/ext/standard/type.c:1.54Sat Feb  2 13:11:12 2008
+++ php-src/ext/standard/type.c Sat Mar 29 22:02:20 2008
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: type.c,v 1.54 2008/02/02 13:11:12 helly Exp $ */
+/* $Id: type.c,v 1.55 2008/03/29 22:02:20 felipe Exp $ */
 
 #include php.h
 #include php_incomplete_class.h
@@ -179,13 +179,14 @@
Get the float value of a variable */
 PHP_FUNCTION(floatval)
 {
-   double retval;
+   zval **num;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, d, retval) == 
FAILURE) {
-   return;
+   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, num) == FAILURE) 
{
+   WRONG_PARAM_COUNT;
}
 
-   RETURN_DOUBLE(retval);
+   RETVAL_ZVAL(*num, 1, 0);
+   convert_to_double(return_value);
 }
 /* }}} */
 



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



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

2008-02-02 Thread Marcus Boerger
helly   Sat Feb  2 13:11:13 2008 UTC

  Modified files:  
/php-src/ext/standard   type.c 
  Log:
  - Fix flag handling (MFB)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/type.c?r1=1.53r2=1.54diff_format=u
Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.53 php-src/ext/standard/type.c:1.54
--- php-src/ext/standard/type.c:1.53Mon Dec 31 07:12:16 2007
+++ php-src/ext/standard/type.c Sat Feb  2 13:11:12 2008
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: type.c,v 1.53 2007/12/31 07:12:16 sebastian Exp $ */
+/* $Id: type.c,v 1.54 2008/02/02 13:11:12 helly Exp $ */
 
 #include php.h
 #include php_incomplete_class.h
@@ -467,6 +467,7 @@
return;
}
 
+   syntax_only = syntax_only ? IS_CALLABLE_CHECK_SYNTAX_ONLY : 0;
if (ZEND_NUM_ARGS()  2) {
retval = zend_is_callable(var, syntax_only, name);
REPLACE_ZVAL_VALUE(callable_name, name, 0);

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



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

2007-05-31 Thread Antony Dovgal
tony2001Thu May 31 21:36:56 2007 UTC

  Modified files:  
/php-src/ext/standard   type.c 
  Log:
  fix folding
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/type.c?r1=1.51r2=1.52diff_format=u
Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.51 php-src/ext/standard/type.c:1.52
--- php-src/ext/standard/type.c:1.51Thu May 17 17:29:09 2007
+++ php-src/ext/standard/type.c Thu May 31 21:36:56 2007
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: type.c,v 1.51 2007/05/17 17:29:09 tony2001 Exp $ */
+/* $Id: type.c,v 1.52 2007/05/31 21:36:56 tony2001 Exp $ */
 
 #include php.h
 #include php_incomplete_class.h
@@ -215,7 +215,7 @@
 }
 /* }}} */
 
-static void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type)
+static void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
 {
zval *arg;
 
@@ -274,7 +274,7 @@
RETURN_FALSE;
}
 }
-
+/* }}} */
 
 /* {{{ proto bool is_null(mixed var) U
Returns true if variable is null */

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



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

2006-10-08 Thread Sara Golemon
pollita Sun Oct  8 18:00:44 2006 UTC

  Modified files:  
/php-src/ext/standard   type.c 
  Log:
  Fix win32 (again), just temporarily convert the classname to ascii on this 
platform...
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/type.c?r1=1.46r2=1.47diff_format=u
Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.46 php-src/ext/standard/type.c:1.47
--- php-src/ext/standard/type.c:1.46Sat Oct  7 04:45:42 2006
+++ php-src/ext/standard/type.c Sun Oct  8 18:00:44 2006
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: type.c,v 1.46 2006/10/07 04:45:42 pollita Exp $ */
+/* $Id: type.c,v 1.47 2006/10/08 18:00:44 pollita Exp $ */
 
 #include php.h
 #include php_incomplete_class.h
@@ -238,12 +238,25 @@
/* We can get away with this because 
INCOMPLETE_CLASS is ascii and has a 1:1 relationship with unicode */
RETURN_TRUE;
} else if (UG(unicode)) {
+#ifndef PHP_WIN32
U_STRING_DECL(uIncompleteClass, 
(INCOMPLETE_CLASS), sizeof(INCOMPLETE_CLASS) - 1);
U_STRING_INIT(uIncompleteClass, 
(INCOMPLETE_CLASS), sizeof(INCOMPLETE_CLASS) - 1);
 
if (!memcmp(ce-name.u, uIncompleteClass, 
UBYTES(sizeof(INCOMPLETE_CLASS {
RETURN_FALSE;
}
+#else /* WIN32 -- U_STRING_DECL breaks under Win32 with string macros */
+   char *ascii_name = 
zend_unicode_to_ascii(ce-name.u, ce-name_length TSRSMLS_CC);
+
+   if (ascii_name) {
+   if (memcmp(INCOMPLETE_CLASS, 
ascii_name, sizeof(INCOMPLETE_CLASS) - 1) == 0) {
+   efree(ascii_name);
+   RETURN_FALSE;
+   }
+   efree(ascii_name);
+   }
+   /* Non-ascii class name means it can't be 
INCOMPLETE_CLASS and is therefore okay */
+#endif
} else {
if (!memcmp(ce-name.s, INCOMPLETE_CLASS, 
sizeof(INCOMPLETE_CLASS))) {
RETURN_FALSE;

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



Re: [PHP-CVS] cvs: php-src /ext/standard type.c

2006-10-08 Thread Edin Kadribasic
According to U_STRING_DECL documentation the second arg can only be a 
string literal, so I guess coding for undocumented behavior is not 
should be avoided on all platforms.


Edin

Sara Golemon wrote:

pollita Sun Oct  8 18:00:44 2006 UTC

  Modified files:  
/php-src/ext/standard	type.c 
  Log:

  Fix win32 (again), just temporarily convert the classname to ascii on this 
platform...
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/type.c?r1=1.46r2=1.47diff_format=u

Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.46 php-src/ext/standard/type.c:1.47
--- php-src/ext/standard/type.c:1.46Sat Oct  7 04:45:42 2006
+++ php-src/ext/standard/type.c Sun Oct  8 18:00:44 2006
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: type.c,v 1.46 2006/10/07 04:45:42 pollita Exp $ */

+/* $Id: type.c,v 1.47 2006/10/08 18:00:44 pollita Exp $ */
 
 #include php.h

 #include php_incomplete_class.h
@@ -238,12 +238,25 @@
/* We can get away with this because 
INCOMPLETE_CLASS is ascii and has a 1:1 relationship with unicode */
RETURN_TRUE;
} else if (UG(unicode)) {
+#ifndef PHP_WIN32
U_STRING_DECL(uIncompleteClass, 
(INCOMPLETE_CLASS), sizeof(INCOMPLETE_CLASS) - 1);
U_STRING_INIT(uIncompleteClass, 
(INCOMPLETE_CLASS), sizeof(INCOMPLETE_CLASS) - 1);
 
 if (!memcmp(ce-name.u, uIncompleteClass, UBYTES(sizeof(INCOMPLETE_CLASS {

RETURN_FALSE;
}
+#else /* WIN32 -- U_STRING_DECL breaks under Win32 with string macros */
+   char *ascii_name = 
zend_unicode_to_ascii(ce-name.u, ce-name_length TSRSMLS_CC);
+
+   if (ascii_name) {
+   if (memcmp(INCOMPLETE_CLASS, 
ascii_name, sizeof(INCOMPLETE_CLASS) - 1) == 0) {
+   efree(ascii_name);
+   RETURN_FALSE;
+   }
+   efree(ascii_name);
+   }
+   /* Non-ascii class name means it can't be 
INCOMPLETE_CLASS and is therefore okay */
+#endif
} else {
if (!memcmp(ce-name.s, INCOMPLETE_CLASS, 
sizeof(INCOMPLETE_CLASS))) {
RETURN_FALSE;



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



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

2006-10-08 Thread Sara Golemon
pollita Mon Oct  9 02:55:38 2006 UTC

  Modified files:  
/php-src/ext/standard   type.c 
  Log:
  Oi
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/type.c?r1=1.47r2=1.48diff_format=u
Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.47 php-src/ext/standard/type.c:1.48
--- php-src/ext/standard/type.c:1.47Sun Oct  8 18:00:44 2006
+++ php-src/ext/standard/type.c Mon Oct  9 02:55:38 2006
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: type.c,v 1.47 2006/10/08 18:00:44 pollita Exp $ */
+/* $Id: type.c,v 1.48 2006/10/09 02:55:38 pollita Exp $ */
 
 #include php.h
 #include php_incomplete_class.h
@@ -246,7 +246,7 @@
RETURN_FALSE;
}
 #else /* WIN32 -- U_STRING_DECL breaks under Win32 with string macros */
-   char *ascii_name = 
zend_unicode_to_ascii(ce-name.u, ce-name_length TSRSMLS_CC);
+   char *ascii_name = 
zend_unicode_to_ascii(ce-name.u, ce-name_length TSRMLS_CC);
 
if (ascii_name) {
if (memcmp(INCOMPLETE_CLASS, 
ascii_name, sizeof(INCOMPLETE_CLASS) - 1) == 0) {

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



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

2006-10-06 Thread Andrei Zmievski
andrei  Fri Oct  6 20:11:25 2006 UTC

  Modified files:  
/php-src/ext/standard   type.c 
  Log:
  Unicode support in is_callable().
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/type.c?r1=1.44r2=1.45diff_format=u
Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.44 php-src/ext/standard/type.c:1.45
--- php-src/ext/standard/type.c:1.44Mon Sep 25 01:37:55 2006
+++ php-src/ext/standard/type.c Fri Oct  6 20:11:25 2006
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: type.c,v 1.44 2006/09/25 01:37:55 pollita Exp $ */
+/* $Id: type.c,v 1.45 2006/10/06 20:11:25 andrei Exp $ */
 
 #include php.h
 #include php_incomplete_class.h
@@ -441,31 +441,25 @@
 }
 /* }}} */
 
-/* {{{ proto bool is_callable(mixed var [, bool syntax_only [, string 
callable_name]]) 
+/* {{{ proto bool is_callable(mixed var [, bool syntax_only [, string 
callable_name]])  U
Returns true if var is callable. */
 PHP_FUNCTION(is_callable)
 {
-   zval **var, **syntax_only, **callable_name;
+   zval *var, **callable_name;
zval name;
zend_bool retval;
-   zend_bool syntax = 0;
-   int argc=ZEND_NUM_ARGS();
+   zend_bool syntax_only = 0;
 
-   if (argc  1 || argc  3 || zend_get_parameters_ex(argc, var, 
syntax_only, callable_name) == FAILURE) {
-   WRONG_PARAM_COUNT;
-   }
-
-   if (argc  1) {
-   convert_to_boolean_ex(syntax_only);
-   syntax = Z_BVAL_PP(syntax_only);
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z|bZ, var,
+ syntax_only, 
callable_name) == FAILURE) {
+   return;
}
 
-   if (argc  2) {
-   retval = zend_is_callable(*var, syntax, name);
-   zval_dtor(*callable_name);
-   **callable_name = name;
+   if (ZEND_NUM_ARGS()  2) {
+   retval = zend_is_callable(var, syntax_only, name);
+   REPLACE_ZVAL_VALUE(callable_name, name, 0);
} else {
-   retval = zend_is_callable(*var, syntax, NULL);
+   retval = zend_is_callable(var, syntax_only, NULL);
}
 
RETURN_BOOL(retval);

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



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

2006-10-06 Thread Sara Golemon
pollita Sat Oct  7 04:45:42 2006 UTC

  Modified files:  
/php-src/ext/standard   type.c 
  Log:
  Win32 build gets confused by expansion of U_STRING_DECL macro with constants
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/type.c?r1=1.45r2=1.46diff_format=u
Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.45 php-src/ext/standard/type.c:1.46
--- php-src/ext/standard/type.c:1.45Fri Oct  6 20:11:25 2006
+++ php-src/ext/standard/type.c Sat Oct  7 04:45:42 2006
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: type.c,v 1.45 2006/10/06 20:11:25 andrei Exp $ */
+/* $Id: type.c,v 1.46 2006/10/07 04:45:42 pollita Exp $ */
 
 #include php.h
 #include php_incomplete_class.h
@@ -238,8 +238,8 @@
/* We can get away with this because 
INCOMPLETE_CLASS is ascii and has a 1:1 relationship with unicode */
RETURN_TRUE;
} else if (UG(unicode)) {
-   U_STRING_DECL(uIncompleteClass, 
INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1);
-   U_STRING_INIT(uIncompleteClass, 
INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1);
+   U_STRING_DECL(uIncompleteClass, 
(INCOMPLETE_CLASS), sizeof(INCOMPLETE_CLASS) - 1);
+   U_STRING_INIT(uIncompleteClass, 
(INCOMPLETE_CLASS), sizeof(INCOMPLETE_CLASS) - 1);
 
if (!memcmp(ce-name.u, uIncompleteClass, 
UBYTES(sizeof(INCOMPLETE_CLASS {
RETURN_FALSE;

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



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

2006-09-24 Thread Sara Golemon
pollita Sun Sep 24 18:23:47 2006 UTC

  Modified files:  
/php-src/ext/standard   type.c 
  Log:
  PHP6 Updates
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/type.c?r1=1.42r2=1.43diff_format=u
Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.42 php-src/ext/standard/type.c:1.43
--- php-src/ext/standard/type.c:1.42Fri Mar 17 23:00:20 2006
+++ php-src/ext/standard/type.c Sun Sep 24 18:23:47 2006
@@ -16,12 +16,12 @@
+--+
 */
 
-/* $Id: type.c,v 1.42 2006/03/17 23:00:20 andrei Exp $ */
+/* $Id: type.c,v 1.43 2006/09/24 18:23:47 pollita Exp $ */
 
 #include php.h
 #include php_incomplete_class.h
 
-/* {{{ proto string gettype(mixed var)
+/* {{{ proto string gettype(mixed var) U
Returns the type of the variable */
 PHP_FUNCTION(gettype)
 {
@@ -91,7 +91,7 @@
 }
 /* }}} */
 
-/* {{{ proto bool settype(mixed var, string type)
+/* {{{ proto bool settype(mixed var, string type) U
Set the type of the variable */
 PHP_FUNCTION(settype)
 {
@@ -115,6 +115,8 @@
convert_to_double(*var);
} else if (!strcasecmp(new_type, string)) {
convert_to_string(*var);
+   } else if (!strcasecmp(new_type, unicode)) {
+   convert_to_unicode(*var);
} else if (!strcasecmp(new_type, array)) {
convert_to_array(*var);
} else if (!strcasecmp(new_type, object)) {
@@ -136,7 +138,7 @@
 }
 /* }}} */
 
-/* {{{ proto int intval(mixed var [, int base])
+/* {{{ proto int intval(mixed var [, int base]) U
Get the integer value of a variable using the optional base for the 
conversion */
 PHP_FUNCTION(intval)
 {
@@ -168,22 +170,21 @@
 }
 /* }}} */
 
-/* {{{ proto float floatval(mixed var)
+/* {{{ proto float floatval(mixed var) U
Get the float value of a variable */
 PHP_FUNCTION(floatval)
 {
-   zval **num;
+   double retval;
 
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, num) == FAILURE) 
{
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, d, retval) == 
FAILURE) {
+   return;
}
 
-   RETVAL_ZVAL(*num, 1, 0);
-   convert_to_double(return_value);
+   RETURN_DOUBLE(retval);
 }
 /* }}} */
 
-/* {{{ proto string strval(mixed var)
+/* {{{ proto string strval(mixed var) U
Get the string value of a variable */
 PHP_FUNCTION(strval)
 {
@@ -211,29 +212,41 @@
 
 static void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type)
 {
-   zval **arg;
+   zval *arg;
 
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, arg) == FAILURE) 
{
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Only one argument 
expected);
-   RETURN_FALSE;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z, arg) == 
FAILURE) {
+   return;
}
 
-   if (Z_TYPE_PP(arg) == type) {
+   if (Z_TYPE_P(arg) == type) {
if (type == IS_OBJECT) {
zend_class_entry *ce;
-   if(Z_OBJ_HT_PP(arg)-get_class_entry == NULL) {
-   /* if there's no get_class_entry it's not a PHP object, 
so it can't be INCOMPLETE_CLASS */
+
+   if(Z_OBJ_HT_P(arg)-get_class_entry == NULL) {
+   /* if there's no get_class_entry it's not a PHP 
object, so it can't be INCOMPLETE_CLASS */
RETURN_TRUE;
}
-   ce = Z_OBJCE_PP(arg);
-   /* FIXME: Unicode support??? */
-   if (!strcmp(ce-name.s, INCOMPLETE_CLASS)) {
-   RETURN_FALSE;
+   ce = Z_OBJCE_P(arg);
+
+   if (ce-name_length != sizeof(INCOMPLETE_CLASS) - 1) {
+   /* We can get away with this because 
INCOMPLETE_CLASS is ascii and has a 1:1 relationship with unicode */
+   RETURN_TRUE;
+   } else if (UG(unicode)) {
+   U_STRING_DECL(uIncompleteClass, 
INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1);
+   U_STRING_INIT(uIncompleteClass, 
INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1);
+
+   if (!memcmp(ce-name.u, uIncompleteClass, 
UBYTES(sizeof(INCOMPLETE_CLASS {
+   RETURN_FALSE;
+   }
+   } else {
+   if (!memcmp(ce-name.s, INCOMPLETE_CLASS, 
sizeof(INCOMPLETE_CLASS))) {
+   RETURN_FALSE;
+   }
}
}
if (type == IS_RESOURCE) {
char *type_name;
-   type_name = zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(arg) 
TSRMLS_CC);
+  

Re: [PHP-CVS] cvs: php-src /ext/standard type.c

2006-09-24 Thread Andrei Zmievski
For settype(), should we treat 'string' the same as (string) casting,  
i.e. make it depend on u.s switch?


-Andrei


On Sep 24, 2006, at 11:23 AM, Sara Golemon wrote:


pollita Sun Sep 24 18:23:47 2006 UTC

  Modified files:
/php-src/ext/standard   type.c
  Log:
  PHP6 Updates

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/type.c? 
r1=1.42r2=1.43diff_format=u

Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.42 php-src/ext/standard/ 
type.c:1.43

--- php-src/ext/standard/type.c:1.42Fri Mar 17 23:00:20 2006
+++ php-src/ext/standard/type.c Sun Sep 24 18:23:47 2006
@@ -16,12 +16,12 @@
 
+- 
-+

 */

-/* $Id: type.c,v 1.42 2006/03/17 23:00:20 andrei Exp $ */
+/* $Id: type.c,v 1.43 2006/09/24 18:23:47 pollita Exp $ */

 #include php.h
 #include php_incomplete_class.h

-/* {{{ proto string gettype(mixed var)
+/* {{{ proto string gettype(mixed var) U
Returns the type of the variable */
 PHP_FUNCTION(gettype)
 {
@@ -91,7 +91,7 @@
 }
 /* }}} */

-/* {{{ proto bool settype(mixed var, string type)
+/* {{{ proto bool settype(mixed var, string type) U
Set the type of the variable */
 PHP_FUNCTION(settype)
 {
@@ -115,6 +115,8 @@
convert_to_double(*var);
} else if (!strcasecmp(new_type, string)) {
convert_to_string(*var);
+   } else if (!strcasecmp(new_type, unicode)) {
+   convert_to_unicode(*var);
} else if (!strcasecmp(new_type, array)) {
convert_to_array(*var);
} else if (!strcasecmp(new_type, object)) {
@@ -136,7 +138,7 @@
 }
 /* }}} */

-/* {{{ proto int intval(mixed var [, int base])
+/* {{{ proto int intval(mixed var [, int base]) U
Get the integer value of a variable using the optional base for  
the conversion */

 PHP_FUNCTION(intval)
 {
@@ -168,22 +170,21 @@
 }
 /* }}} */

-/* {{{ proto float floatval(mixed var)
+/* {{{ proto float floatval(mixed var) U
Get the float value of a variable */
 PHP_FUNCTION(floatval)
 {
-   zval **num;
+   double retval;

-	if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, num) ==  
FAILURE) {

-   WRONG_PARAM_COUNT;
+	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, d,  
retval) == FAILURE) {

+   return;
}

-   RETVAL_ZVAL(*num, 1, 0);
-   convert_to_double(return_value);
+   RETURN_DOUBLE(retval);
 }
 /* }}} */

-/* {{{ proto string strval(mixed var)
+/* {{{ proto string strval(mixed var) U
Get the string value of a variable */
 PHP_FUNCTION(strval)
 {
@@ -211,29 +212,41 @@

 static void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type)
 {
-   zval **arg;
+   zval *arg;

-	if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, arg) ==  
FAILURE) {
-		php_error_docref(NULL TSRMLS_CC, E_WARNING, Only one argument  
expected);

-   RETURN_FALSE;
+	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z, arg)  
== FAILURE) {

+   return;
}

-   if (Z_TYPE_PP(arg) == type) {
+   if (Z_TYPE_P(arg) == type) {
if (type == IS_OBJECT) {
zend_class_entry *ce;
-   if(Z_OBJ_HT_PP(arg)-get_class_entry == NULL) {
-			/* if there's no get_class_entry it's not a PHP object, so it  
can't be INCOMPLETE_CLASS */

+
+   if(Z_OBJ_HT_P(arg)-get_class_entry == NULL) {
+/* if there's no get_class_entry it's not a PHP object, so it  
can't be INCOMPLETE_CLASS */

RETURN_TRUE;
}
-   ce = Z_OBJCE_PP(arg);
-   /* FIXME: Unicode support??? */
-   if (!strcmp(ce-name.s, INCOMPLETE_CLASS)) {
-   RETURN_FALSE;
+   ce = Z_OBJCE_P(arg);
+
+   if (ce-name_length != sizeof(INCOMPLETE_CLASS) - 1) {
+/* We can get away with this because INCOMPLETE_CLASS is ascii  
and has a 1:1 relationship with unicode */

+   RETURN_TRUE;
+   } else if (UG(unicode)) {
+U_STRING_DECL(uIncompleteClass, INCOMPLETE_CLASS, sizeof 
(INCOMPLETE_CLASS) - 1);
+U_STRING_INIT(uIncompleteClass, INCOMPLETE_CLASS, sizeof 
(INCOMPLETE_CLASS) - 1);

+
+if (!memcmp(ce-name.u, uIncompleteClass, UBYTES(sizeof 
(INCOMPLETE_CLASS {

+   RETURN_FALSE;
+   }
+   } else {
+if (!memcmp(ce-name.s, INCOMPLETE_CLASS, sizeof 
(INCOMPLETE_CLASS))) {

+   RETURN_FALSE;
+   }
}
}
if (type == IS_RESOURCE) {
char *type_name;
-			type_name = zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(arg)  
TSRMLS_CC);

+   type_name = 

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

2006-09-24 Thread Sara Golemon
pollita Mon Sep 25 01:37:55 2006 UTC

  Modified files:  
/php-src/ext/standard   type.c 
  Log:
  Make settype($var, 'string'); behave like $var = (string)$var;
  e.g. switch between (binary) and (unicode) depending on UG(unicode)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/type.c?r1=1.43r2=1.44diff_format=u
Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.43 php-src/ext/standard/type.c:1.44
--- php-src/ext/standard/type.c:1.43Sun Sep 24 18:23:47 2006
+++ php-src/ext/standard/type.c Mon Sep 25 01:37:55 2006
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: type.c,v 1.43 2006/09/24 18:23:47 pollita Exp $ */
+/* $Id: type.c,v 1.44 2006/09/25 01:37:55 pollita Exp $ */
 
 #include php.h
 #include php_incomplete_class.h
@@ -113,9 +113,15 @@
convert_to_double(*var);
} else if (!strcasecmp(new_type, double)) { /* deprecated */
convert_to_double(*var);
-   } else if (!strcasecmp(new_type, string)) {
+   } else if (!strcasecmp(new_type, binary)) { /* explicit binary cast */
convert_to_string(*var);
-   } else if (!strcasecmp(new_type, unicode)) {
+   } else if (!strcasecmp(new_type, string)) { /* runtime string type */
+   if (UG(unicode)) {
+   convert_to_unicode(*var);
+   } else {
+   convert_to_string(*var);
+   }
+   } else if (!strcasecmp(new_type, unicode)) { /* explicit unicode cast 
*/
convert_to_unicode(*var);
} else if (!strcasecmp(new_type, array)) {
convert_to_array(*var);

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



Re: [PHP-CVS] cvs: php-src /ext/standard type.c

2006-09-24 Thread Andrei Zmievski

Actually, the whole if() thing can be replaced by convert_to_text().

-Andrei

On Sep 24, 2006, at 6:37 PM, Sara Golemon wrote:

+	} else if (!strcasecmp(new_type, string)) { /* runtime string  
type */

+   if (UG(unicode)) {
+   convert_to_unicode(*var);
+   } else {
+   convert_to_string(*var);
+   }
+	} else if (!strcasecmp(new_type, unicode)) { /* explicit  
unicode cast */


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



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

2006-03-17 Thread Andrei Zmievski
andrei  Fri Mar 17 23:00:20 2006 UTC

  Modified files:  
/php-src/ext/standard   type.c 
  Log:
  Make is_string() return TRUE for both Unicode and binary strings.
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/type.c?r1=1.41r2=1.42diff_format=u
Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.41 php-src/ext/standard/type.c:1.42
--- php-src/ext/standard/type.c:1.41Fri Mar 17 14:29:05 2006
+++ php-src/ext/standard/type.c Fri Mar 17 23:00:20 2006
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: type.c,v 1.41 2006/03/17 14:29:05 derick Exp $ */
+/* $Id: type.c,v 1.42 2006/03/17 23:00:20 andrei Exp $ */
 
 #include php.h
 #include php_incomplete_class.h
@@ -294,10 +294,21 @@
 /* }}} */
 
 /* {{{ proto bool is_string(mixed var)
-   Returns true if variable is a string */
+   Returns true if variable is a Unicode or binary string */
 PHP_FUNCTION(is_string)
 {
-   php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, UG(unicode) ? IS_UNICODE 
: IS_STRING);
+   zval **arg;
+
+   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, arg) == FAILURE) 
{
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Only one argument 
expected);
+   RETURN_FALSE;
+   }
+
+   if (Z_TYPE_PP(arg) == IS_UNICODE || Z_TYPE_PP(arg) == IS_STRING) {
+   RETURN_TRUE;
+   } else {
+   RETURN_FALSE;
+   }
 }
 /* }}} */
 

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



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

2005-08-13 Thread Marcus Boerger
helly   Sat Aug 13 06:19:32 2005 EDT

  Modified files:  
/php-src/ext/standard   type.c 
  Log:
  - IS_STRING does not necessarily mean ascii so 'standard' is better
  # Maybe we call them legacy strings
  
  
http://cvs.php.net/diff.php/php-src/ext/standard/type.c?r1=1.32r2=1.33ty=u
Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.32 php-src/ext/standard/type.c:1.33
--- php-src/ext/standard/type.c:1.32Sat Aug 13 06:16:04 2005
+++ php-src/ext/standard/type.c Sat Aug 13 06:19:31 2005
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: type.c,v 1.32 2005/08/13 10:16:04 helly Exp $ */
+/* $Id: type.c,v 1.33 2005/08/13 10:19:31 helly Exp $ */
 
 #include php.h
 #include php_incomplete_class.h
@@ -309,7 +309,7 @@
 /* }}} */
 
 /* {{{ proto bool is_buffer(mixed var)
-   Returns true if variable is a ascii, unicode or binary string */
+   Returns true if variable is a standard, unicode or binary string */
 PHP_FUNCTION(is_buffer)
 {
pval **arg;

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



Re: [PHP-CVS] cvs: php-src /ext/standard type.c

2005-08-13 Thread Marcus Boerger
Hello Andrey,

  not really. Havin it as functions in the engine wouldn't change anything.
Having it as opcodes it would be much faster but then all of those would
become keywords and that would break tons of scripts (assuming i am not the
only one using var names like $is_string, $is_array and such).

Saturday, August 13, 2005, 12:22:10 PM, you wrote:

Hi Marcus,
 isn't it possible to move this into the engine for efficiency reasons?


 Andrey

 Marcus Boerger wrote:
 helly Sat Aug 13 06:19:32 2005 EDT
 
   Modified files:  
 /php-src/ext/standard type.c 
   Log:
   - IS_STRING does not necessarily mean ascii so 'standard' is better
   # Maybe we call them legacy strings
   
   
 http://cvs.php.net/diff.php/php-src/ext/standard/type.c?r1=1.32r2=1.33ty=u
 Index: php-src/ext/standard/type.c
 diff -u php-src/ext/standard/type.c:1.32 php-src/ext/standard/type.c:1.33
 --- php-src/ext/standard/type.c:1.32  Sat Aug 13 06:16:04 2005
 +++ php-src/ext/standard/type.c   Sat Aug 13 06:19:31 2005
 @@ -16,7 +16,7 @@

 +--+
  */
  
 -/* $Id: type.c,v 1.32 2005/08/13 10:16:04 helly Exp $ */
 +/* $Id: type.c,v 1.33 2005/08/13 10:19:31 helly Exp $ */
  
  #include php.h
  #include php_incomplete_class.h
 @@ -309,7 +309,7 @@
  /* }}} */
  
  /* {{{ proto bool is_buffer(mixed var)
 -   Returns true if variable is a ascii, unicode or binary string */
 +   Returns true if variable is a standard, unicode or binary string */
  PHP_FUNCTION(is_buffer)
  {
   pval **arg;
 




Best regards,
 Marcus

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



Re: [PHP-CVS] cvs: php-src /ext/standard type.c

2005-08-13 Thread Andrei Zmievski
I would prefer calling them 'native' strings since they represent non- 
Unicode strings for the most part.


-Andrei


On Aug 13, 2005, at 3:19 AM, Marcus Boerger wrote:


hellySat Aug 13 06:19:32 2005 EDT

  Modified files:
/php-src/ext/standardtype.c
  Log:
  - IS_STRING does not necessarily mean ascii so 'standard' is better
  # Maybe we call them legacy strings


http://cvs.php.net/diff.php/php-src/ext/standard/type.c? 
r1=1.32r2=1.33ty=u

Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.32 php-src/ext/standard/ 
type.c:1.33

--- php-src/ext/standard/type.c:1.32Sat Aug 13 06:16:04 2005
+++ php-src/ext/standard/type.cSat Aug 13 06:19:31 2005
@@ -16,7 +16,7 @@
 
+- 
-+

 */

-/* $Id: type.c,v 1.32 2005/08/13 10:16:04 helly Exp $ */
+/* $Id: type.c,v 1.33 2005/08/13 10:19:31 helly Exp $ */

 #include php.h
 #include php_incomplete_class.h
@@ -309,7 +309,7 @@
 /* }}} */

 /* {{{ proto bool is_buffer(mixed var)
-   Returns true if variable is a ascii, unicode or binary string */
+   Returns true if variable is a standard, unicode or binary  
string */

 PHP_FUNCTION(is_buffer)
 {
 pval **arg;

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



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



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

2005-08-13 Thread Marcus Boerger
helly   Sat Aug 13 17:18:48 2005 EDT

  Modified files:  
/php-src/ext/standard   type.c 
  Log:
  - ntive is better than standard (Andrei)
  
http://cvs.php.net/diff.php/php-src/ext/standard/type.c?r1=1.33r2=1.34ty=u
Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.33 php-src/ext/standard/type.c:1.34
--- php-src/ext/standard/type.c:1.33Sat Aug 13 06:19:31 2005
+++ php-src/ext/standard/type.c Sat Aug 13 17:18:47 2005
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: type.c,v 1.33 2005/08/13 10:19:31 helly Exp $ */
+/* $Id: type.c,v 1.34 2005/08/13 21:18:47 helly Exp $ */
 
 #include php.h
 #include php_incomplete_class.h
@@ -285,7 +285,7 @@
 /* }}} */
 
 /* {{{ proto bool is_string(mixed var)
-   Returns true if variable is a standard string */
+   Returns true if variable is a native string */
 PHP_FUNCTION(is_string)
 {
php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_STRING);
@@ -309,7 +309,7 @@
 /* }}} */
 
 /* {{{ proto bool is_buffer(mixed var)
-   Returns true if variable is a standard, unicode or binary string */
+   Returns true if variable is a native, unicode or binary string */
 PHP_FUNCTION(is_buffer)
 {
pval **arg;

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



Re: [PHP-CVS] cvs: php-src /ext/standard type.c

2005-08-13 Thread Marcus Boerger
Hello Andrei,

  as you whish!

marcus

Saturday, August 13, 2005, 10:40:23 PM, you wrote:

 I would prefer calling them 'native' strings since they represent non- 
 Unicode strings for the most part.

 -Andrei


 On Aug 13, 2005, at 3:19 AM, Marcus Boerger wrote:

 hellySat Aug 13 06:19:32 2005 EDT

   Modified files:
 /php-src/ext/standardtype.c
   Log:
   - IS_STRING does not necessarily mean ascii so 'standard' is better
   # Maybe we call them legacy strings


 http://cvs.php.net/diff.php/php-src/ext/standard/type.c? 
 r1=1.32r2=1.33ty=u
 Index: php-src/ext/standard/type.c
 diff -u php-src/ext/standard/type.c:1.32 php-src/ext/standard/ 
 type.c:1.33
 --- php-src/ext/standard/type.c:1.32Sat Aug 13 06:16:04 2005
 +++ php-src/ext/standard/type.cSat Aug 13 06:19:31 2005
 @@ -16,7 +16,7 @@
  
 +- 
 -+
  */

 -/* $Id: type.c,v 1.32 2005/08/13 10:16:04 helly Exp $ */
 +/* $Id: type.c,v 1.33 2005/08/13 10:19:31 helly Exp $ */

  #include php.h
  #include php_incomplete_class.h
 @@ -309,7 +309,7 @@
  /* }}} */

  /* {{{ proto bool is_buffer(mixed var)
 -   Returns true if variable is a ascii, unicode or binary string */
 +   Returns true if variable is a standard, unicode or binary  
 string */
  PHP_FUNCTION(is_buffer)
  {
  pval **arg;

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





Best regards,
 Marcus

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



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

2005-05-25 Thread Stanislav Malyshev
stasWed May 25 06:57:42 2005 EDT

  Modified files:  
/php-src/ext/standard   type.c 
  Log:
  fix is_object() on non-php objects
  
  
http://cvs.php.net/diff.php/php-src/ext/standard/type.c?r1=1.27r2=1.28ty=u
Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.27 php-src/ext/standard/type.c:1.28
--- php-src/ext/standard/type.c:1.27Fri Apr 15 18:46:37 2005
+++ php-src/ext/standard/type.c Wed May 25 06:57:40 2005
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: type.c,v 1.27 2005/04/15 22:46:37 sniper Exp $ */
+/* $Id: type.c,v 1.28 2005/05/25 10:57:40 stas Exp $ */
 
 #include php.h
 #include php_incomplete_class.h
@@ -207,6 +207,10 @@
if (Z_TYPE_PP(arg) == type) {
if (type == IS_OBJECT) {
zend_class_entry *ce;
+   if(Z_OBJ_HT_PP(arg)-get_class_entry == NULL) {
+   /* if there's no get_class_entry it's not a PHP object, 
so it can't be INCOMPLETE_CLASS */
+   RETURN_TRUE;
+   }
ce = Z_OBJCE_PP(arg);
if (!strcmp(ce-name, INCOMPLETE_CLASS)) {
RETURN_FALSE;

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



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

2005-04-15 Thread Jani Taskinen
sniper  Fri Apr 15 18:46:38 2005 EDT

  Modified files:  
/php-src/ext/standard   type.c 
  Log:
  - Fixed bug #32719 (strval() fails to zero terminate strings)
  
http://cvs.php.net/diff.php/php-src/ext/standard/type.c?r1=1.26r2=1.27ty=u
Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.26 php-src/ext/standard/type.c:1.27
--- php-src/ext/standard/type.c:1.26Thu Mar 10 21:11:44 2005
+++ php-src/ext/standard/type.c Fri Apr 15 18:46:37 2005
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: type.c,v 1.26 2005/03/11 02:11:44 helly Exp $ */
+/* $Id: type.c,v 1.27 2005/04/15 22:46:37 sniper Exp $ */
 
 #include php.h
 #include php_incomplete_class.h
@@ -177,7 +177,7 @@
Get the string value of a variable */
 PHP_FUNCTION(strval)
 {
-   pval **num, *tmp;
+   zval **num, *tmp;
zval expr_copy;
int use_copy;
 
@@ -190,7 +190,7 @@
tmp = expr_copy;
RETVAL_ZVAL(tmp, 0, 0);
} else {
-   RETVAL_ZVAL(*num, 0, 0);
+   RETVAL_ZVAL(*num, 1, 0);
}
 }
 /* }}} */

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



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

2005-03-10 Thread Marcus Boerger
helly   Thu Mar 10 21:11:47 2005 EDT

  Modified files:  
/php-src/ext/standard   type.c 
  Log:
  - Do not touch return_valu's refcount or is_ref
  
http://cvs.php.net/diff.php/php-src/ext/standard/type.c?r1=1.25r2=1.26ty=u
Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.25 php-src/ext/standard/type.c:1.26
--- php-src/ext/standard/type.c:1.25Thu Apr  1 03:54:44 2004
+++ php-src/ext/standard/type.c Thu Mar 10 21:11:44 2005
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: type.c,v 1.25 2004/04/01 08:54:44 derick Exp $ */
+/* $Id: type.c,v 1.26 2005/03/11 02:11:44 helly Exp $ */
 
 #include php.h
 #include php_incomplete_class.h
@@ -153,8 +153,7 @@
WRONG_PARAM_COUNT;
}
 
-   *return_value = **num;
-   zval_copy_ctor(return_value);
+   RETVAL_ZVAL(*num, 1, 0);
convert_to_long_base(return_value, base);
 }
 /* }}} */
@@ -169,8 +168,7 @@
WRONG_PARAM_COUNT;
}
 
-   *return_value = **num;
-   zval_copy_ctor(return_value);
+   RETVAL_ZVAL(*num, 1, 0);
convert_to_double(return_value);
 }
 /* }}} */
@@ -179,7 +177,7 @@
Get the string value of a variable */
 PHP_FUNCTION(strval)
 {
-   pval **num;
+   pval **num, *tmp;
zval expr_copy;
int use_copy;
 
@@ -187,16 +185,12 @@
WRONG_PARAM_COUNT;
}
 
-   *return_value = **num;
-
-   zend_make_printable_zval(return_value, expr_copy, use_copy);
+   zend_make_printable_zval(*num, expr_copy, use_copy);
if (use_copy) {
-   *return_value = expr_copy;
-   INIT_PZVAL(return_value);
-   zval_copy_ctor(return_value);
-   zval_dtor(expr_copy);
+   tmp = expr_copy;
+   RETVAL_ZVAL(tmp, 0, 0);
} else {
-   zval_copy_ctor(return_value);
+   RETVAL_ZVAL(*num, 0, 0);
}
 }
 /* }}} */

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